Table functions
When working with data in Ply, it’s important to understand the difference between items and tables.
An item is a single object, like a task.
A table is a collection of objects of the same kind, like a task list.
A contact is an item, and a contact list is a table. A row is an item, and a spreadsheet is a table. You get the picture.
An easy way to understand the difference is by looking at an actual table:
Tasks
Task number
Task due date
Assignee
Instructions
1
January 1st, 2022
John Smith
Take out the trash!
2
December 15th, 2021
Jane Doe
Buy milk!
3
May 22nd, 2018
Mary Lamb
Mow the lawn!
Each row in this table corresponds to an item because each row shows data on a single task.
The entire table is a table of tasks.
Properties and column headers
Let’s say we’re looking at one item from this table.
Task number: 1
Task due date: January 1st, 2022
Assignee: John Smith
Instructions: Take out the trash!
“Task number”, “Task due date”, “Assignee”, and “Instructions” are properties, labelling the different pieces of information on the task.
When looking at items in a table, it makes sense to refer to properties as column headers because pieces of information with the same property are in a column.
Special cases
A table can contain multiple items, one item, or no items.
Let's say we have a feature that searches for all the tasks that were created today and shows them in an interface. Some days, it will find a table with multiple tasks, like the one above. On days where just 1 task was created, it will find a table with just 1 task. On days where no task was created, it will find an empty table.
You can use branches if you want your feature to work differently depending on how many items a table has.
Working with items and tables
You can use the following helpers to manipulate tables of data:
Add a column to a table Adds a column to a table.
Add an item to a table Adds an item to a table.
Compare tables Filters a table based on a table of values – useful for finding the overlap between two tables, their difference, and other relations.
Count items Gets the number of items in a table.
Filter items Finds items in a table that match a specified filtering condition.
Get an item from a table Gets an item from a table.
Join tables Joins two tables based on matching or non-matching values in specified columns.
Remove columns from a table Removes specified columns from a table.
Sort items Sorts items in a table by their values in a specified column (ascending or descending order).
You can also use formulas to get data from items inside a table. For example, if you insert a column header into a field for item data, you can Extract the first item from the table and use its value in the selected column.
We are always adding new helpers; let us know if you need a new helper to build your features.
Last updated