DataObject.SetRoleVar

Prototypes

void SetRoleVar( int nRole, String sVarName )

Parameters

int nRole
A predefined constant specifying the role. The valid values are ROLE_LABEL, ROLE_FREQ, and ROLE_WEIGHT. The constant ROLE_LABEL specifies the label variable, the constant ROLE_FREQ specifies the frequency variable, and the constant ROLE_WEIGHT specifies the weight variable.

String sVarName
The name of the variable to put in the specified role. If sVarName is null or "", no variable will have the specified role.

Remarks

This method puts a variable in a role. For a given DataObject, only one variable at a time can have a particular role. Only numeric variables can be put in the role of a frequency or weight variable.

Note that the label variable set by this method is distinct from the label variable set by the method Plot.SetObsLabelVar. The method DataObject.SetRoleVar instructs all associated data views to use the specified label variable. The method Plot.SetObsLabelVar enables you to customize the label variable used by a specific plot.

Example
declare DataObject dobj;
dobj = DataObject.CreateFromFile( "baseball" );
dobj.SetRoleVar( ROLE_LABEL, "team" );
DataTable.Create( dobj ).ActivateWindow();
LabelVar = dobj.GetRoleVar( ROLE_LABEL );
print LabelVar;
See Also

DataObject.GetRoleVar