Macros
Managing macros
Macros offer the possibility to encapsulate and reuse function chains. This allows the compact use of function chains and a central maintenance of these. Changes to a macro affect all profiles that use this macro. Macros can be defined system-wide or client-specific.
You can open the macro dialog via the target structure menu in the lower bar of the function area with option "Manage macros". Either to create the existing function chain as a new macro or to display the overview of all macros. Note: You can copy the ID of a macro in the opened macro.
Creating a new macro
Assume the following function chain.
If you want to create this function chain as a new macro, you will get the following dialogue.
(1) ID: The ID of the macro. Can be copied here.
(2) Description: Text that will later be displayed in the tooltip.
(3) Access: The macro is visible either system-wide or client-wide. Note: Cannot be changed after the first save.
(4) Exclude in export: With this option you can decide whether the macro should be ignored when exporting profiles or when transferring profiles with the Transport Manager.
(5) Functions: Here you can add further functions to the function chain (6). But to keep the example simple, we will not do that now.
(6) Functions contained in macro: The current function chain with all its individual functions. If you mark a function, the parameters of the function are displayed (as usual).
(7) Test macro: The macro can be tested here. If input parameters were used, see (8), you can specify test values for these.
(8) Index, Description, Test value: Optional input parameters (left window). See following section.
Creating input parameters for the macro
If you save the macro created above, you can already use it on fields and nodes. The example above, however, is very simple and not really helpful in this form. Often, as you are used to from most functions, you also want to use input parameters.
For this task, there is a special input parameter type "Parameter" for macros only, which you can select instead of any of the input parameters in the function chain. See the following example.
Example
Highlight parameter a of the first function in the chain, change the type to "Parameter" and change the value from "4" to "1". The value is the parameter index. However, in order for this to be used, an input parameter must be created.
Now use the context menu in the left window (9) and create a new input parameter, which has the index "1". Use test value "5". This test value will be used as the input value for this parameter if you click button "Test macro" (7).
As a result of the macro test, you should now get "23".
Using the macro
If you now use the macro on a node or field, it will look like this. You will see that the macro has one parameter (10). This is the parameter that you just created.