Hi. I am trying to increment the table ID number which is a text field via an app. I managed to get this to work when the app is running. My current trigger looks following:
I am looking for a way to load the last table entry to the variable in the app as a string → convert the string to integer → increment the integer → convert it back to string → and store it into the same table on the next ID field.
My current triggers work when I start with an empty table and it works until I restart the app.
as @mcc6025 correctly pointed out, you could use a Connector to the Table API. here’s a quick guide:
create a Connector Function to the Table. for reference, here’s the endpoint I used: /records?limit=1&sortBy=_sequenceNumber&sortDir=desc. as you can see it will always output the largest ID in the Table:
I added an extra field to the table to save the incremented integer to the first record when done adding a new record. Then added a “load record” trigger to pull the last ID saved to the table when the first step is opened and save it to the integer. That way you can restart the app as many times as needed and it will still pull the last saved ID from the table. I haven’t had the time to add the table API and test but I know the above way works just fine. I’m kind of late to the party here but let me know if I can help out!
I think this topic is great to continue working on and I want to summarize here for future reference what is possible now with Queries and Aggregations (without connectors)
For example if someone wants an id such as : Text-{year 2 digits}-{sequential number per year}, I will share a way to do so :
Prepare your table and add a year field for easy queries :
You have everything for your id (if you want to start from 1 and not 0 you will need one more data manipulation to increment the value from table aggregation) :
you are right. but I still thanks to pte for his sharing.
in my opinion, hope tulip provides the cursor operation, such as movetolast, then we can load the last record, and get the ID of last record, generate the unique new ID by expression.
Knowing that i have to apply some filters before extracting the ID, I want to know what i have to add to “/api/v3/tables/iM8DsQk8ZAAD68BJM/records?limit=1&sortBy=mrvac_dateplanifie&sortDir=asc” to be able to use as many filters as i want.
thank you,
but in brief, you can add: filters.x.field, filters.x.arg, filters.x.functionType on as many filters as you’d like. I would recommend adding them as Query Parameters in the function as such:
Hi @gio,
Hope you are doing Well. In fact i tried to get the ID of this record and use it on the app and i had done it but the issue is that the ID i had recover had the form [“1235”] for example :
Is there a solution to convert the first ID and use it instead of the second because i had recently encountred some problems using nested objects?
thank you,