Navigation: Language Reference > 13 - Built-in Functions >====== TIE(associate a string value to an ASTRING) ====== | |
TIE(stringtoken [,index] ,value)
TIE | Associates a string value to an ASTRING. |
stringtoken | A string constant or the label of a previously declared ASTRING token. |
index | A numeric constant or expression defining the index value of an ASTRING. The index value may be any LONG value, if omitted or zero, the RTL returns a negative which must be used in TIED and UNTIE. |
value | A numeric constant or variable. The value may be any LONG value greater than zero. |
The TIE statement associates a value to a particular stringtoken and index. A unique index may be allocated at runtime by either omitting the index or setting it to zero. If the index is allocated at runtime, TIE will return the generated index number.
Return Data Type: LONG
Example:
PROGRAM
MAP
END
INCLUDE('EQUATES.CLW')
COLOR EQUATE(1)
SIDES EQUATE(2)
AS1 ASTRING
CODE
AS1 = 'SHAPE' !Declare ASTRING string token
TIE('SHAPE',COLOR,COLOR:RED) !Associate COLOR:RED to COLOR for ASTRING SHAPE
TIE(AS1,SIDES,3) !Associate 3 to SIDES for ASTRING SHAPE
IF TIED('SHAPE',SIDES) = 3 AND | !If the value associated to SIDES = 3
TIED(AS1,COLOR) = COLOR:RED !and the value associated with COLOR=COLOR:RED
MESSAGE('Shape is a red triangle')
END
See Also: