Skip to main content
17-Peridot
August 18, 2021
Solved

swapping between infotables in javascript

  • August 18, 2021
  • 1 reply
  • 1130 views
I have rows in infotable A. i have to store infotable B=A. Then i have to delete all rows in infotable A.
This have to do in a loop. How to do this?
Best answer by TonyZhang

Hi @AP_9587236,

 

You can use below code to clone the data of infotable A and pass it to B, then clearing infotable A:

 
let B = Resources["InfoTableFunctions"].Clone({

    t1: A /* INFOTABLE */

});

 

A.RemoveAllRows();

 

If you want to preserve the data in B and append the data A into B you can use Union service:


B = Resources["InfoTableFunctions"].Union({
    t1: B /* INFOTABLE */,
    t2: A /* INFOTABLE */
});


A.RemoveAllRows();

1 reply

TonyZhangCommunity ManagerAnswer
Support
August 19, 2021

Hi @AP_9587236,

 

You can use below code to clone the data of infotable A and pass it to B, then clearing infotable A:

 
let B = Resources["InfoTableFunctions"].Clone({

    t1: A /* INFOTABLE */

});

 

A.RemoveAllRows();

 

If you want to preserve the data in B and append the data A into B you can use Union service:


B = Resources["InfoTableFunctions"].Union({
    t1: B /* INFOTABLE */,
    t2: A /* INFOTABLE */
});


A.RemoveAllRows();

17-Peridot
August 19, 2021

While cloning, What if the B is already having rows and I want to overwrite those entries with new values of A?