I cannot get my robot to terminate workflow when it gets to an empty cell. I did not use a for each row activity. Right now, it has 12 rows and it will read an account number from one column (B) and put it into a system. it will take a product code and the loan number from the system and put it back on the same spreadsheet it got the account number from. The number will vary daily, so we do not know how many will be on the spreadsheet. I just need the robot to stop once it gets to an empty row or cell, because that means it has reached the end of the account numbers. It is moving to each row fine, and writing to the correct cell fine. I just cannot get it to stop. Any suggestions? Thanks
Your logic does not look right. You need to check a value in the row, because it sounds like you want to stop after processing a number of rows.
To check the value, it will depend on how you are processing each line.
Like if you are using a DataRow type, then it will look like this: condition: row("columnname").ToString.Trim <> ""
or condition: row(colindex).ToString.Trim <> ""
or for entire row values, String.Join("",row("columnname").ItemArray).Trim <> ""
if you use a row number, then it will be the same thing but use .Rows() condition: dt1.Rows(index)("columnname").ToString.Trim <> ""
or condition: dt1.Rows(index)(colindex).ToString.Trim <> ""
or for entire row values, String.Join("",dt1.Rows(index)("columnname").ItemArray).Trim <> ""
Hopefully, that helps. If it doesn’t, provide some more details so I can understand it better.
would this help even if I do not know the number of rows it would need to stop after? The number would vary. I was thinking if the cell was empty, whether it had processed 3 or 30 values, when it got to the empty cell, it would stop. Right now, it keeps going and for the empty cells, it inputs list of zeros, and I have to stop it manually.
Normally, you would have a data set stored in a DataTable, then you run that through a For Each or check that the rowNumber is < the count of the rows (ie dt1.Rows.Count). This way, it will always end at the last row regardless of what the values are.
However, if you are wanting to take the approach where you don’t have the data set stored in a datatable, like if you use Read Cell activity for example, then if you check if the value is “”, it should stop as intended.
I recommend that you use DataTables and ForEaches, though, because it prevents times when you are updating the wrong data row.
The answer to your question is yes, because if you check the value in the row if it is <> “”, then it will become false when it does = “”, and thus Terminate.
I hope this helps. Let me know if you need some clarity or further assistance on your logic.