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 FUNCTIONNote:
- Line
1declares the function with an integer parameter. No values are returned by the function. - Lines
2and3set the value of theline_totalrecord member in the row at indexxoforditemsdynamic array, by multiplying the quantity by the price of the item in this row.