Need to get the value from Text file after the particular Keyword

text
activities

#1

Hi All,

I have a Text file in the below format. I need to retrieve the USD which is below the Keyword Currency.

I used the method strText.Split({“Currency”},System.StringSplitOptions.RemoveEmptyEntries)(1).Split(System.Environment.Newline(0))(0).Trim am getting only blank information.

Can anyone help me on this.

Currency
USD
USD
USD


#2

Hi @Elamparithi

If you want to get multiple results for each USD, use this in a For Each loop:
inputString.Split({“Currency”},System.StringSplitOptions.RemoveEmptyEntries)(0).Split({System.Environment.Newline},StringSplitOptions.RemoveEmptyEntries)
image Output: image

To access single elements, add an array index at the end:
inputString.Split({“Currency”},System.StringSplitOptions.RemoveEmptyEntries)(0).Split({System.Environment.Newline},StringSplitOptions.RemoveEmptyEntries)(0)


#3

Thanks for the response,

I tried as you said, but am getting different output instead of USD. Am getting the first line of the Text file.


#4

See attachment for reference project:
SplitExample.zip (1.6 KB)

It is probably the structure of your text file. I attached my example so that you can compare the inputs :slight_smile:


#5

I cant able to open your workflow, am getting

Could not find member ‘CurrentIndex’ in type ‘http://schemas.uipath.com/workflow/activities:ForEach(String)’…

Below is the information which i was working in the text file, can you check you can get the result.

?age. I •Dated: 30-07-2618 P//C50 / 36/6 44 fQ-
•O
SCHEDULE FOR OUTWARD: DOCUY. COLLECTION
Please: always.- quote
Mail to
EM
777 No : 90040BCS000601-
collection, We . enclose the following for
Drss Currency
USD
USD
USD
REFERENCE .
For Banda
Autatory
Of
•O


#6

@MirceaGrigore

I am guessing that this would be an example of a workflow from beta that is not compatible with stable release.

@Elamparithi
Could you confirm the version of the UiPath you are using?

As far as your request goes, could you specify the expected outcome? We could try a regex formula if your requirements will suit it :slight_smile:


#7

Yes, in some cases, workflows built with beta versions may not work with previous or future stable versions. Please make sure you test workflows with stable versions too, before pushing to production. We have migration checks in place but some cases might not be covered. Good news is that 18.3 will soon be pushed to stable as well.


#8

Am using Community version only, will that be an impact in this case.