Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns the FIELD substring start position.
The COL1 function takes no arguments. The parentheses are mandatory.
The COL1 function returns the starting position for the most recently called FIELD function. FIELD extracts a substring from a string by specifying a delimiter character. The specified delimiter immediately precedes the extracted substring. COL1 returns the string position (counting from 1) of this delimiter character.
If the FIELD count is 1, COL1 returns 0. If the FIELD count is greater than the number of delimited substrings, COL1 returns 0. If the FIELD delimiter is not located in string, COL1 returns 0
The initial COL1 value is 0. The COL1 value is preserved until it is overwritten by the next FIELD function call.
COL1 returns a substring's start delimiter position. COL2 returns a substring's end delimiter position.
The following example shows the use of the COL1 function:
FOR x=1 TO 5
   PRINT FIELD(colors,"^",x)
   PRINT "Start delimiter position: ":COL1()
      ! Returns: 0, 4, 10, 15, 22
See Also