User Guide

Custom Data Tables

Last Updated: Aug 11, 2017 03:07PM PDT
Telerivet supports creating custom data tables, which you can use within automated services built with the Cloud Script API, in "run JavaScript code" actions within the Rules Engine, and via the REST API. Essentially, you can use custom data tables as a simple database without needing to run your own servers or install your own database software.



Custom data tables are primarily used for one of two purposes:
 
  1. Building data-driven services that can easily be updated or reused without modifying code
  2. Storing results from services (such as survey responses, or data extracted from structured messages), and providing a way to easily filter or export data
When using a Poll/Survey service, Telerivet will automatically create a custom data table to store the responses for each poll (see Viewing and Filtering Poll Responses).

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 Table

If 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:
  • Text
  • Multi-Line Text
  • Phone Number
  • Email Address
  • Date
  • Date/Time
  • Number
  • Yes/No


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 Rows

Once 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 API

In 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
This method of creating data tables "on demand" within your service is especially convenient for situations where you might reuse a Cloud Script API service within multiple projects, or make it available for other Telerivet users to use in their own projects.

See example code »

Viewing, Filtering and Exporting Data

To 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:



Contact Us

http://assets1.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete