Problem with File path in Read Text File

I had several files in a folder (e.g. ABC_012345_XYZ.xml; ABD_234567_DDD.xml; ABE_543210_ZZZ.xml). A variable (strInput) is the defined number (e.g. 012345; 234567; 543210) where I can type in from Input Dialog activity.

I would like to use Read text file activity to load content of a specific file. So, in the Filename, I put: “"+strInput+"”+".xml"

However, it seems UiPath does not get the file.

image

Anyone can help with the above issue? Thanks

@trung2403 Are you using the filename in this way :
“ABC_”+strInput+"_XYZ"+".xml"

1 Like

@trung2403

It should be like this:

                                    "*"+strInput+"*"
1 Like

Is your variable strinput hold value as below ?

strinput = “ABC_012345”

FileName
strInput+"_ZZZ"+".xml"

1 Like

Hi lakshman,

I tried your approach as below, but it still does not work. Dont know how to fix it. :frowning:

image

Hi karthick,

my variable strInput hold value of a number (e.g. 012345). In file name, I tried: “" + strInput + ".xml” but still not work.

@trung2403

You can’t pass it to here directly.

  1. Use Assign activity and try below expression.

                String requiredFile = Directory.GetFiles("FolderPath", "*"+strInput+"*")(0)
    
  2. And then use Read Text File activity and pass requiredFile to it.

6 Likes

If StrInput = ABC_0123456_ZZZ

StrInput+".Xml"

1 Like

Many thanks lakshman, it works now. I do appreciate your kind support. :smiley:

2 Likes

@trung2403

Glad to help you. Happy Automation :slight_smile:

Please close this thread by marking above my post as solution.

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