Display only certain rows or columns of your table with slices.
When you show the contents of a table in your app, you do not need to show every row, every column, and every action. Instead, you can slice the data, choosing a subset of the columns, actions, and rows.
What is a slice?
A slice is a subset of the rows, columns, and actions of a table. A slice definition has five components:
- The table it's based on (required)
- Does the slice permit adds, deletes, and updates? (required)
- The subset of rows it retains from the table (optional)
- The subset of columns it retains from the table (optional)
- The subset of actions it retains from the table (optional)
It's important to note that a slice does not need to subset rows, columns, and actions. In fact, it's common to subset just the rows or just the columns or actions as appropriate.
Slices are most useful when you want to create a UX view of part of a table. For instance, if you have a table that's a list of people, you might have columns for their first name, last name, birthday, address, and phone number. However, if you only want to see their first name and phone number in a view, you can create a slice that filters out all the columns in the person table except for first name and phone number.
Another use for slices is to define a logical subset of a table that can then be used in other expressions (such as a Valid_If column constraint or in an automation workflow). For this usage scenario, slices usually use row filters but do not subset the columns or actions.
Remember, once you define the slice, you still need to use this slice in a UX view.
Watch a video
For more info, check out this demo on slices:
If you'd like to learn more about slices and filtering your data in depth, watch this webinar:
Create a slice
To create a slice:
- Open the app in the editor.
- Go to the Data > Slices pane.
- Click + New Slice.
- Configure the slice.
- To preview the rows and columns of data your slice contains, select the View Data button.
- Create a UX view for each slice.
- Save your app.
Repeat these steps to add multiple slices.
Configure the slice by using the settings described in the following table.
|Slice Name||Unique name for the slice.|
|Source Table||Table to use the source.|
|Row filter condition||Expression that determines whether a row should be included in the slice. For details, see Slice row filter conditions.|
|Slice Columns||Columns to include in the slice. Select All Columns or Custom to select each column individually. For details, see Slice columns.|
|Slice Actions||Actions to be included in the slice. Select an action from the drop-down. Click Add to add additional actions. For details, see Slice actions.|
|Update mode||Slice permissions. To enable changes, select one or more of the following: Updates, Adds, and Deletes. To provide read-only access, click Read-only.|
|Descriptive comment||Description of the slice.|
The following provides an example of a completed slice in the National Parks app that uses an expression.