Custom data tables are primarily used for one of two purposes:
- Building data-driven services that can easily be updated or reused without modifying code
- Storing results from services (such as survey responses, or data extracted from structured messages), and providing a way to easily filter or export data
If you're not using a Poll/Survey service, you can manually create your own data tables and data rows within the Telerivet web app, or create the data table and data rows via the Cloud Script API or REST API.
Manually Creating a Data TableIf the Data Tables tab is not already visible in your project's menu, go to the Services page (after creating an automated service) and click More > Data tables.
From the Data Tables page, click Add new table, then enter a name for your table.
Next, add each of the data fields (i.e. columns) in your table. Like custom contact fields, each data field can have one of the following types:
- Multi-Line Text
- Phone Number
- Email Address
In addition, all data tables can optionally keep track of the contact who submitted the response. The contact's contact's name, ID, and phone number are always available on every data table, and you do not need to manually add data fields to store this information.
To update the data fields at any time, open the data table and click More > Manage fields.
Manually Adding and Editing Data RowsOnce your data table is created and your data fields are defined, you can use the Telerivet web app to add and edit rows in your table.
To add a new row, click Add New Row. To edit an existing row, simply click a column within that row.
Creating and Updating Data Tables via Cloud Script APIIn many cases, the most convenient way to create data tables is simply to use the Cloud Script API method project.getOrCreateDataTable(name), which will create an empty table with a given name. Whenever you store a data row via table.createRow(options), or update an existing row via row.save(), Telerivet will automatically create a data field for any of the custom variables in the row (for example, row.vars.precinct_id).
Using this method, data fields will be created with a particular type depending on the first row added with that field:
- Number if the variable is numeric
- Yes/No if the variable is boolean
- Multi-Line text if the variable is a string with multiple lines
- Text, otherwise
See example code »
Viewing, Filtering and Exporting DataTo view the data in any data table, click the Data Tables tab, then click the table you wish to view.
The checkboxes at left make it easy to filter rows by certain conditions, in the same way you filter contacts on your Contacts page.
To save your data or perform additional analysis, Telerivet makes it easy to export your results to spreadsheet programs like Microsoft Excel. To export your data to CSV, click More > Export data, then open it in a spreadsheet program on your computer.
The "Stats" tab for each data table makes it easy to visualize the most common values for a field in your data table as a pie chart, bar chart, or table: