...
...
...
...
...
Overview
Sometimes we might want to write our own expressions that can be used time and again. To do this we can write a macro.
To make an expression reusable in different contexts, you need to replace any references to named items, such as attributes with arguments, such as $args[1], $args[2]
. To use the macro in an expression, specify:
macro_name(argument_name)
For example, we want to reuse an expression:
if( out.AppleHarvestDate < 1, 1, 0)
Create a macro called isGreaterThanOne that contains the expression:
if($args[1] > 1, 1, 0)
To use the macro, replacing $ars[1] with the pipe and attribute name _out.AppleHarvestDate
:
isGreaterThanOne(_out.AppleHarvestDate)
See also: Expressions, Scripts and Macros
Properties
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
...
Basic Settings
Field | Description |
---|---|
Name | The name of the macro. This name is also how the macro will be invoked (called) from elsewhere in PhixFlow |
Minimum Parameters | The minumum number of parameters that must be passed to the macro when it is invoked. |
Maximum Parameters | The maximum number of parameters that may be passed to the macro when it is invoked. |
...