I have an IF statement that looks to see if a row of data in a data table has a match for a specific column. When using a test Excel file as the source data the process works exactly as expected. However, when I switch to the production Excel file the IF statement does not find any matches.
High level of the process:
I set the varCurrentMonthName variable at the beginning to equal the current month at the time the robot is running
I pull in the source data (from an Excel file) and output it to a data table, dtFileReviews
I then use a For Each to cycle through each row of data and perform certain actions (in the Flowchart) when a row has a month in the Close Month column that matches varCurrentMonthName
The test file and the production file have the exact same structure, yet when the bot attempts the process with the prod file it finds no matches. I have gone through the debug process and confirmed that the data is being pulled in the same with both and the columns, etc are all the same. I am completely stumped as to why it will not work with the production source file. Is there something with the properties of the prod file that I should be checking?
I have a separate bot that uses this same source file that points to a different month column (to setup the items that this new bot is now trying to close), and that setup bot works perfectly.
Here is the portion of the sequence that contains the IF:
Could you check whether any unwanted space is there in the rows in production. Better you can compare both files and check whether the length of values are dame or not. Also check whether the data is case sensitive.
I thought this too, which was why I initially checked for spaces. At the end of the entire process I have the bot save the data table to an Excel file that contains all rows and columns, plus a results column of what it did with any matches. Even this file shows no other spaces or extra characters in the Current Month column for any row, not just those that match the current month. I will try ushu’s idea of using Trim and see what happens.
Thanks @ptrobot, that was it! My test file had the May rows at the top, but my production file they are sorted in true month order. This makes sense. I had the Break activity in there because my flowchart had been looping through the last matching row over and over again and that was the solution I found to get it to stop. I believe when I first put it together the flowchart was outside the IF but still part of the For Each, but has since been moved in. I re-ran the process and it is no longer looping through the last matching row with the break removed, and the file is cycling through all rows of data regardless of sort order.