I have a read range activity read a column with a list of numbers and possible “#N/A”. Next I have a for each row that will cycle through each data row from the read range activity. Inside the for each loop, I want the loop to break if the current row is “#N/A” what expression do I use in the if statement condition?
Use this expression in if Statement: row(“ColumnName”).Tostring.equals("#N/A")
Hi @lakshman ,
I did the read range without a header, what should I put in “ColumnName”?
Then use column Index instead of ColumnName.
Please use index of column. For example
row(0) - refers first column value
Hi, it doesn’t seem to work. Current workflow looks like this:
Excel looks like this:
Based on this, UiPath should be displaying the message “good” 3 times before it breaks. Is there something I did wrong?
As per your input, during the first 3 iterations, the condition must fails and ‘Else’ block will execute. On the third iteration, the condition satisfies and control exists the loop. If your execution doesn’t work like this, please use the condition as
row(0).Tostring = "#N/A" and try again.
UiPath is still displaying the message past the 3rd iteration.
Could you please share the error message or output panel screenshot?
This is the 4th iteration where row should be #NA
Can you try the below condition in your If Condition
Let me know whether this condition grabs the value properly…
Just give a try with this condition once, row(0).ToString.Trim.Equals("#N/A")
Although, row(0).ToString.Contains("#N/A") should work as well…
Can you share your excel so I can check it out here?
Please try by removing ‘#’ from your string in excel and condition.
@nimin , Ok the process works now. However, what do I do to detect “#N/A”? The actual excel file I am running contains #N/A that I need to check for and cannot change it.
Hi, in the datatable, it actually captures the #N/A as a numeric value which is :"-2146826246"
That is because, when getting data into a datatable, it converts all the data of that column to a specific type. In your case, its numeric because first rows contain numeric values.
So try out this condition… it will work
@Lahiru.Fernando, Thanks it works now.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.