I starting to study thingworx
I want create increase sequence to number in Thingworx Data Tables
I made Data Tables after made Data Shapes and Fields
I made Field of Five in the Fields so want to input sequence values into the Num Field
How create sequence from Data Tables?
I want simple source code if made from services or let me know if you have other way
Solved! Go to Solution.
Hi SANG HYUN LEE,
Just share with you what I did to create sequence ID for data table.
1. create a new Property named "ID" with NUMBER basetype under my Data Table
2. In the Service where I add a new DataTable Entry
var values = me.CreateValues();
values.sourceType = undefined; //STRING
values.location = undefined; //LOCATION
values.source = undefined; //STRING
values.key = me.ID; //STRING [Primary Key]
values.timestamp = undefined; //DATETIME
values.tags = undefined; //TAGSvar params = {
sourceType: undefined /* STRING */,
values: values /* INFOTABLE*/,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
};
me.ID=values.key+1;
// result: STRING
var result = me.AddDataTableEntry(params);
Hope this helps,
Br,
Anna
Hi SANG HYUN LEE,
Just share with you what I did to create sequence ID for data table.
1. create a new Property named "ID" with NUMBER basetype under my Data Table
2. In the Service where I add a new DataTable Entry
var values = me.CreateValues();
values.sourceType = undefined; //STRING
values.location = undefined; //LOCATION
values.source = undefined; //STRING
values.key = me.ID; //STRING [Primary Key]
values.timestamp = undefined; //DATETIME
values.tags = undefined; //TAGSvar params = {
sourceType: undefined /* STRING */,
values: values /* INFOTABLE*/,
location: undefined /* LOCATION */,
source: undefined /* STRING */,
tags: undefined /* TAGS */
};
me.ID=values.key+1;
// result: STRING
var result = me.AddDataTableEntry(params);
Hope this helps,
Br,
Anna
Thank you
I well used the Simple code