Control

Assign If

Overview

Assign a value based on the output of an expression.

Input Fields

  • left-operand: The first operand in the expression.
  • operator: The operator to compare two values in an expression.
  • right-operand: The second operand in the expression.
  • valueIfFalse: The value that will be assigned as this module’s “output”, when the expression evaluates to false.
  • valueIfTrue: The value that will be assigned as this module’s “output”, when the expression evaluates to true.

Output Fields

  • output: The value returned by the expression. For example, if the expression evaluates to “true” and the “valueIfTrue” equals 5, then referring to [moduleID].output for this module will reference the value 5.

Continue If

Continue the function if…

Input Fields

  • left-operand: The first operand in the expression.
  • operator: The operator to compare two values in an expression.
  • otherwise.message: The message that will be set as this module’s output value if the given expression evaluates to “false”.
  • right-operand: The second operand in the expression.

Output Fields

  • message: The message that was sent when the expression was evaluated to false. To use this message in the rest of your method, use [thisModuleID].output.

Let

Declare or rename variables in the local scope.

Input Fields

  • *User-Determined*:  The keys placed into “input” represent the new variables to assign values to. If “Foo” is set as a key in this module, with value “Baz”, you may use “{{[moduleIDHere].Foo}}” throughout the rest of the method to refer to the value “Baz”. You may assign as many variables inside “inputs” as you need.

Output Fields

  • *Empty*: The keys placed into “input” will be implicitly mirrored as output for this module. You may define items here, but it is not necessary. If there are keys in this output that are not found in the input, your Connector will not compile.

Examples

{
   "brick": "control.let",
   "id": "[idHere]",
   "inputs": {
     "[desiredVariableNameHere]" : "[desiredValueHere]"
   },
   "outputs": {}
 }

Since

Saves a value that will persist through an execution of a Flow, to allow for later retrieval of that value. May take in an object and accompanying path to draw a value from. If no path or object are provided, this will save the current time, in the provided format. Should only be used in Polling Events.

Inputs

  • object: The object you want to parse your since from. Oftentimes you’ll use this for situations where a service already has a way that it records timestamps, and you want to access it from an object it returns in the body of its response. Leave this field blank if you want to set your “since” value to be the current time.
  • path: The path inside of the object to find the desired “since” value. Leave this field blank if you want to set your “since” value to be the current time.
  • format: If you are not using an object and path to choose a “since” value, you may instead select a format in this input to generate a current timestamp in the provided format. You may leave this blank if grabbing your “since” value from an object and path. Available formats are “unix”, “iso8601”, “iso8601+0000”, “yyyy-MM-dd HH:mm”, “yyyy-MM-dd HH:mm:ss”, “YYYY-MM-DD HH:mm:ss ZZ”

Outputs

  • output: The “since” value, that will persist between iterations of a Polling Event

Example #1:

This example will show a “since” value being pulled from an existing object. In a real example, the since value would often be pulled directly from the body of a response from your service, or pulled from the last item in a list returned by your service. In this example, we’re just taking in an arbitrary object. To grab a “since” value this way, fill in the “object” and “path” inputs, and leave “format” blank.

{
   "brick": "control.since",
   "id": "SkBj_",
   "inputs": {
      "object": {
      "_availableTypes": [
         "*"
      ],
      "_type": "object",
      "_array": false,
      "_value": {
          "servicesOwnTimestamp" : "XX:XX:XXXX"
       }
    },
    "path": {
         "_availableTypes": [
               "string"
         ],
         "_type": "string",
         "_array": false,
         "_value": "servicesOwnTimestamp"
    },
    "format": {
       "_availableTypes": [
           "string"
        ],
       "_type": "string",
      "_array": false,
      "_value": ""
   },
}
   "outputs": {
         "output": {
              "_type": "string",
              "_array": false
          }
     }
}

Output:

"output" : "XX:XX:XXXX"

Example #2

This example will show a “since” being generated based off the current time, in a given format. To do this, leave the object field and path field blank, and fill in the “format” field with one of the approved formats.

{
 "brick": "control.since",
 "id": "SkBj_",
 "inputs": {
   "object": {
     "_availableTypes": [
       "*"
     ],
     "_type": "object",
     "_array": false,
     "_value": {}
   },
   "path": {
     "_availableTypes": [
       "string"
     ],
     "_type": "string",
     "_array": false,
     "_value": ""
   },
   "format": {
     "_availableTypes": [
       "string"
     ],
     "_type": "string",
     "_array": false,
     "_value": "yyyy-MM-dd HH:mm"
   },
 },
 "outputs": {
   "output": {
     "_type": "string",
     "_array": false
   }
 }
}

Output:

"output" : "2017-02-15 8:58:00"

Spawn

Spawn a child Flow and wait for the resulting output.

Input Fields

  • Flow: The Flow that you would like to call. Set value to the name of the Flow that you woluld like to call, with proper casing and spelling. You must specify the type as “Flow”, or else it will fail to compile.

Output Fields

  • output: The result of the last step of the Flow called by this module. For example, if you call “methodName”, and “methodName” ends with an obstruct.construct module, the output of this module will be the object constructed in “methodName”.

Throw If

Throw an error if…

Input Fields

  • left-operand: The first operand in the expression.
  • message: The message that will be shown in the console, as the error message
  • operator: The operator to compare two values in an expression.
  • right-operand: The second operand in the expression.

Output Fields

  • *Empty*: There is no output for this module. Note, because this module has no output, you cannot end a method with this module.