Introduction
Many fields can be configured with scripts and simple expressions however for the purposes of the examples here we have assumed that the reader is configuring a Stream Attribute field unless otherwise stated. This field is in no way special and in general all of the scripting elements and techniques described are available in all of the dynamic fields. Any special cases are documented on the help screen describing the individual form.
Assigning a literal value to a field
The most basic expressions simply assign a constant value to the field. For example these three expressions assign the integer 3, the floating point number 3.2 and the string "Hello" to the field:
Expression | Result |
---|---|
3 | 3 |
3.2 | 3.2 |
"Hello" | "Hello" |
Note that if you want to assign a string value (as in the last example) then the characters must be enclosed in either single 'Hello' or double "Hello" quotes.
...
Insert excerpt | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
...
...
...
...
...
...
...
...
...
Assigning values from a Pipe
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Adding Comments
In longer scripts (and even short scripts) it is a good idea to add comments to remind yourself (and anyone else who may need to modify the script in future) what steps are being followed. For short, 1 line comments, just prefix the line with // and for longer, multiline comments, enclose the lines in /* .... */. For example:
/* Get the discount rate that should apply to the calls which match the filter conditions */ $discountRate = discount.rate, // Now apply the discount $value = $value * ( 1 - $discountRate)
The lines above are comments and are ignored by PhixFlow.