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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

swapping between infotables in javascript

AP_9587236
17-Peridot

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?
1 ACCEPTED SOLUTION

Accepted Solutions
TonyZhang
13-Aquamarine
(To:AP_9587236)

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

View solution in original post

3 REPLIES 3
TonyZhang
13-Aquamarine
(To:AP_9587236)

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

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

TonyZhang
13-Aquamarine
(To:TonyZhang)

If you assign the result of clone directly to B like below, what's inside B will be gone and be replaced by the clone of A.

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

    t1: A /* INFOTABLE */

});

Top Tags