Twidget's conversion commands allow you to easily convert different data types to the required format. Below is a list of the available conversion commands and examples of how to use them.
The Convert to Text
command converts the provided value to a text (string) format.
Examples:
123
converts to "123"
true
converts to "true"
[1, 2, 3]
converts to "[1, 2, 3]"
{"name": "John"}
converts to "{\"name\": \"John\"}"
The Convert to Number
command converts the provided value to a numerical format.
Examples:
"123"
converts to 123
true
converts to 1
false
converts to 0
"12.34"
converts to 12.34
The Convert to Boolean
command converts the provided value to a boolean (true/false) format.
Examples:
"true"
converts to true
"false"
converts to false
1
converts to true
0
converts to false
""
converts to false
"text"
converts to true
The Convert to Date
command converts the provided value to a date format.
Examples:
"2021-12-31"
converts to Fri Dec 31 2021
"12/31/2021"
converts to Fri Dec 31 2021
1633039200000
(timestamp) converts to Fri Oct 01 2021
The Convert to Object
command converts the provided value to an object format.
Examples:
'{"name": "John"}'
converts to {"name": "John"}
'["1", "2", "3"]'
converts to ["1", "2", "3"]
Any valid JSON string converts to its corresponding object
By utilizing these conversion commands, you can seamlessly transform data types to suit your specific requirements within Twidget.
Error Handling
When building applications with Twidget, you may encounter situations where you need to handle errors gracefully to ensure your application runs smoothly. Twidget provides two powerful commands for error handling: `try-catch` and `throw-error`. This documentation will guide you on how to use these c...
Managing Files
Twidget offers a set of commands to manipulate files in your file store. Below are the descriptions and usage of each command to help you understand how to utilize them effectively. Get File. Retrieve a file via file path. Inputs: - `path`: The file path to retrieve the file from. Outputs: - `filena...
Miscellaneous
Twidget provides several miscellaneous commands to facilitate various tasks. Is Null. Description: Checks whether the provided value is null or not. Inputs: - value: The value to be checked. Output: - boolean: Returns `true` if the value is null; otherwise, returns `false`. Not Null. Description: Ch...
Loops
In Twidget, loops allow you to execute commands multiple times, either based on a condition or through a set number of iterations. Loops can also be nested, meaning you can run loops within other loops, creating complex logic for your tasks. List Loop. The `List Loop` command enables you to loop thr...
Security
Twidget provides several built-in functions to enhance the security of your applications. Below is an overview of each security command, including its description, inputs, and outputs. Generate ID. Description: Generates a unique identifier. None - Type: Text Hash Text. Description: Hashes the provi...