Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello,
I want to add information from Mashup and I want to have an ID incremental from Mashup that is start from 1.
I try to find something but anything use some service. I have some services already and I don't want to do this incremental from service, I want to do it from Mashup.
Thank you.
Hello @Bikash_Panda ,
I don't know what to tell you, I have try already but it create this type of input: 9beb3c03-0af8-4642-82fa-1114dda72e10
I want to create only number and start from 1, it is simple to identify by users and by me.
Thank you for the answer
In that case, you may take a look at,
https://github.com/carlescm/ThingWorxConcurrencyExtension
This will help you generate unique number, but each time it will increment the value. So if you increment the value and dont insert to datatable, then your values will not be consecutives though.
I am not able to download any Extension, the Policy of the company, so I need to use the Thingworx standard version.
Then store the number in a property, persist it, increment it each time and insert to DataTable
In this case is same like service, and is not helpful at all. That I don't want to do it. Because I have a lot of Things and services connected to Mashup and if exist something by default. I can use service, because I have already created.
Not sure what you're trying to do and why it is a problem to call a service. Mashups are executed on the client machine, so there is no way to create a unique ID client side when you have multiple people access the mashup. How should the different clients know what the others are doing?
Services are executed server-side and they can coordinate this. You have to call a service anyway to update the information you added, so why not letting this service take care of it?
I have expected to have already by default in Mashup.
I don't want to use the service because in Mashup, even if are more than 1 user already when the button is pressed ( for add new row ) can have a trigger that bring last ID number and add next one. Like GUID, but I want to know the numbers because I want to make another service that delete the data from Datatable if I have more than 100000 registration.
Thank you.
Use GUIDs and add timestamps to your data. Delete data based on the timestamp, e.g. "everything older than 1 month". Also, it looks like Streams would be a good storage mechanism for that -- they are keyed and timestamped by default.
It would help if you explain the use case you are trying to implement.
/ Constantine
Hi Tenegabi.
I'm guessing the data will go in a DataTable entity? If that's the case I'm not sure what the best way would be, What I would do is on the Add service's Thing, I would put a property (like LastCreatedId) of type number and persistent, add every time the service adds a record I would look at that value and add 1. But I'm not sure it would be robust against odd scenarios, like concurrency.
If the data is stored in a database, there's a much easier way to do it. You can give the Identity setting to a column, this will do it automatically for you. Here's how you can set it with the wizard in MSSQL :