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
Why this code is not removing all the rows in infotable? If i have 100 rows, it is removing only 50 rows.
code:
for(var a=0;a<updaterows.rows.length;a++){
var newEntry1 = updaterows;
newEntry1.RemoveRow(a);
updaterows=newEntry1;
}
Anyone knows the code to remove/delete all the rows in infotable?
Solved! Go to Solution.
Hi @AP_9587236 ,
No need iterate through for loop. You can simply use RemoveAllRows() of the Info table. I am using it at multiple location in my code and it works like charm.
var tmpInfoTable = <get your info table>;
tmpInfoTable.RemoveAllRows();
Hope it helps you.
- Shirish
Because when you remove row[0], the old row[1] will be new row[0], and your variable a=1 actually removed the old row[2] ?
You may check if all the even number rows got deleted and single level rows retained.
Your code is ok but you need to do the operations backwards.
maxIndex = updaterows.rows.length -1;
for(var a=maxIndex;a>=0;a--){
updaterows.RemoveRow(a);
}
By going through the list backwards you avoid the shifting rows.
When you use the updaterows.rows.length in the for loop each time through the loop its value is recalculated.
Hope that helps
Peter
Hi @AP_9587236 ,
No need iterate through for loop. You can simply use RemoveAllRows() of the Info table. I am using it at multiple location in my code and it works like charm.
var tmpInfoTable = <get your info table>;
tmpInfoTable.RemoveAllRows();
Hope it helps you.
- Shirish
ShirishMorkhade is correct. If the goal is to remove all the table entries <infotable>.RemoveAllRows(); will accomplish it in one move.
If we are missing the question you are trying to ask please provide more detail.
Thanks
Peter