I met a problem when I was using select() to search Datatable

Hi guys,

I met a problem when my process was using select to search the DataTable, which never happen before today.

And I cannot clearly understand what it means and don’t know what’s the possible reason cause the error happened

It said that "Result of mapping the datarow.: Min (121) must be less than or equal to max (-1) in a Range object."

Does anyone met this issue before probably can give me some advice?

Thanks in advance!!

Hi,

What is your query for the select statement

Hi @sarathi125

Just some String variable like: “Project Code”, “Continent”, “Order Number”(it’s String),etc.
I also checked the excel that the type of the issue row of data whether different than the other row of data, but they are same.

And also I just found that when I was trying to figure out whether my condition of select are wrong so that I separate them to one by one to check the result.

The error message suddenly disappear and the process worked successfully.
However, I still need to figure out the reason why this happen to avoid the following exception in the future.

Is it possible that maybe the process run so fast result in the select couldn’t get the result due to the data is not ready yet?

Here’s my select statement:
TestDT.Select(“[Project Code]= '” + row(“Project Code”).ToString + “’ AND [Integrator]= '” + row(“Integrator”).ToString + “’ AND [Major Rack Type]='” + row(“Major Rack Type”).ToString + “‘AND [TLA Number]=’” + row(“TLA Number”).ToString + “‘AND [DC]=’” + row(“DC”).ToString + “'”).Any()

Just make a conclusion here.

Finally I solve the issue, not sure the possible reason is correct or not.

Reason: Probably because of Timeout.
I guess it might took too much time to search the data with 5 condition inside one select statement which made me confused that my data only have 800 row total.

After I separate these 5 condition to one by one, and the issue disappear.

Before:
TestDT.Select(“[Project Code]= ‘” + row(“Project Code”).ToString + “’ AND [Integrator]= ‘” + row(“Integrator”).ToString + “’ AND [Major Rack Type]=’” + row(“Major Rack Type”).ToString + “‘AND [TLA Number]=’” + row(“TLA Number”).ToString + “‘AND [DC]=’” + row(“DC”).ToString + “’”).Any()

After:
TestDT.Select(“[Project Code]= '” + row(“Project Code”).ToString + “'”).CopyToDataTable
.Select(“[Integrator]= '” + row(“Integrator”).ToString + “'”).CopyToDataTable
.Select(“[Major Rack Type]='” + row(“Major Rack Type”).ToString + “'”).CopyToDataTable
.Select(“[TLA Number]='” + row(“TLA Number”).ToString + “'”).CopyToDataTable
.Select(“[DC]='” + row(“DC”).ToString + “'”).Any()

Just for reference probably someday someone will also has this problem.