Trigger logic to populate column in Tulip Table

I embedded an interactive table into my app. I left one field blank because I have written trigger logic that is supposed to populate it.

My trigger logic is that if one record in a field is < another, then store a 0 in the empty field. The else is ≥, which would store a 1 in the empty field. App started is the trigger.

When the app starts, nothing happens. No 1 or 0 fills into the specified field.

Hey Cody,

Could you share a screenshot of your interactive table to get a better idea of what fields you are referring to?

I think what is happening is that you first need to load in the record into a placeholder so that the app knows which record you are trying to perform the trigger on.

You can do this by creating a trigger before the one you have here to load a specific record by ID, variable, etc… into the placeholder “RL Efficiency” and then this trigger will know which specific record you are trying to compare the values to.

Hi Cody,

Thanks for sharing the screenshots. I see the trigger logic you built and why it looks like it should work. What’s happening is the app does not know which specific table record to run the comparison on when the app first starts, so nothing gets written into your “Daily Score” field.

To fix this, try:

  1. Add a trigger that runs before your “Efficiency Score Value” trigger.

  2. In that trigger, use Load Table Record into the placeholder (for example “RL Efficiency”) based on record ID, variable, or filter.

  3. Once the record is loaded, your existing IF / ELSE comparison will run correctly and store either 0 or 1 in the Daily Score field.

You can confirm it’s working by testing with a known record ID. If you want it to be dynamic, you can tie the load step to the Interactive Table selection so whichever record the operator picks will then get the 0/1 evaluation.

Give that a try and let us know if the logic still does not populate as expected.

Best,
Nicolo

Below is my interactive table. My ultimate goal is to have the column “Daily Score” populate a 0 or 1 depending on the comparison of the 2 circled columns. Basically, green cells =0 and red cells =1.

Hi,

So I created this trigger logic for loading RL Efficiency. But still not seeing the desired outcome. Could you let me know what I missed?

Thanks again for your support.

The same issue is happening with the “by ID: Table Record, RL Efficiency, Product” part of the trigger.

Apps communicate to Tables through Table Placeholders, in your case “RL Efficiency” is a placeholder within the app that tells Tulip which record to go look at within your Table that is storing the product information.

When the apps starts initially, the placeholder is empty so the app doesn’t know where to go look within the table. In your trigger above you are telling the app to load a record from the table into the placeholder with a blank reference ID.

Try changing “by ID: Table Record, RL Efficiency, Product” to “by ID: Static Value, Fireplace” and let me know if you get the correct outcome for the “Fireplace record”

Hi Cody,

Thanks for the update. It looks like ThadBlack is right about the issue. From what I can see in your trigger, the problem is with this part:

“by ID: Table Record, RL Efficiency, Product”

This is causing a circular reference. The app is trying to load a record into the RL Efficiency placeholder using the Product field from the same placeholder. But since the placeholder is empty at the start, there’s no Product value to reference.

To fix this, try changing it to:
“by ID: Static Value, Fireplace”

This should test the logic with a specific record and should populate the Daily Score column with 0 or 1 for the “Fireplace” row.

If you want a dynamic solution for all records, here are a few options you can try:

  • Loop through all records using a “For Each Table Record” trigger.

  • Use an Interactive Table trigger to load a specific record when a user selects a row.

  • Use a record ID stored in a variable if you have that setup.

Start with the static “Fireplace” value to confirm that the logic works, then let me know how it goes. We can help you set up the dynamic solution after that!

Best,
Nicolo

The suggestion you used for Fireplace worked!

I’m really interested in the option below. Please tell me more about it.

“Loop through all records using a “For Each Table Record” trigger.”

Thanks for your help!

Hi Cody,

The “For Each Table Record” trigger lets the app run the same logic for every record in your table. To set this up, create a trigger that runs on a button press or when the app starts. Add a For Each Table Record step and select your RL Efficiency table. Inside the loop, use Load Table Record to load the current record into your placeholder, then run your IF/ELSE comparison. For example, if Actual is greater than or equal to Target, store 0 in Daily Score; otherwise, store 1. Finish the loop with a Save Table Record step so the update writes back to the table. When you run the trigger, it will loop through each record, apply the comparison, and fill in all the Daily Score values automatically.

Hi,

I’m lost on the “Add a For Each Table Record step.” Do I need to add an actual step to my app for this?

I’m very, very new to this whole world of app building. What would be the easiest to learn method for loading my table records into the interactive table, so that I can assign desired logic?

I’ve seen multiple solution ideas such as the looper widget, creating using a loop step, arrays, etc. I’ve looked at the knowledge base and watched a couple of videos. I understand bits and pieces, but still don’t feel like I get it. I’m a very visual, start-to-finish type learner. So the simplest solution is best. I’m at the point where I’m considering signing up for office hours.

Hey Cody,

You are right there are a ton of different ways you can do this. I will tell you one way I have accomplished this in the past. It is “Easy” but it’s not necessarily the best or most efficient method.

For your example specifically you are probably going to have to create several different triggers that are copies of the two you have above within the “App Start” section. One to load the record and one to perform the logic. Copy this pair of triggers for each record you have in your Table. For example, if there are 10 records in your table, you will need 20 triggers (1 of each type per record).

Once this is done, go to each trigger that loads the record by ID and change the ID to each ID within your table (Ex: Marvin, Fireplace, SCC Door Line, Contract Doors, etc…)

It should look something like this:

Once you do that, when the app opens, it should cycle through each table record and update your efficiency number.

If the app is going to be running all the time and you want it to update periodically. Copy all those triggers you just created over to the “Step, Timer” section and give it a frequency to execute the same trigger set.

Let me know if this helps!