Skip to main content
1-Visitor
July 19, 2018
Solved

Delete Infotable row based on selected row values

  • July 19, 2018
  • 3 replies
  • 8172 views

var size = me.Intruders.getRowCount();
var i=0;
for (i=0;i<size;i++)
{
if (me.Intruders.rows.Age == Intruders.Age){
DeleteItem(i);
break;
}

}
function DeleteItem(i)
{ if(i!=0){
me.Intruders.RemoveRow(i);
}
}

 

This is not working , can someone help?

Intruders.Age is a selected row infotable (input parameter) and I am looking to delete a row from Intruders infotable with the Age from selected row.

Best answer by Aleksandar

var size = me.Intruders.getRowCount();
var i;
for (i=0;i<size;i++)
{
if (me.Intruders.rows[i].Age == Intruders.Age){
result = "nice";
var myTempTable = me.Intruders;
myTempTable.RemoveRow(i);
me.Intruders = myTempTable;
break;
}

}

 

Thank you for the help, here is the working code if someone needs it.

It deletes the date based on row parameter.

3 replies

22-Sapphire I
July 19, 2018

When you say this is not working, are you getting errors?

Is the infotable persisted or not?

you are doing a direct in memory operation which would mean that is the infotable is persisted, it will retain the original content after a thing restart or system restart.

 

1-Visitor
July 20, 2018

There are no errors, Yes the infotable is presisted.

The Service does not delete a row because the infotable is persisted ?

After the executions, the specific row is still there. It doesn't delete it.

22-Sapphire I
July 20, 2018

To make a persistent delete in an InfoTable property you have to completely re-write the property

so 

myTempTable = me.Intruders

myTempTable.RemoveRow(i)

me.Intruders = myTempTable

1-Visitor
July 20, 2018

Try accessing the value of the property directly. Use +me.Intruders.rows.Age in your if condition statement.

Like : if (+me.Intruders.rows.Age == Intruders.Age). 

Aleksandar1-VisitorAuthorAnswer
1-Visitor
August 15, 2018

var size = me.Intruders.getRowCount();
var i;
for (i=0;i<size;i++)
{
if (me.Intruders.rows[i].Age == Intruders.Age){
result = "nice";
var myTempTable = me.Intruders;
myTempTable.RemoveRow(i);
me.Intruders = myTempTable;
break;
}

}

 

Thank you for the help, here is the working code if someone needs it.

It deletes the date based on row parameter.