Overview
Expressions contain brackets that contain set of arguments. The arguments are separated by commas. Expressions can also include:
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
Tip |
---|
To assign a string, it must be enclosed in:
|
In PhixFlow, you can create your own variables using a $ symbol, for example $variableName
; see Using Variables.
Internal Variables
Sometimes when youWhen you pass a a value that is passed between programs, subroutines or functions. Arguments are independent items, or variables, that contain data or codes.
PhixFlow has a list of functions you can use in an expression.
expression within an expression
internal variable
_out. tells PhixFlow that it has already "seen" the attribute AppleHarvestDate in this stream.
You can refer to
<pipe_name>.<attribute_name> and pipe names default to "in", so in.AppleHarvestDate which signals that AppleHarvestDate is being sourced down a pipe going into the stream called 'in'. The internal variable preceding an attribute name should reflect where the attribute is being source from.
There are many other internal variables, see /wiki/spaces/HELP80/pages/1456964453.
Regular Expressions - Regular expressions can be used to match patterns within strings or arrays as arguments within jep expressions, for example replaceAll, replaceFirst and matches. See Regexp ToDelete.
Simple integers or strings. In the above case 1 and 0 are simple integers. They tell PhixFlow to return the number 1 if NumberOfApples > 1 and 0 if it is not. A string could be returned instead eg. if(_out.NumberOfApples > 1, 'True', 'False') would return the string True if NumberOfApples >1 and False if it is not. Note strings need to be wrapped in ' marks.
(To find the correct syntax for an expression - find it in the list below or search in confluence)
If() Statements
It is common to want to evaluate whether or not data meets a condition. To do this use an if() statement; see the if page.
if(
_out.NumberOfApples > 1, 1, 0
)
For some examples using comments, plus other style tips for expressions, see Expression Style.
See Also
ToDelete topic page for links to more information.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> */