In this article, you will learn...
- How to display multiple table records based on a variable
- How to select a record from the list and load it into an app
- How to turn connector output into an interactive list
- How to fire trigger logic when an operator selects a row in an interactive list
Note: In order to use this tutorial, you must understand how to create a Table. Check out this separate guide if you have not done that before.
Do you need to display any of these common shop floor assets to your operators and technicians?
- A list of work order assignments by workstation
- Machines that need to be inspected
- Tools and their locations in your facility
- Issues logged at a station and their progress to resolution
- Material lists
If so, you will need to use the Embedded Table widget in the App Builder.
The Embedded Table widget can be fed by the following data sources:
- Multiple rows of SQL output
- Array of objects from an HTTP connector
- Tulip Table Records
- User Fields
After setting up the data source, you can then show filtered lists to operators and allow them to click any row in the table. You can even fire trigger logic after they choose a record.
This guide will show you how to create interactive tables for each use data source above.
If you want to see an example in context, check out this guide to process visibility of work orders by station.
Adding the Embedded Table Widget
First, create a Record Placeholder on the left side of the screen. This will allow you to load one record from the list into the app.
Then, add the widget to a step by selecting "Embed" from the Widget Bar and then choosing "Tulip Table".
Then, link it to a Tulip Table via the "Data Source" dropdown:
After that, you can link the Embedded Table to a record placeholder and begin adding filters in the Context Pane. Here is what that looks like:
To add columns, select them from the dropdown list to add them one at a time.
You can change the layout of the table by dragging each column in the App Builder or Player to change the width of columns.
Here's how to create interactive lists from connector output.
First, set up a connector that sends an array to your Tulip app. Learn how to configure the connection between connectors and apps here.
Then, add the Embedded Table to a step as shown above.
Then, select "Variable" as the data source and choose the variable that stores the output array from a connector function.
Finally, choose a variable of type "Object" to store the output or create one within the "Linked Variable" dialog.
Then, select a column for each property within the object that you would like to display.
Firing Trigger Logic and Designing a Step
After you have set up your Embedded Table, there are two ways to use it:
- Immediately fire a trigger action when an operator presses a row
- Update a variable or record placeholder and do not fire any trigger.
This section will show you how to set up both of those situations in your app.
Firing Trigger Logic
To add a trigger that fires when a row is pressed or clicked in the Player, click the "+" button next to the Trigger label in the Context Pane. You will see the Trigger Editor open with the "When" clause set to "when a row is selected".
Designing A Step
Here's an overview of a popular way to use the Embedded Table in the Player:
The Embedded Table is being used alongside two other widgets:
- The text widget to instruct the operator to click or press a record.
- The Table Record widget to show which record has been selected.
In order to select a record, the operator must press a record, but you will probably want to give them some feedback that they have successfully selected the correct record.
To do this, add the "Table Record" text widget to the step.
Then, link it to the same placeholder as the Embedded Table in the Context Pane:
Test it out in the Player, and the record placeholder should update in real-time.
Changing the Display Of the Embedded Table
By default, the row size is optimized for being clicked on a laptop or desktop. However, you may want to make each row bigger so that it can be easily pressed on a tablet or mobile device.
In order to do this, change the "Font Size" in the Context Pane. This will automatically increase the height of the row to accomodate the font size.
Buttons For Each Row
To remove the button next to each row, toggle the "Select Button" option to show or hide the buttons.
Regardless of whether, you toggle the "Select Button" on or off, rows can be selected by pressing or clicking any part of the row.
Rows Per Page
Determine how many rows should be available at a time in the table
Setting Up Filters and Sorting on the Widget
This section only applies to Embedded Tables that are connected to Tulip Tables and User Fields.
You will probably want to filter the list of records that are shown to the operator. You might want to filter it based on:
- The station that is running the app
- The operator using the app
- A value in a variable in the app
- Something else!
Click the "Edit" icon next to the Filters option to set up a filter.
Then, you can set up two types of filters:
- Static values, like a number or text value
- Variables, including app info
First, choose the field from the table where you would like to set up a filter. Then, choose a condition. Within the "Variable" option, you will see both app metadata like user and station as well as variables related to the app.
After you have selected a filter, click the "X" in the top right of the modal.
You can set up sorting for the Embedded Table with the "Sort By" option.