Types

Simple Types

The Linx plugin contains all Simple Types. These include

Use a Simple Type to create a variable in a Function by

  1. Dragging the type from the plugins panel onto the body of a Function
  2. Setting the Value property

Simple Types

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

  1. Click the Type button in the toolbar to add a type to your solution
  2. Set a name for the Type in the Properties panel
  3. 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

complex types

This example shows a Type with four properties (Address is of type 'Type_Address', Children is a List of type 'Type_Child', DOB is of type DateTime and Name is of type String)

Here is a JSON representation of the Type_Person type { "Person": { "Address":{ "Street": "", "City": "", "POCode": "" }, "Children": [], "DOB": "", "Name": "", } }

Using a complex type

  1. Drag the Type from the Solution Explorer onto the Function body
  2. By default the type is instantiated as empty using squiggly brackets {}, but its properties are not initialized and default to null
  3. Empty type
    Instantiated, empty type
  4. Set values for Type properties by either
    • Launching the Values Editor to add values
    • types
      Drag the type into the Function
    • Using a SetValue function
    • Empty type
      Using a SetValue to set a Type property

Lists

Lists can be of any simple or complex type

Creating a List

  1. Drag a List from the Linx plugin onto the Function body
  2. An empty List will be initialised using square brackets [ ]
  3. Choose the List type in the property dropdown (it defaults to String)

List type

Adding items to lists

Add items to Lists by either

  1. Launching the List editor
  2. List
  1. Dragging an AddToList function into the Function
  2. Selecting the List and value to add in the AddToList properties
  3. List

Other functions to manipulate the list are available in the Linx plugin List

Assignment Errors

A common problem is caused by the attempt to assign values to NULL elements.

  1. To set a value for a property of a complex type, the type cannot be null
  2. Empty type
    Attempting to set an uninstantiated type causes an 'Object reference not set to an instance of an object' error
  3. Instantiate a Complex type inside another one with {"PropertyName":{}}
  4. Instantiated types
    Complex types that are properties of other complex types must be instantiated before they can be used
  5. Lists must be instantiated before they can be added to
  6. List
    Attempting to add items to an uninstantiated List causes a 'Cannot add to list as it is null' error
  7. Instantiate Lists that are properties of complex types with {"PropertyName":[]}
  8. Instantiated List
    Lists that are properties of complex types must be instantiated before they can be used

Tutorial video



Previous | Next