cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How create sequence from Data Tables?

SOLVED
Highlighted
Visitor

How create sequence from Data Tables?

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How create sequence from Data Tables?

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; //TAGS

var 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

View solution in original post

2 REPLIES 2

Re: How create sequence from Data Tables?

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; //TAGS

var 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

View solution in original post

Re: How create sequence from Data Tables?

Thank you

I  well used the Simple code