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
I want to delete data in the infotable by checking from the _time field. If there are any duplicate time periods, check from the day, month, year. Then delete rows that have a value of 0 from the infotable. What methods can be used to do this?
Solved! Go to Solution.
Loop over the existing Infotable and create a new one containing only the required rows.
roughly like this (probably some syntax errors in it, but you'll get the idea):
let dateArray=[];
let oldTableArray=oldTable.rows.toArray();
// first pass: add non zero values, store dates in array
oldTableArray.filter(row=>row.value!=0).forEach(row=>{
newTable.AddRow(row);
dateArray.push(row._time.substring(0, 10));
});
// second pass: add zeroes if date not already contained in array built in first pass
oldTableArray.filter(row=>row.value==0 && !dateArray.includes(row._time.substring(0,10))).forEach(row=>{
newTable.AddRow(row);
});
Hi @TW_10599876
Can you check the below article and let us know it will work in your case or not.
Now, I have succeeded by using the method of looping through the infotable to check the data.
Loop over the existing Infotable and create a new one containing only the required rows.
roughly like this (probably some syntax errors in it, but you'll get the idea):
let dateArray=[];
let oldTableArray=oldTable.rows.toArray();
// first pass: add non zero values, store dates in array
oldTableArray.filter(row=>row.value!=0).forEach(row=>{
newTable.AddRow(row);
dateArray.push(row._time.substring(0, 10));
});
// second pass: add zeroes if date not already contained in array built in first pass
oldTableArray.filter(row=>row.value==0 && !dateArray.includes(row._time.substring(0,10))).forEach(row=>{
newTable.AddRow(row);
});