Data Variables
Introduction
Erizos Studio UI Builder supports external databases that help with organizing and structuring data. It allows users to add, edit, and manage different database sources. Six types of source are supported: Spreadsheet File, Google Sheets, Google Firebase, MySQL, MS SQL and HTTP.
Three things work together:
- a Data Source holds the connection: which server, which credentials, which file.
- a Data Feed is a named query against a source - the rows you want.
- a Data Variable is what the UI actually uses: it takes its rows from a feed, from a source directly, or from a script, and it can be bound to the components on your canvas.
To open them, click the Database icon in the editor's left panel. That tab holds the Data Variables list of the UI you have open, with two icons:
| Icon | Description |
|---|---|
| Create variable | |
| Open Modal - opens the Data Variables dialog |
Click Open Modal (or double-click a variable) to open the Data Variables dialog. Everything else on this page happens inside that dialog. Its left-hand tree has three sections:
| Section | Icons |
|---|---|
| Data Sources | Create source |
| Data Feeds | Create folder, Create Feed |
| Data Variables | Create variable |
The dialog footer has Show Details / Hide Details (which collapses that tree), Cancel and Save. Save stays disabled until there is something unsaved and everything you have entered validates; if validation fails, a warning icon next to the button explains "Validation failed. Please fix the highlighted issues".
In the updated interface, the process begins with creating a Data Variable first.
In the opened Data Variables modal, you can:
- Create a new variable or choose an existing one.
- Then, assign a Data Feed to the variable.
-
If a suitable data feed does not exist, you will be prompted to create one.
During this creation process, if a Data Source is also missing, you can create it directly from the same interface as shown in the
.gifbelow.
Info
You do not always need to define a source first. Three built-in Instant sources - HTTP, Spreadsheet and Google Sheets - are always offered in the source list, marked Instant. Pick one of those and give the variable a URL or a file, and no Data Source of your own is needed.
Adding a MS SQL Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to MS SQL.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 4 5 6 7 8 9 10 | |
Adding a MySQL Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to MySQL.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 4 5 6 7 | |
Adding a Google Sheet Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to Google Sheets.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 4 | |
apiKey - if the Google Sheets documents are not shared with Anyone with a link, provide the api key of a user they are shared with.
spreadsheet - optional; it can also be set on the Data Feed or the Data Variable instead.
Error
If you encounter the error Invalid Google Sheet Format when selecting Google Sheet as a Data Feed source, it usually means the file is not in the proper Google Sheets format.
To fix this:
- Open the Google Sheets link.
- Go to File → Save as Google Sheets.
After saving, you can add it successfully as a Data Feed.
Note
If no apiKey is provided, make sure the Google Sheet share setting of the Sheet you want to use is set to "Anyone with the Link".
Adding a Spreadsheet File Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to Spreadsheet File.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 | |
file - optional; it can also be set on the Data Feed or the Data Variable instead. Make sure that the Erizos Studio Server can reach the path you give.
Adding a Google Firebase Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to Google Firebase.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 4 5 6 7 8 9 | |
Adding an HTTP Source
- Open the Data tab in the editor's left panel.
- Click Open Modal to open the Data Variables dialog.
- Under Data Sources, click Create source .
- Set the Type to HTTP.
- Name your Source.
- Add the Object Configuration for your Source, then click Save in the dialog footer.
1 2 3 4 5 6 7 8 | |
method - one of GET, POST, PUT, DELETE.
headers - an object of request headers.
response.type - json or xml.
response.path - the path to the table data inside the response, e.g. path.to.array.
The URL itself is not part of the source: it is set on the Data Feed or the Data Variable that uses the source.
Set these values on the Feed or Variable, not on the Source
For an HTTP source, this Object Configuration is not currently used. The request is built from the configuration on the Data Feed or Data Variable that uses the source, so a method or headers entered here is ignored and the request goes out as an unauthenticated GET.
Put the method, headers and response settings on the Feed or the Variable instead. The other source types do read their Source-level configuration.
Data Variables
Select a variable under Data Variables in the dialog to open its form.
Name and type
Every variable has a Name and a Type:
| Type | Where the rows come from |
|---|---|
| Feed | An existing Data Feed, picked from the feeds tree. This is the default. |
| Source | A Data Source directly - you choose the source and supply the query yourself. The list also offers the built-in Instant HTTP, Spreadsheet and Google Sheets sources. |
| Script | A JSON document you write in the editor that appears in place of the preview. |
Source-type variables
When the type is Source, the fields under the selector depend on what kind of source you picked:
| Source type | Fields |
|---|---|
| Google Sheets | Spreadsheet (the document id or its full URL; the arrow button opens it) and a Header Row checkbox |
| Spreadsheet File | File (browse for a .csv, .xls, .xlsx, .xlsm, .xlsb or .ods file) and a Header Row checkbox |
| HTTP | URL |
| Google Firebase | Path |
| MySQL / MS SQL | Query |
Advanced options
Feed and Source variables have an Advanced panel. Click the header to expand it.
| Field | Description |
|---|---|
| Index | Which property of the row identifies it - the key used to select a single row out of the data. |
| Sort By | Opens the Sort dialog. The button shows a summary of the sort that is configured. |
| Auto Bind | When enabled the data will auto be populated to UI components that have a Field ID that matches the data key. |
| Prefix | Only enabled when Auto Bind is on: prepended to each data key before matching it against the Field IDs. |
| Filter | Opens the Filter dialog. The button shows a summary of the filter that is configured. |
| Update Interval | A switch between Once (fetched only when the UI loads) and Live, plus an hh:mm:ss interval that is enabled when Live is on. |
Below the Advanced panel is a preview of the rows the variable will return, with the sort and filter applied.
Sorting
The Sort dialog lists the sort keys in order. Click to add a row, then choose the field and a direction - ASC (ascending) or DESC (descending). Click on a row to remove it. OK applies the sort to the variable, Cancel discards it.
Filtering
The Filter dialog works the same way: click to add a condition, then set the field, the operator and the value. Click to remove a condition. A condition is built from these parts:
- The field to test.
- Is / Is Not - or Does / Does Not when the operator is a text one - which negates the condition.
- The operator: Equal To, Greater Than, Greater Or Equal Than, Less Than, Less Or Equal Than, Start With, End With or Contains.
- The value to compare against.
OK stays disabled until every condition is complete.
Accessing Sources
To access Sources from a script, call DataService.query and provide the name of the Source, the Query, and any arguments the query needs.
DataService.query(source: string, query: string, args: Record<string, any>): Promise<any>
In the Example below, we populate a TextBox when a button is clicked. The button fetches the data from our Source. We have a source named 'MySource' as the first Parameter, the second Parameter is the Query we want to run in our database.
1 2 3 4 5 | |
A Data Feed can be read by its path instead, with DataService.feed:
DataService.feed(path: string): Promise<any>
Both functions return a Promise that resolves to the rows, and both throw if the query fails - wrap them in a try/catch if a failure should not stop your handler.



