Types
Simple Types
The Linx plugin contains all Simple Types. These include
Use a Simple Type to create a variable in a Function by
- Dragging the type from the plugins panel onto the body of a Function
- Setting the Value property
Complex Types
In the Linx Designer, Complex Types are just called Types.
A Type in Linx works just like a JSON object. Types contain collections of named properties. Each property represents a Simple Type, a complex Type or a List.
Creating a complex type
- Click the Type button in the toolbar to add a type to your solution
- Set a name for the Type in the Properties panel
- Add properties to the Type using the Type Editor
- Add a name for each property in the Name column
- Select the property type in the Type column dropdown
Here is a JSON representation of the Type_Person type
{
"Person": {
"Address":{
"Street": "",
"City": "",
"POCode": ""
},
"Children": [],
"DOB": "",
"Name": "",
}
}
Using a complex type
- Drag the Type from the Solution Explorer onto the Function body
- By default the type is instantiated as empty using squiggly brackets {}, but its properties are not initialized and default to null
- Set values for Type properties by either
- Launching the Values Editor to add values
- Using a SetValue function
Lists
Lists can be of any simple or complex type
Creating a List
- Drag a List from the Linx plugin onto the Function body
- An empty List will be initialised using square brackets [ ]
- Choose the List type in the property dropdown (it defaults to String)
Adding items to lists
Add items to Lists by either
- Launching the List editor
- Dragging an AddToList function into the Function
- Selecting the List and value to add in the AddToList properties
Other functions to manipulate the list are available in the Linx plugin
Assignment Errors
A common problem is caused by the attempt to assign values to NULL elements.
- To set a value for a property of a complex type, the type cannot be null
- Instantiate a Complex type inside another one with {"PropertyName":{}}
- Lists must be instantiated before they can be added to
- Instantiate Lists that are properties of complex types with {"PropertyName":[]}