Hi,
We are communicating with ERP over REST API’s.
ERP will write the Workorders to the Tulip tables, using REST API.
Challenge I face is, I don’t get unique number in the Primary ID column. Hence, I want to initialize the Primary ID’s with serial numbers (1,2,3,4,5 and so on). With a trigger function I want initialize 100 to 200 rows.
Is there a way, we can achieve this?
In one of the KB articles, I found autoincrement method. I tried, but it gets incremented with 1 row with each click. In my case I want to autoincrement by 100 rows
If you want to write 100 datasets into the table, you need to loop. You can not write 100 records at once.
Looping can be achieved with:
- A custom widget (e.g. the looper widget)
- automations
- node red
- a jumper step in the app
- …
keep in mind, that the amount of cycles is limited and the performance is also different on all these approaches
Hi,
Thanks for the information.
Is there a way to autoincrement the Primary ID of the table? Instead of custom widget or loop based approach
So you want to create new records right?
As mentioned:
You need to create them one by one.
What is your issue with that?
Yes, I want create the new records.
Under “Automations”, “Node Red” not able to create the custom widget.
I want to increment the Primary ID number automatically.
For Example: If a value is added in the 1st row of the table.
It should automatically initialize the 2nd row of the table, and Primary ID of the 2nd should be updated with value 2.
Sorry I don’t get the Point.
Do you want to initialize 100 Rows or just the next one?
And why?
Why dont you just create a row with the next ID when actually adding data? What is the point of having empty Rows with just the ID?
I guess first you need to find out what the actual target is and then choose the right tool for it.
Most of the times it is a simple trigger solution in app (or when inserting data from other sources with the table api).
So the first question is: How do you add data to the table, where does it come from and how gets it triggered?
I want a next Row and the Primary column updated with Unique number.
Reason: In my case, ERP will write the data to the Tulip Table. When a Workorder is released, ERP will write the values to the Tulip table.
One issue, I am facing here is, ERP is not able to send the unique numbers.
Hence I want initialize the Primary ID column with a unique number.
But how does the ERP know which unique number to pick (from the initialized)?
Honestly I don’t know the answer…
When an ERP will write the data to Tulip tables, does the Primary ID will be automatically generated? Or do we need to generate it?
@Shrinivas.Kandakur Tulip will never autogenerate IDs. You must always pass in an ID when writing records over the API. It follows an upsert pattern, so if you re-use an ID, this will result in an update.