PhixFlow Help

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Forms: Macro

A Macro allows PhixFlow to define and retain functions (macros) can be called repeatedly.

Form: Macro

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.
Expression The script that evaluates to a value based on the input parameters.

The following fields are displayed through a separate tab within the main macro form:

Field Description
Description Free form text field to describe the Macro.

Form Icons

The form provides the standard form icons.

Example Macro

This sample macro is called padCost. It takes 1 parameter - a numeric value. It checks to see if the numeric value is missing a 0 before a decimal point. If so, it adds the 0 and returns the string. It can be called anywhere in phixflow that an expression can be entered (for example) with :

padCost(".977")

do( $val = $args[1], if(startsWith($val, "."), //if the cost is positive, add a zero onto the beginning "0" + $val, if(startsWith($val, "-."), //if the cost is negative, replace the -. with a -0. "-0." + substring($val,3), //ELSE $val ) )

See Also

  • No labels