...
Expression | Result |
---|---|
$day = $weekDays[3] | Sets $day to "Wednesday" |
$i = 3, $day = $weekDays[$i+2] | Sets $day to "Friday" |
$day = getElement($weekDays,4) | Sets $day to "Thursday" |
$day = $weekDays.3 | Sets $day to "Wednesday" |
$day = $weekDays[9] | Sets $day to _NULL since there is no element at position 9 |
$weekDays = _NULL, $day = $weekDays.3 | Sets $day to _NULL since there is no element at position 3 (in fact there are no elements at all) |
$weekDays = [], $day = getElement($weekDays,3) | Sets $day to _NULL since there is no element at position 3 (in fact there are no elements at all) |
Similarly, to set the value of the nth item in an Array, use setElement(array,n,value):
...
Expression | Result |
---|---|
$accountNum = account.accountNum | account.accountNum returns the value of the Attribute accountNum within the Record Set account. Because the Pipe just returns a single value, $accountNum is a single value (not an Array). |
$invoiceNumbers = invoices.number | invoices.number returns an Array of the Attribute number within the Record Set invoices. |
$firstInvoiceNumber = invoices.number[1] $firstInvoiceNumber = invoices.number.1 $firstInvoiceNumber = invoices.number[$j] | This gets the first invoice number. This gets the first invoice number. This get the invoice number for position $j in the array. Note that the dot notation does not work with a variable e.g. invoices.number.$j |
$firstInvoice = invoices[1], $firstInvoiceNumber = $firstInvoice.number | This also gets the first invoice number. Note that the Record Set invoices[1] has been assigned into a $-Variable. |
$attr = "number", $invoiceNumbers = invoices.$attr | This also creates an Array of the invoice numbers. Note that the $-Variable $attr has been set to the name of the Attribute which is then used to decide which Attribute to read from invoices. |
...