Macros

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

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

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

Macros are defined as [= ...].

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

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

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

 

Data (d) Object

The type of macro varies depending on where it is used.  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.

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

Context (c) Object

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

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

 

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



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.

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