Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Macros are pieces of code specified by developers that run on the server.

Macros can be used in Reportsin Reports, javascript files, all HTML contents, and Map CSS contents. Although some simplifications have been made in the syntax based on the place to be used in, the general usage is as in this document.

The macro language is set to C #C#. All methods of the object accessed via the API can be used.

Macros are defined as [= ...].

(info) Map CSS and some special particular fields do not use square brackets. Information can be found in the relevant documents.

(warning) When it is necessary to use (info) When using square brackets inside a macro, it should be written as \] instead of ]. This holds for any other or any other char reserved for JSON.

Some Macros may evaluate a value, while others check a visibility condition. In a macro, you can use all c# classes and GEODI/MOBIDI Specific classes. Two classes, d, and c, are important

Code Block
languagexml
Samples
[=4*4]
[=new Random().Next(0,500)]
[=Math.Round(0.47)
[=DateTime.Now]
[="test".ToUpper()]

...

Data (d)

...

Data (d) Object

The type of macro varies depending on where it is used.  If the macro is used, the data type of the data object must be known. The types  are written in the  developer documentation and Readme.txt files. The related documentation will define the type. You will also find a readme file where you put the definitions. For example, In GEODI reports, the Data object is GeodiEntry. This means every row is a GeodıEntry.

Code Block
languagexml
<div>
	<label> File name : </label> [=d.OutputGeodiContent.DisplayName]
</div>

Context (c) Object

Content is available wherever a macro is used. It It is an EvaluatorContext object. It includes helper methods and information about map maps, such as details about the geometry that is being drawn and the scale level.

Code Block
languagexml
[=c.ToString(DateTime.Now,"en-US","dd MMM yyyy")]

Code Block
languagexml
<div>
	<dcc:panel visible='c.HasPermission("DECE.SYSTEMMANAGER")'>
		You are the system manager.
	</dcc:panel>
</div>

The context contains a limited number of helper methods. More helper methods can be accessed using the The context ["HelperName"] method can access more helper methods. A list of all helper classes is available here.

Code Block
languagexml
<div>
	<a href='[=c["geodi.link"\].ViewerLink(d)]'> [=d.OutputGeodiContent.DisplayName] </a>
</div>


ConditionMacro

Visibility condition for a report, dashboard, or many other definitions. Must be evaluated to true/false.

Active Workspace must have XX_Enable key set to true.

Code Block
ConditionMacro:'["geodi"].GetWS().GetGenericSetting<bool>("XX_Enable",false)'

The user must be a member of ACC.Discovery group.

Code Block
"ConditionMacro":'=c.HasPermission("Group:ACC.Discovery")',