VariableCollection
A collection of variables in the model.
Example
app = cf.GetApplication() project = app:NewProject() -- List all predefined variables in the application with their expressions for key,var in pairs(project.Variables) do print(var.Name.." = "..var.Expression) end
Usage locations (collections)
The following objects contain the VariableCollection collection:
Property List
Method List
- Add (name string, expression Expression)
- Create a variable from the given expression. (Returns a Variable object.)
- Add (name string, expression Expression, description string)
- Create a variable from the given expression. (Returns a Variable object.)
- Contains (label string)
- Checks if the collection contains an item with the given label. (Returns a boolean object.)
- Item (index number)
- Returns the Variable at the given index. (Returns a Variable object.)
- Item (label string)
- Returns the Variable with the given label. (Returns a Variable object.)
- Items ()
- Returns a table of Variable. (Returns a List of Variable object.)
- SetExpressions (variablelist Map of string:Expression)
- Change the expressions for several variables simultaneously.
- UniqueName (label string)
- Generates a unique name base of of the provided base name.If the base name already exists in the collection, a digit will be appended until a valid name is generated. (Returns a boolean object.)
Index List
Property Details
Method Details
- Add (name string, expression Expression)
- Create a variable from the given expression.
- Input Parameters
- name(string)
- The variable name.
- expression(Expression)
- The variable expression.
- Return
- Variable
- The variable.
- Add (name string, expression Expression, description string)
- Create a variable from the given expression.
- Input Parameters
- name(string)
- The variable name.
- expression(Expression)
- The variable expression.
- description(string)
- The variable description.
- Return
- Variable
- The new variable.
- Contains (label string)
- Checks if the collection contains an item with the given label.
- Item (index number)
- Returns the Variable at the given index.
- Item (label string)
- Returns the Variable with the given label.
- Items ()
- Returns a table of Variable.
- SetExpressions (variablelist Map of string:Expression)
- Change the expressions for several variables simultaneously.
- Input Parameters
- variablelist(Map of string:Expression)
- The variable name.
- UniqueName (label string)
- Generates a unique name base of of the provided base name.If the base name already exists in the collection, a digit will be appended until a valid name is generated.