Skip to main content
8-Gravel
July 15, 2024
Solved

[infotable] Can I merge record by a column

  • July 15, 2024
  • 2 replies
  • 1134 views

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;
Best answer by Bikash_Panda

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

2 replies

14-Alexandrite
July 15, 2024

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

8-Gravel
July 19, 2024

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

 

 

Community Moderator
July 18, 2024

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.