Get index of element from collection

Hi all, how i can get the index of element from a colletion of elements?

I’ve a workflow that ask for input. That input is a order number from my company. The order number is a 4 numbers (example: 1070).
In a folder in my pc called “PDF”, there is all the pdfs generated from orders. The pdfs names are like “Ordine nr. 1070.pdf”.
I’ve get all files from pdf folder, clean the name to get only the last number (order number) and check if input match. If input match it get all files from excel file that have the same name as pdf (Ordine nr. 736.xlsx) and copy all files from a column of excel and past in a draft email.

All work fine, but last is to attach at the draft email the original pdf file choose from input. My idea is to get all files from pdf folder in a collection (A) and a trimmed name of the files in another colletion (B) with same index order and at the end of the workflow, get the index of input dialog in a collection A and get the same index number of the collection B.

But the result value is -1.

Can someone help me? Thank you

auto (165.4 KB)

Helo @Danny_Gi - I didn’t get this part…

When the user input the 1070…it matches with only one pdf right?? After that you mentioned “Ive to get all the files from the pdf folder and clean the name” I didn’t get this part…can you explain? so that we can assist…

To match the input from user, my idea is to get all files in a pdf folder and for each file trim the name to get only the last 4 character (order number).

@Danny_Gi - when user keys in 736…then you want to fetch this Ordine nr. 736.pdf right??


@Danny_Gi - Please have a look…


@prasath17 sorry but i don’t understand…
Can you explain me please? Or attach an example to open in uipath studio? Really thank you

omg you’re right! Simple i can add the words to the input number!
You’re a genius!

@Danny_Gi - GetPDF.xaml (4.7 KB)

Note: please do not try that path.getfilename as posted above, it won’t work that’s why I deleted

Update: Path.GetFileName(String.join(vbcr,StrArrGetFiles)) → to get the filename alone…

You have to handle the error condition also here…what if the user enter the order # which is not in the folder…say 800

1 Like

@prasath17 why the solutio button is not under the post? I’cant mark as solved!

@loginerror @Pablito – could you please look into it? @Danny_Gi - can’t see the “Solution” button…

1 Like

really thank you

@Danny_Gi - please have a look…just to make sure…

No man, i’havent the button…


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.