Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The braces are useful for program readability. They are also useful when the field name is known but the position may have been changed. When the field name is not known, the Calculate function is used. When the position will not change and if speed is important, use < > (dynamic array operators).

...

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.

 

...