Skip to main content
Aug 18, 2021 5:18 AM UTC
Solved

swapping between infotables in javascript

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?
TonyZhangAnswer
Aug 19, 2021 2:11 AM UTC

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();

3 replies

TonyZhangAnswer
Aug 19, 2021 2:11 AM UTC

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();

Aug 19, 2021 7:23 AM UTC

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