Using Table Aggregations to auto-increment ID

We have an internal Office Hours meeting more or less for anyone that is building an application. The objective is to share ideas and also to collaborate and align on approaches to problems so that we can develop best practices of building in Tulip as a team. Here’s something I learned in our last session:

The problem
I wanted the system to work so that every time I made a new quality event, it made a new entry in the table with a human readable ID that read something like QE-1, QE-2, QE-3…

The solution
You can use Tulip Table Queries and Table Aggregations in order to auto-increment ID numbers.

Here’s how it works:
1/ Make a Table Query for all the records you want to count. In my case it is a Query for all entries where ID contains ‘QE’
2/ Make an aggregation. In my case the aggregation is COUNT()
3/ Add the query and aggregation to your app
4/ Add trigger logic that loads the Tulip Aggregation into a variable and creates a table records that increments the table aggregation by 1

5 Likes

I keep getting an error saying “Type integer is not valid in this context” when using LINK(), even though my aggregation (using mode) returns an integer. What am I doing wrong?

Hey @Daman -

Can you shoot me a link to your app in a DM? We can check it out and see what might be going wrong.

Pete

Hi Pete, I don’t see an option to send you a DM anywhere on your profile, how do I send you one?

Hey @Daman -

Just shot you a DM, you should be able to reply to see it under the head menu in the top right corner

Pete

@Daman Here is a step-by-step video showing how to accomplish this (using a slightly different method). Hopefully this helps!

1 Like

And thats how you should do it.
The Counting solution mentioned before has the pitfall, that it is limited to 1000 records!