Skip to main content

Selected Interventions Echo - Complex Datatype Logic

  • What is it? This formula will create a Base64 encoded string containing form values mapped to Echo complex datatypes, and prefixed with the value JADUSIE:1: as an indicator for other components and services designed to recieve its value.

This formula is designed to work seamlessly with other Echo integration components:

  • Reserve Available Slots Component - The encoded output can be passed to this component to ensure bookings are made with the correct complex datatype information (like bulky item details)
  • Event Creation - The encoded output is processed during event creation to properly structure the complex datatype in the Echo event

Inputs

This formula requires the following inputs to be passed through to it:

  • Service

    The Service for which Event Types will be selectable. The options provided here are for Echo services which exist under the contract configured in the Integration settings.

  • Event Type

    The Event Type for which the Complex Data Types will be selectable. The options provided here are for Echo Event Types which exist under the previously configured Service Input field.

  • Complex Data Type

    The Complex Data Type for which the Child Data Type fields will be selectable. The options provided here are for Echo Complex Data Types which exist under the previously configured Event Type Input field. Only Complex Data Types that are set as arrays and contain Child Data Types will be selectable in this field.

  • Child Data Type fields

    The fields which appear here as a result of selecting the Complex Data Type input are dependent on the configuration within Echo itself. These fields can be configured to have a static value or a reference to another field or logic.

    In addition to the title of the Child Data Type field, the field type (ie the expected format of the value) will be displayed when configuring this logic.

Return values

ValueDescription
A JSON encoded object of form values mapped to Child Data TypesIn the event that no configuration or validation error has occurred.
[error]In the event that the calculation has not bee correctly configured or if configured fields no longer represent the data found in Echo.
[invalid]In the event that any value submitted to a Child Data Type field does not adhere to the formatting rule of its field (e.g. a string value sent to an Integer field)

Sample output

tip

The output displayed here is the JSON object before Base64 encoding, and is on multiple lines for clarity, however the actual output of this logic will be Base64 encoded, prefixed with the value JADUSIE:1: and will not contain line breaks.

The following JSON output would be generated in the event that:

  • DatatypeId 3666 is populated from a static value populated when configuring the logic itself.
  • DatatypeId 3667 is populated by the output of another logic that has been configured as the input to that Child Data Type.
  • DatatypeId 3668 is populated by the end user submitted value of a field that has been configured as the input to that Child Data Type.
[
{
"DatatypeId": 3665,
"ChildData": [
{
"DatatypeId": 3666,
"Value": "Static value"
},
{
"DatatypeId": 3667,
"Value": "Logic value"
},
{
"DatatypeId": 3668,
"Value": "Field value"
},
]
}
]

In the event that an end user has submitted multiple values to a field that has been configured as the input to a Child Data Type by using a repeatable question, the JSON object will consist of an array of multiple mappings. Each item in the array will be populated with a single value from the repeatable question. All values that do not belong to a repeatable question will be duplicated in each item.

[
{
"DatatypeId": 3665,
"ChildData": [
{
"DatatypeId": 3666,
"Value": "Static value"
},
{
"DatatypeId": 3667,
"Value": "Logic value"
},
{
"DatatypeId": 3668,
"Value": "Repeatable Question Row 1 Value"
},
]
},
{
"DatatypeId": 3665,
"ChildData": [
{
"DatatypeId": 3666,
"Value": "Static value"
},
{
"DatatypeId": 3667,
"Value": "Logic value"
},
{
"DatatypeId": 3668,
"Value": "Repeatable Question Row 2 Value"
},
]
}
]

Array value handling

If a child datatype field is set as an array in Echo, the value will be treated as a comma separated string of values. For instance, if a child datatype is set as an array of boolean values the expected input will be a comma separated string of boolean values (e.g. true, true, false, true). If any of the values provided do not match the expected format, the formula will return [invalid].

Just as with values that are populated in repeatable sections, the Datatype IDs will be duplicated for each value populated in an array value. e.g:

[
{
"DatatypeId": 3665,
"ChildData": [
{
"DatatypeId": 3666,
"Value": true,
},
{
"DatatypeId": 3666,
"Value": true,
},
{
"DatatypeId": 3666,
"Value": false,
},
{
"DatatypeId": 3666,
"Value": true,
},
{
"DatatypeId": 3667,
"Value": "Logic value"
},
{
"DatatypeId": 3668,
"Value": "Field value"
},
]
}
]

Formula Logic

  1. A check is made against the configured Event Type and Datatype. If either are empty, the formula returns the value [error].
  2. A call is made to the Echo service to retrieve data for the Event Type that has been configured. If the Event Type cannot be found, either due to it being missing from the Echo service, because the Echo server has not responded, or because the Echo Integration is not enabled, the formula returns the value [error].
  3. If the returned Event Type does not contain any Datatypes, the formula returns the value [error].
  4. If any of the values populated for any configured child datatype contains a value that does not match its field type, the formula return [invalid]
    • Integer fields must consist of all numeric characters
    • Boolean fields must be true, yes, y or 1 for true values or false, no, n or 0 for false values
    • Date and DateTime fields must be of a suitable Date or Time format
  5. Any configured Child datatypes with an empty value submitted are removed from the resulting Base64 encoded object.