Skip to main content
8-Gravel
Jul 15, 2024 10:05 AM UTC
Solved

[infotable] Can I merge record by a column

can I merge recode that same timestamp

AL_10742319_0-1721037770954.png

 

 

 

 


this is code to table

let params = {
infoTableName: undefined /* STRING {"defaultValue":"InfoTable"} */
};
 
// result: INFOTABLE
let table = Resources["InfoTableFunctions"].CreateInfoTable(params);
newField = {
    name: 'value1',
    baseType: 'NUMBER'
};
table.AddField(newField);
newField = {
    name: 'value2',
    baseType: 'NUMBER'
};
table.AddField(newField);
newField = {
    name: 'timestamp',
    baseType: 'DATETIME'
};
table.AddField(newField);
// result: INFOTABLE
table2 = Resources["InfoTableFunctions"].CreateInfoTable(params);
newField = {
    name: 'value1',
    baseType: 'NUMBER'
};
table2.AddField(newField);
newField = {
    name: 'value2',
    baseType: 'NUMBER'
};
table2.AddField(newField);
newField = {
    name: 'timestamp',
    baseType: 'DATETIME'
};
table2.AddField(newField);
 
 
table.AddRow({value1:10,timestamp:1700000010000});
table.AddRow({value1:12,timestamp:1700000020000});
table.AddRow({value1:14,timestamp:1700000040000});
table2.AddRow({value2:100,timestamp:1700000010000});
table2.AddRow({value2:120,timestamp:1700000020000});
table2.AddRow({value2:140,timestamp:1700000040000});
 
 
params = {
t1: table /* INFOTABLE */,
t2: table2 /* INFOTABLE */
};
//
// result: INFOTABLE
Union = Resources["InfoTableFunctions"].Union(params);
result=Union;
14-Alexandrite
Jul 15, 2024 10:49 AM UTC

You can do that using intersect. You can even use multiple columns and different sort of joins as in SQL.

3 replies

14-Alexandrite
Jul 15, 2024 10:49 AM UTC

You can do that using intersect. You can even use multiple columns and different sort of joins as in SQL.

Translate
8-Gravel
Jul 19, 2024 2:02 AM UTC

thank you for suggestion
now I create database thing and connect to thingworx db
then I create SQL Statement to query and join record in valuestream table

AL_10742319_1-1721354497783.png

 

 

Translate
Community Moderator
Jul 18, 2024 12:20 PM UTC

Hello @AL_10742319,

 

It looks like you have a response on your topic. If it helped to answer your question please mark the reply as the Accepted Solution. 

Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.

Thanks,
Vivek N.
Community Moderation Team.

Translate