Contents - Index


LOOKUPCOLNAME$

 

LOOKUPCOLNAME$('TableName', ColumnNo) returns or sets the name of a specified column in a Lookup table.  'TableName' is the name of a Lookup table or a Lookup file.  It may be a string constant or string variable.  ColumnNo can be a number or expression that evaluates to the column number in the table.  If the column is not found, the function will return '??'

 

The name of an existing column in a Lookup table can only be changed within an internal Function or Procedure. To change the column name,  place the LOOKUPCOLNAME$ function call on the left hand side of an equation, as illustrated in the following example.  Note that the both the column name and the units can be set. The units are assumed to be to the right of the \ character.  

 

Function setcolname(ColNo, NewName$)

   lookupcolname$('Lookup 1',ColNo)=NewName$

   setcolname=1 {The function result must be set to a value}

End

g=setcolname(1,X$)

X$='XYZ\units'

 

After running this example, the name of Column 1 of Lookup table 'Lookup 1' will be 'XYZ' and its units will be 'units'.

 

Note that the LookupColInfo macro command provides a simpler way to change the name, units and display format of an existing column in a Lookup table.

 

See also:  LOOKUPCOLUNITS$

 

String Functions