No duplicate entries in Tulip Table record

Hello,
Is there a way to create a condition to not create duplicate record and instead update the record? Let’s say we have a button trigger that creates a record; if I were to click it again, I want to update the record if the entry is already in the record.
Thanks.

Hey @gleeTICO,

A few ways to do this.

  1. You can check to see if a record exists with any ID:
  2. You can use the “Create or Load record” action that will automatically load a record if it exists, and create if if it doesnt.

Does one of these two do what you need?
Pete

So basically I created an ID with a randomstring(). With that being said, is there a way to check if the record has the same step name in the record and then therefore update the record with that specific step?
I got my app to create the record and update ONLY IF you are on the page. The moment you click out and click back, it creates a new ID and a new record instead of updating the record.

Hey!

This makes it a little tricker, but not impossible. So the way I am going to do this is 2 fold:

  1. Filter my table to just the records with your matching station
  2. Get the count of records that match station name
  3. Get the ID of the records with a matching station name, if they exist.

Here is how I would do this in Tulip.

  1. Add a query to your table, in this case I am filtering the department field, but you can filter on the station name

  2. Create an aggregation that will calculate how many records match this criteria (if it is more than zero we want to load a record, not create one)

  3. Create an aggregation that will return the record ids with a matching department


    Now on the app side

  4. Add your query to your table record

  5. Add your two aggregations to that query


  6. Now in your trigger we will check to see if the aggregation is more than 0 (if a record exists for this department, if it does we will pull the first item out of that list of ids, and load that record, if not we will create a new record.


Does this make some sense? There is working going on right now to make this process less painful.
Pete

Hey @Pete_Hartnett,
Thank you so much for your input. I will try this out. If it doesn’t work, I’ll try my best to find another way around this soluton.

Thanks.

@Pete_Hartnett,
Thanks for your solution. I had another question though. If you go to the main menu in test mode, does it reset the table? Your method works if I go to previous steps and next steps, but as soon as I hit the main menu and go back to the steps, it creates new records.