Capturing Data (Write)
This document presumes you have successfully connected to a data source and have a Query that can insert/update/delete data. You should also have gone through the basics of using widgets.
The following widgets can be used to capture user inputs in an application
Widgets store their user input in an internal property that can be referenced using javascript.

Example SQL

1
INSERT INTO users ("name", "createdAt", "gender")
2
VALUES ({{nameInput.text}}, {{moment().format("YYYY-MM-DD")}},
3
{{genderDropdown.selectedOptionValue}});
Copied!
Example Post Body
1
{
2
"name": {{nameInput.text}},
3
"createdDate": {{moment().format('YYYY-MM-DD')}},
4
"gender": {{genderDropdown.selectedOptionValue}}
5
}
Copied!
In the examples above, text is the internal property of the nameInput widget while selectedOptionValue is the internal property of the genderDropdown widget. The createdDate key is populated with the value of the current date using the moment.js library

Triggering Updates

Since write operations are more expensive, the Query should be triggered once all the user data is captured. To do this, we can make use of a Button widget and configure the Query to run in the onClick of the button.
The property pane has an action section where all the interactions that a user can perform with a widget are listed. We can configure the action to be taken when the interaction takes place in this section.
To configure the Query we want to call when a button is clicked, we can select the action in the onClick dropdown.
Last modified 30d ago