This post is all about managing tables:
- When to use tables
- Import data from a CSV file into a table
- Exporting and deleting all rows
- Show/Hide columns
- Change column order with drag and drop
- Resizing columns
- Sorting by a column
- Filtering by column value
- Default column value
- Copy table
Tables should be used as a fast cache/transitory place for storing small amounts of data. We shared when to use tables in Workflows Tip #17. It’s worth to review it again before learning how to manage a table.
When to use tables
Event though tables can store up to 100k rows, tables should be used as a fast cache/transitory place for storing small amounts of data. Tables are not ideal for storing a lot of data, or sensitive data. It’s not really a database (there is no record locking, for example). And, you should consider clearing the table once its data was persisted or no longer needed.
Some recommended use cases for tables:
- Store data for different flow runs
- A flow saves data into a table to be read when it runs again
- Store data for different flows
- A flow saves data into a table to be read by a different flow
- Look-up tables
- Information such as country and country code (see image above)
- Basic reporting
- Keep track of successful and failed flow runs
- How many times “something” happened
- Save any report data into a table to be later exported into Google Sheets and clear the table
- Static data or data that changes infrequently
- Keep data such as emails, phone numbers, IDs and so on that a flow would need to look up as it runs
While it is recommend using tables for relatively short-term storage, there are use cases where data can stored outside of transactional storage between flows. For example, log a user event like created, then check the table to see if 90 days has past.
Import data from a CSV file into a table
This tip is from Mick Johnson, Workflows Builder Advocate at Okta.
You can import data from a CSV file into a table. Before importing create columns that correspond to columns in the CSV file. Click Import to choose a CSV file. On the import dialog you can map CSV columns to table columns.
You can also hide a column by clicking the column’s gear icon.
Exporting and deleting all rows
If you need to get a CSV file from an existing table, click the Export link.
And, if you need to delete the entire table (yes, everything), click Delete All Rows.
If a table has many columns or you want to hide the system columns, click on Columns where you can choose which columns to show/hide.
Change column order with drag and drop
You can change columns order with drag and drop.
You can resize columns by dragging the column’s side border.
Sorting by a column
Click a column to sort a table by that column.
Filtering by column value
Use filtering to show only data you need. Click Filter and enter a condition.
Table view will be updated based on the filter.
Default column value
When creating a new column, you can set its default value. Every time a new row is created, the column will be set to its default value automatically.
When a building a flow that leverages a table you might want to create another version of the table for testing. Go back to table list, click duplicate icon to create a copy of a table.
And, you can toggle between list view and care view.
Published on Java Code Geeks with permission by Max Katz , partner at our JCG program. See the original article here: Workflows Tips #20: How to Manage Tables for Fast Short-Term Storage
Opinions expressed by Java Code Geeks contributors are their own.