Description
Returns the result of evaluating a dictionary item.
Syntax
value = Calculate (expression)
Remarks
You can use the Calculate function in place of the {} (Braces) function. Calculate must be used if the column name is not known at compilation time. The expression specified in the Calculate function must evaluate to a column name in the file that has been opened to the system variable @DICT.
See also
Example
The following example shows how to evaluate column values by reference to the dictionary column name.
/* The following code fragment opens the SAMPLE_PRODUCTS table then the dictionary for that table, then reads the desired row, using @ID, then calculates 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 Value = "" ;* initialize the return variable @ID = key Open table To tablevar Then Open "DICT. ":table To @DICT Then Read @RECORD From tablevar, @ID Then dict_field = "INV_AMT" * The following three code segments are equivalent: Value = {INV_AMT} Value = Calculate("INV_AMT") Value = Calculate(dict_field) End Else status = Set_FSError() End ;* Read End Else status = Set_FSError() End ;* Open dictionary End Else status = Set_FSError() End ;* Open table /* Notice that in each case, the dictionary item INV_AMT is calculated. */