Example: orders.4gl (Function items_line_total)
This function computes the total amount for an order item line.
Function
items_line_total
(orders.4gl): 1 PRIVATE FUNCTION items_line_total(x INTEGER) RETURNS ()
2 LET orditems[x].line_total =
3 orditems[x].quantity * orditems[x].price
4 END FUNCTION
Note:
- Line
1
declares the function with an integer parameter. No values are returned by the function. - Lines
2
and3
set the value of theline_total
record member in the row at indexx
oforditems
dynamic array, by multiplying the quantity by the price of the item in this row.