- 18 Oct 2024
-
DarkLight
-
PDF
makeData
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
makeData Task Purpose
The makeData task is used to convert an input string into a different data type. The converted data types that are allowed include boolean, json, number, and string.
Potential Use Case
The makeData task is typically used in conjunction with another task that comes before it, as a way to convert incoming data into a format (type) that can be used in a following task. The makeData task can also be used independently, with the variables
input used when a String is being converted. Using a variable is good for appending data that is coming from a previous task. In some of the examples below you will see how you can get the same result by using a variable or not using a variable.
Properties
Input and output parameters are shown below.
Incoming | Type | Description |
---|---|---|
input |
String | Required. The input to be converted into a data type. Variables are wrapped with <!!> . |
outputType |
Enum | Required. The type of output. Allowed values are: boolean, json, number, string. |
variables |
Object | Optional. A key value object used in string interpolation; defined when the <!!> variable syntax is used within the input parameter. |
Outgoing | Type | Description |
---|---|---|
output |
Boolean Json Number String |
The converted data that is returned. |
Example 1
In this example data will be converted to a string.
-
The
input
Reference variable is the string Who are you <!var1!>. -
The
outputType
will be a string. -
The
variables
object for the wrapped variable<!var1!>
is defined as "I'm Batman". -
The
output
that returns will be a string that combines the <!var1!>, which is "Who are you", with the variable "I'm Batman".
Example 2
In this example data will be converted to a json.
-
The
input
string is {"name"."<!var1!>","last":"Wayne"}. -
The
outputType
will be a json. -
The
variables
object is {"var1".Bruce"} -
Alternatively you can use {"name":"Bruce","last":"Wayne"} as the
input
string with no definedvariables
object. -
The
output
for both variable use and non-variable use is the same and shown as a json of name/value pairs {"name":"Bruce","last":"Wayne"}.
Example 3
In this example data will be converted to a number.
-
The
input
variable is defined as <!var!>, and theoutputType
will convert the data to a number. -
The
variables
object is {"var1"."42"}, with the number 42 in the key-value. -
Alternatively, the non-variable
input
can use the number 42 outright. -
The
output
for both (variable and non-variable) will convert the incoming data to a number that will be shown as 42.
Example 4
In this example we will change the data to a boolean.
-
The
input
variable is defined as <!boolean!>. -
The
outputType
will be a boolean. -
The
variables
object used to showcase the result for this task is {"boolean":true}. -
The
output
that returns from running this task will be True.