Replace a value in row if larger

I have a prefilled table with two columns: 1. Name 2. Score (e.g. Thomas, 1500; Sarah, 2100)
Now the robot gets a name with a new value. If the value is larger it should be replaced in the table.
e.g. (Thomas, 2000) → then it should replace 1500 with 2000.
How do I efficiently select the row, check the value and then replace if necessary.

Thank you.

DataRow row = table.Select("Name='Thomas'")(0)

and update it

If (row Is not Null) And row["Value"] < 2000
row["Value"] = 2000;

With Variables:
strName = Thomas
strValue = 2000

DataRow row = table.Select("Name=" + "'" + strName + "'")(0)

and update it

If (row Is not Null) And row["Value"] < strValue
row["Value"] = strValue;
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.