Switch Statement plus Looping Issue

Good morning,

I’m fairly new to UiPath Studio but have been using it for work within the Air Force for a couple of weeks now and I have run into a slight issue. I’m going to try my best to break it down as much as possible and with as much detail as possible as well because the process I’m automated is a very time consuming and difficult process to say the least.

Basically I have a workbook with a lot of different sheets in it. The sheets each hold a different chart. I have a separate workbook that my RPA OCR’s through and captures the data that I need and stores it in a data table. The datable is ReadExcelData. What you see in the pictures below is the RPA looping through the ReadExcelData rows. Below that we are assigning a column letter (it’s the actual letter is being set inside of Main.xaml outside of this invoke statement) for it to start on. What the RPA needs to do is determine which chart to paste the data on depending on the data that is in the actual Datatable itself. Then once it’s posted it’s data for it’s current row it will then increment the column and read through it’s data again and determine which chart it should post on again and where it should posted. The thing is it needs someway to keep track of which column it has posted on and which column it needs to post on.

Below in the pictures you will see two switch statements…the first switch statement is determining the gate (that’s a technical term for what stage an aircraft is in it’s maintenance process). Once it sees it’s gate and picks the correct case it will then jump into another switch statement and determine which chart to post it on by looking at it’s TotalProjectDays. Once it has found that correct cash it will see the correct sheet it should post on along with some other data that it needs to post. Those variables will be set and then the data will be written to the excel chart outside of the case statements. As you can see I’m setting the in_ACIColumn = increment first thing. The purposefully set it one behind the actual column that it needs to write to. It then sets the variable column to that letter that has been incremented and it should write the data. It does starting off but once it keeps going it gets off track. Look for instance at the other pictures. Gate 3 and Gate 4 are the exact same case statements except the sheet that it posts two are totally different. They both need to start on Column E but if it first goes to Gate 3 and then hits case 175 and posts on column E…it then would go to gate 4 and need to post on a different chart but still start on Column E but since it’s been already set to Column E and it increments 1 each time it’s now set to column F and it writes the data to column F.

Last thing, there could be multiple aircraft that could post to the same gate and the same case number (and chart name) so that is the reason behind trying to keep track of what column it could be on.

If you could provide me any insight into how I could fix this issue that would be greatly appreciated. Also if you need anymore information or screenshots I can gladly provide them.