Clavar
clavar
returns the name of the variables present in a class.
clavar(CLASS_DESCRIPTION,RANK)clavar(NUMERIC_EXPRESSION,RANK)
CLASS_DESCRIPTION
is a class description with the [ABBR]
syntax, where ABBR
is the abbreviation of a class. Note, of a class of type table use [F:ABBR]
RANK
is an index of the column in 'clavar'. The column names are listed in alphabetical order.NUMERIC_EXPRESSION
refers to the slot number for the class. This can be seen in the debugger, but should be considered internal. # Example 1# Get the name of the first local variableVARNAME=clavar([L],1)# Example 2# List the global variables available in a given class. Classname is in the form [F:ABBR], for example.Subprog VARLIST(CLASSNAME,NUMBER, VARNAME, VARTYPE)Value Char CLASSNAME()Variable Integer NUMBERVariable Char VARNAME()(1..)Variable Integer VARTYPE(1..)Local Integer I,J,MAXCLASSMAXCLASS=200# Search if the class existsFor I=1 to MAXCLASSBreak (clanam(I)=CLASSNAME) : # End the loop if the class name is foundNext I# If I is greater than MAXCLASS, the class was not foundIf I>MAXCLASSNUMBER=0EndEndif# Otherwise, get all the variable names, and compute their typeNUMBER=clanbs(I,1)For J=1 to min(dim(VARNAME),dim(VARTYPE),NUMBER) : # To prevent an out of indexVARNAME(J)=clavar(I,J)VARTYPE(J)=evalue("type("+CLASSNAME+VARNAME(J)+")")Next JEnd
clavar(classname,N)
returns variable name of the Nth variable in a class. If the variable name does not exist in the class for the Nth variable the return is an empty string. If the classname is not available in the clavar then errn=10 is returned (Type incompatible)
The result of the function is Char.
Error | Description |
---|---|
10 | Type incompatible |
50 | The numeric argument is negative. |
clalev, clanam, clanbs, clasiz, errn, onerrgo