Hi Team,
Please help me on this .
a | b | c |
---|---|---|
2 | 5 | 7 |
6 | 5 | 4 |
5 | 6 | 7 |
4 | 2 | 1 |
Hi Team,
Please help me on this .
a | b | c |
---|---|---|
2 | 5 | 7 |
6 | 5 | 4 |
5 | 6 | 7 |
4 | 2 | 1 |
The robot will check for every row if value a is < value b.
@yannip’s solution is a good idea, but just wanted to make a correction that you will need to convert each string to a number before you can compare them with < or >
ie CInt(row("a").ToString.Trim) < CInt(row("b").ToString.Trim)
Here is a snippet, which also shows how to check if the value is a number before it tries to convert it, so no errors arise in the future:
Alternatively, you can also take a more efficient approach to avoid cluttered code and provide quicker processing time by filtering the datatable to an array of rows using query:
dt1.AsEnumerable.Where(Function(r) If(IsNumeric(r("a").ToString.Trim) And IsNumeric(r("b").ToString.Trim), CInt(r("a").ToString.Trim) < CInt(r("b").ToString.Trim), False ) ).ToArray
Regards
Indeed he needs to make it int, i forgot to add that.
I’m sure your alternative will work as well, but I would not have come up with that as i’m still a rookie :-)!
thank you very much…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.