Please enable JavaScript to view this site.

Vensim Help

C/C++int VEFCC vensim_get_varattrib(const char *varname,int attrib,char *buf,int maxbuflen) ;

int VEFCC VensimCGetVarAttrib(int context,const char *varname,int attrib,char *buf,int maxbuflen) ;

Javapublic static native String[] get_varattrib(String varname,int attrib) ;

public static native String[] CGetVarAttrib(int context,String varname,int attrib) ;

VBPrivate Declare Function vensim_get_varattrib Lib "vendll32.dll" (ByVal varname$, ByVal attrib As Long, ByVal buf$, ByVal maxbuflen As Long) As Long
Pascalfunction vensim_get_varattrib(varname: PChar; attrib :Integer; buf:PChar; maxbuflen:Integer ):  Integer ; stdcall ; external 'vendll32.dll' ;

Use this function to get the attributes of model variables.

Arguments

varname        The name of the variable that you want information about.

attrib        The attribute you want to retrieve.  1 for Units, 2 for the comment, 3 for the equation, 4 for causes, 5 for uses, 6 for initial causes only, 7 for active causes only, 8 for the subscripts the variable has, 9 for all combinations those subscripts create,10 for the combination of subscripts that would be used by a graph tool, 11 for the minimum value set in the equation editor, 12 for the maximum and 13 for the range, 14 for the variable type (returned as "Level" etc) and 15 for the main group of a variable.

buf        A memory location to put the results of the query.  Results are stored as a sequence of null terminated strings one following another.  A double null is used to mark the termination of the sequence.  buf is NULL or maxbuflen is 0 the function just returns the amount of space needed.

maxbuflen        The maximum amount of material to put in the buffer.

Returns

The amount of space needed to store the result.  -1 if there is an error or the variable is not found.

Notes

The units, comments and subscript family atrtibutes (1,2 and 8) only return a single string.  The others may return more than one string.  If the variable has no subscript the subscript queries all return an empty string.  If maxbuflen is not big enough the results will be truncated.  Comments will be truncated arbitrarily, for other attributes truncation will be done on complete strings so, for example, fewer causes will be listed.

If vensim_get_varattrib is called with a subscript range or element there will be no causes, uses will list all variables containing that subscript (main range), the subscripts for the variable will give the name of the main subscript range, 9 will return the elements of the subscript range or the subscript constant and 10 will return the list of elements in the main range currently selected.

See Also

vensim_get_data