How to Optimize the Code in UiPath for following


#1

I have a excel file and it contains the 30 columns and many rows…My task is to find the value starts with DOC, SIN, SAP, RAT, SM for the 9 columns in excel file…what I did is very long code which I need to optimize??

What I did??

I first check for 1st column weather it is Starting with DOC, SIN, SAP, RAT and if it is starting with this, then I need to extract 6 digit for the DOC and SIN, for others 9 digits after the header(DOC,SIN,SAP,RAT)

So here I used if activity for all the Columns and it is very large flow what I did, If we did this same thing in C# we can do it in very few line of code…

I did not explore that much in UiPath…Can anybody find the way to optimize the code??

Thanks in advance…


#2

can you try this

  1. Filter the data to for DOC & SIN
    for loop
    {
    process the data
    }

  2. Filter the data for non DOC & SIN
    for loop
    {
    process the data
    }


more generic code

arr[] = “DOC, SIN, SAP, RAT…”

for each pattern in arr
{
Filter the data for the pattern
for all rows in excel
{
switch (pattern)
process the data
}
}