Use tables in apps

Prev Next

Here's how to read and write to Tables from frontline operations apps.

In this guide, you will learn...

  • How to read existing Table Records in an app
  • How to update existing table records in an app
  • How to create new table records in an app
  • How to analyze data in tables based on app Completions

In the App Editor, you can read, edit and create individual table records. Since Tables do not require any code, you can run your apps in the Player and watch the Tables update in real time.

This guide will cover the various ways that you can use tables and apps together to create more powerful apps.

There are three steps to reading or updating any Table Record:

1- Create a "Record Placeholder" to give a name to that particular Table Record within the app

2- Load (or create) the record in a Trigger Action

3a- If you would like to update individual fields in the record, include the Table Record in a "Then" statement.

3b- If you would like to write logic around values in the Table Record, then include the Table Record in an "If" statement

App Variables vs. Table Records

When building apps, you may need to decide whether a specific piece of data should be stored in a Variable or in a Table Record.

Variables are better suited for data that is relevant to individual usage of that particular app. Tables are better suited for data that needs to be accessed by multiple apps.

Tables are frequently used to track concepts like:

  • Work orders
  • Individual product SKUs
  • Bill of Materials (BOM)
  • Skills matrix
  • ...and much more

Before reading this article, you should first read "An Overview of Tables to get a full understanding of the capabilities of Tables.

Step 1- Creating Record Placeholder

First, you will need to create a “Record Placeholder” in the app where you will be accessing the Table Record. These are placeholders for records that will later be dynamically loaded in Trigger logic.

For example, if you wanted to edit a record from a “Work Orders” table in an app, you might have a Record Placeholder called “Active Work Order”.

You would later load a Record dynamically based on operator input, but it would always be referenced as the "Active Work Order"

To set up these placeholders, click the Records Tab next to the Steps List.

Then choose “Add a Table”. Next, click add a "Record Placeholder". You will be able to give a name to the record that you will load dynamically from a Trigger (ie "Active Work Order").

Note there is a setting "Save for Analysis". When selected, this will save the Table Record loaded into this Record Placeholder into the app's Completion Record.

Step 2- Accessing Records in the Trigger Editor

After creating the Record Placeholder, you can now write the logic to dynamically load or create records based on operator input.

You can use the "Table Records" and "Data Manipulation" Trigger actions to accomplish this. Here's how to do it.

Add a "Then" Statement

You can read or modify table records with multiple types of Trigger Actions. Here is a quick summary.

Table Records/ Load Record: Load an existing record with a specific ID

Table Records/ Create Record: Create a new record with a specific ID

Table Records/ Create or Load Record: IF a record with a specific ID does not exist, create it. Otherwise, load the record with a specific ID.

Loading Existing Records

In order to read or edit a Record, you must first load the record into an app and give it a placeholder name. This is frequently triggered by a step opening or a button press.

You can load one Record at a time, and you must use the unique ID (first field of the Table, text value) to choose the record.

Use the “Table Records” “Load Record” statement to accomplish this.

How To Modify Tables Within the App Editor_112436109.png

  • "Table Records"
  • “Load Record”
  • By ID: “text” - 0146
  • Into the “active_wo” placeholder

In this example, a record with ID "0146" already exists in a work orders Table.

Since the “ID” field in each table is a text field, you must use text to access individual records. You can use all the typical options to choose an ID:

  • Table Record
  • Expression
  • Static Value
  • App Info
  • Variable

Here's an example where a variable is used:

How To Modify Tables Within the App Editor_136240424.png

  • "Table Records"
  • "Load Record"
  • by ID: "Variable"
  • "text_wo_id"
  • into: "Active Work Order"

Creating New Records

If you want to create a new Record in a Table, you must use the “Create” or "Create or Load" option.

If you use "Create", you must create a new record with an ID that does not already exist in the table. If the record already exists in the table, the app will throw an error.

If you use "Create or Load", a record with a specific ID will be loaded if it already exists, or created if the ID does not exist in the table.

In this case, we use the id “123” to create a new record.

Image

  • "Table Records" "Create Record"
  • by ID: "Static Value" "text" "123"
  • into: "Active Work Order"

Usually, you must use a dynamic value in this field, like a variable, since every time an operator uses the app, you will want to create a new value.

Step 3a- Editing Records in the Trigger Editor

To edit a record, you will use the “Data Manipulation” action, then “Store” to edit or update the value in a record.

In order to edit a record, you must already have it loaded as a record placeholder via "Table Records" "Load" or "Table Records" "Create".

Here’s an example where you will update the “status” field of a record loaded as “active_wo”.

How To Modify Tables Within the App Editor_112437653.png

  • “Data Manipulation”
  • “Store”
  • “Text”: "Passed"
  • "Table Record" “active_wo”
  • Field: “status”

You would commonly use a Widget Trigger to do this, for example, when an operator presses a button to indicate a change.

You can also increment a value from a table record. See this guide to inventory tables to learn how

Step 3b- Using Conditional Logic with Table Records

You may also want to change app logic based on the value in a field of a specific record.

To do this, make sure a record has already been loaded. Then, select a field from the record and use the same logic that you would use in any other “if” statement.

Table Record: Check for a specific value in the field of a loaded table record.

How To Modify Tables Within the App Editor_112438525.png

  • “Table Record” “active_wo” “status”
  • “Contains”
  • "Static Value" "text" "Passed"

Table: Check if a record with a specific ID already exists in a Table.

How To Modify Tables Within the App Editor_122052009.png

  • "Table" "workorders" "has record with id" "Static Value" "text" "001"

Here's how you might create an error message the prompts the operator to input a different work order number.

How To Modify Tables Within the App Editor_122058202.png

IF

  • "Table" "workorders" "has record with id"
  • "Static Value" "text" "024dfg45"

THEN

  • "Show Error" "Static Value" "text" "This work order already exists, please enter a new one".

Step 4- Displaying Table Records On Steps

To add this Record to a step, choose the “Table Record” option under the “Text” button in the Widget Menu.

In the Widget Tab of the Side Pane, choose your Record Placeholder from the options next to “Record” to see it in the Player.

This is commonly used to display work order details to an operator, for example.

To reorder/remove individual fields from the display, click the x or the grid symbol on the property in the Side Pane.

To change the number of columns, use the Columns option in the side pane.

To change the display of the labels and values, adjust the color and font size in the side pane.

To see how this data will be shown the operator, run the app in the Player, and you will be able to see the whole Table Record. Values will be included if you first load a record.

Clearing Record Placeholders

Sometimes, you may want to clear a record placeholder so that there is no specific record loaded into the app under that Record Placeholder.

Here's how to do that:

Image

  • "Table Records" "Clear Record Placeholder"

Deleting Record Placeholders

To delete a Record Placeholder, select the placeholder from the Records List on the left side of the screen. In the example below, you would choose "Active Work Order".

Then, choose "Delete" from the following menu.

Image

Please note:

You must first remove the record placeholder from all triggers where it is referenced. You can use the "Steps where used" list to find the steps with the triggers that need to be modified.

Displaying Users and their Fields

You can also create a Record Placeholder for users and their associated fields and then load a specific user with the Embedded Table. For more details, see the separate guide on User Fields.

Further Reading


Did you find what you were looking for?

You can also head to community.tulip.co to post your question or see if others have faced a similar question!