Hi
I have a files in folder with names like XYZ Pty Ltd-Account Transactions, Mapping- XYZ Pty Ltd. I just need the XYZ Pty Ltd. can anyone help me with the string operation to be performed.
Thanks
Ankita
Try to use split functionality with - as a delimiter
Could you please give me the full format i am new to UIPATH.
I am using row.item(“FileName”).ToString.split(“-”)(0).Trim but it is not working properly
If
row(“FileName”) = “XYZ Pty Ltd-Account Transactions”
Then
str_output = Split(row(“FileName”).ToString.”-“)(0).ToString
Cheers @Ankita_Biswas_SDC_Ko
Try like this row.item(“FileName”).toString.split(“_”.Tochraterarray)(0)
I think the file name may have the XYZ as a prefix or suffix, is my understanding correct?
XYZ Pty Ltd is the company name that i need to extract
It is not working it is extracting the entire filename.
strFileName = “XYZ Pty Ltd-Account Transactions”
Then try to use regex.match(strFileName,“XYZ Pty Ltd”).value try like this if your file name contains this then it will return that value.
It is one string . I am not sure if i am clear or not. There are many company files in a single folder. For each company there are three corresponding files. I just need the company names.
eg:
- XYZ pty ltd-account transactions, XYZ pty ltd-general Ledger, mapping- XYZ pty Ltd
- ABC pty ltd-account transactions, abc pty ltd-general Ledger, mapping- abc pty Ltd
I just need the names of the companies
Thanks
Can you share your excel file with data sample
Sorry due to company policy i cannot share it. Is the problem not clear yet?
There are many company files in a single folder. For each company there are three corresponding files. I just need the company names.
eg:
- XYZ pty ltd-account transactions, XYZ pty ltd-general Ledger, mapping- XYZ pty Ltd
- ABC pty ltd-account transactions, abc pty ltd-general Ledger, mapping- abc pty Ltd
I just need the names of the companies
May I know what was the output that you were getting for this expression
Kindly place this str_output variable in a WRITE LINE activity so that we can see the output in the output panel, pls share that screenshot
Cheers @Ankita_Biswas_SDC_Ko
Getting validation error in this one
Ok
Then You can use split operations say
str_output = row(“FileName”).ToString.split("-"c)(0).ToString
Then Check
If str_output.contains(“LTD”) OR str_output.contains(“ltd”) or str_output.contains(“Ltd”)
then nothing else
str_output = row(“FileName”).ToString.split("-"c)(1).ToString
It will work if your data has LTD all the time
Is all companies name contains LTD?
Check this one, it will return all the company names in a string array.
Directory.EnumerateFiles("C:\Documents").[Select](Function(x) Path.GetFileName(x).Split("-"c)(0)).ToArray()
Aah i got it
It’s a typo mistake buddy
str_output = Split(row(“FileName”).ToString,”-“)(0).ToString
This would work for sure
Cheers @Ankita_Biswas_SDC_Ko
It is not working for the file name starting with “Mapping”. working for the other files