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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How can i merge two infotable and output as one infotable?

mberber
11-Garnet

How can i merge two infotable and output as one infotable?

​Hello everyone;

In my test project i have a database and the database have two tables. I am fetching data using SQL Query and output as an InfoTable. I want to merge this InfoTable's side by side or top to the bottom . Tables may or may not have same columns. I have been trying to make this work around in few days. The document about "Getting To Know InfoTables" helps at some level but now i am stuck.

This is my structure.

Database

tableone

tabletwo

Thing

Testing

    Services

    getTableOne (SELECT id, name, phone FROM tableone) and TableOneDS (as DataShape)

    getTableTwo (SELECT id, name, phone FROM tabletwo) and TableTwoDS (as DataShape)

    MergeInfoTable (JavaScript) and MergeInfoTableDS(as DataShape which contein all fields the DS's above)

So far i used CreateDatabaseFromDataShape snippets and CreateValue() but i havent figure it out how can i fetch this two infotables datas and put inside a loop and result will placed row by row.

Any suggestion will help.

Thank you !


2 REPLIES 2
supandey
19-Tanzanite
(To:mberber)

Murat, you can use the output in Infotable function called Union. Beware it'll require both infotables to be of similar dataShapes

var params = {

  t1: undefined /* INFOTABLE */,

  t2: undefined /* INFOTABLE */

};

// result: INFOTABLE

var result = Resources["InfoTableFunctions"].Union(params);

You must use Join snipped instead of Union ( Union it's equal to concatenate )

Top Tags