Page History
...
Angle Brackets operator, Calculate function
Example
Code Block |
---|
/* The following example shows you how to evaluate column values by reference to the dictionary column name. |
...
*/
/* The following function segment opens the SAMPLE_PRODUCTS table, then the dictionary of that table, then reads the desired row, using @ID, then reads the desired column value, using the dictionary column name. It returns the price of the specified item. */
table = "SAMPLE_PRODUCTS"
key = "TCHBUL" |
...
;* the technical bulletins product UnitPrice = "" |
...
;* initialize the return variable
@ID = key
Open table To tablevar Then
|
...
Open "DICT ":table To @DICT Then |
...
...
Read @RECORD FROM tablevar, @ID Then
|
...
UnitPrice = {RETAIL_PRICE} |
...
End Else |
...
...
status = Set_FSError( )
|
...
End ;* Read |
...
End Else
|
...
status = Set_FSError( ) |
...
End ;* Open dictionary End Else |
...
status = Set_FSError( )
End ;* Open table
/* Convert the value of RETAIL_PRICE, which is stored in internal format, to a display format. */
Return OConv(UnitPrice, "MD2,$")
The following three code segments are equivalent:
temp = {INV_AMT}
temp = Calculate( INV_AMT)
dict_ |
...
field = "INV_AMT" field_value = Calculate(dict_field) * Notice that in each case, the dictionary * word INV_AMT is executed. |