Clavar

clavar returns the name of the variables present in a class.

Syntax

 clavar(CLASS_DESCRIPTION,RANK)clavar(NUMERIC_EXPRESSION,RANK)

Examples

 # 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

Description

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.

Associated errors

ErrorDescription
10Type incompatible
50The numeric argument is negative.

See also

clalev, clanam, clanbs, clasiz, errn, onerrgo