cancel
Showing results for 
Search instead for 
Did you mean: 

Wildcards within Environment Variables

Hi, hoping someone can help!

I'm using EVs for the first time.

My process needs to load a queue from a file which is added to a folder daily, then the file is removed from the folder.  The file changes each day, but the file name is the same except for the date.

I have attempted to use a wildcard in the file path for the EV, example: C:\Users\XXXXX\Desktop\XXXX\*.xlsx

Where the " * " represents the date which will change each day.

But I get the following error:

"System Exception : ... does not exist or is not a file"

Am I able to use a wildcard in the EV, or is this not possible? Meaning the file could change each day but the EV wouldn't need to be updated.

I'd like to avoid updating the EV daily, or changing the file name by removing the date.

Thanks

3 REPLIES 3

MichealCharron
Level 8

@Chris W

I'm trying to unpack your question there and if I understand it, you are trying to open a file with the "Open Workbook" action in the "MS Excel VBO" VBO. You are trying to put a wildcard into the BP environment variable (which is totally allowed) but the problem is the "Open Workbook" action needs to have a explicit file name to open a workbook.

The easiest solution I can think of, working with a BP environment variable, is to put a placeholder into the text. For example a BP Environment variable named "Queue Workbook Path":

C:\Users\XXXXX\Desktop\XXXX\Queue File (~TodaysDate~).xlsx

Then, in the "File name" parameter of the "Open Workbook" action, put something like the following:

Replace([Queue Workbook Path], "~TodaysDate~", FormatDate(Today(), "MM-dd-yyyy"))

This will build a explicit file name for you each day like:

C:\Users\XXXXX\Desktop\XXXX\Queue File (08-02-2023).xlsx
Micheal Charron
RBC
Toronto, Ontario
Canada

Babjee24
Level 7

Hi Chris,

If you're using * in EV it looks like a wildcard but for Blueprism it's just another character it doesn't take * as a wild card from EV.

For your case in addition to Micheal's suggestion if you have the file in that particular path then have the EV limited to the path ( C:\Users\XXXXX\Desktop -- in your case). Using Utility-Filemanagement  you can get the files present in a folder by providing the pattern as *.xlsx You'll get the output in a collection in which you have all the details of complete file path, File name etc.; you can make use of that data which is needed for reading a file.

35781.png

Hope this helps...

Babjee Vangipurapu
Senior RPA Developer
India

@MichealCharron Thanks so much for this response, you are correct in how I am set up.  I haven't tried this yet but I can see the logic, contains a couple of techniques I have not yet used, but this will be a really good learning experience. Thanks for your answer.

@BabjeeVangipur2 Thank you so much for your response, I am a little more familiar with some of the things you suggest, so have used the Utility-FileManagement to get the file as a collection. I've then used Read Collection Field in CollectionManipulation to grab the specific File path, and then used the output data item for Open Workbook.

Also I can't seem to reply directly to either of you, so hope you both see this!

Thanks