Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Tip |
---|
To assign a string, it must be enclosed in:
|
In expressions that have complex calculations, you may need a variable to hold the result of a calculation. You can then reference the variable later in the expression, or in other attribute expressions for the same stream. In PhixFlow you can use a $-variable for this, by prefixing the variable name with the $ symbol.
Adding Comments
It is always a good idea to add comments to your scripts to explain its steps. Comments help anyone who needs to modify the script in future.
There are two ways to tell PhixFlow that a line is a comment, and can be ignored.
//
short comments up to 1 line
/* <comment> */
For example:
/*
Get the discount rate that should apply to the calls that match the filter conditions
*/
$discountRate = discount.rate,// Now apply the discount
$value = $value * ( 1 - $discountRate)
For other style tips for expressions and scripts, see Scripting Style.