cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with dynamically created file path - identical to the 'correct' path but not working

PeterHeyburn123
Level 3

Hi all,

I am developing a process where I need to access a folder, 'Folder1' contained within a network drive. Within this folder, there are subfolders by year and then month. I need to be able to access files within the correct folder depending on the current year and month.

However I have found that the dynamic file path I am generating does not work despite being identical to the actual file path I would use if I were to hardcode it.

I am using a config file with the following example file path structure:

L:\Folder1\<YEAR>\<MONTH>\Filename.xlsm

During the process I am using a multi-calculation stage to replace the two text placeholders using FormatDate(Now(), "yyyy") and FormatDate(Now(), "MM. MMMM") to generate e.g. 2024 and 06. June respectively, so the file path becomes:

L:\Folder1\2024\06. June\Filename.xlsm

For some reason the above generated file path does not work despite being identical to the file path retrieved from the Security tab of the properties window for the file. I am at a loss and hoping to get some help!

I have checked for leading/trailing spaces, used Trim() to eliminate these. I have pasted both the generated path and the actual path into a notepad document and compared them character by character. My working theory is that Blue Prism has somehow introduced some kind of special character into the string.

This method is working in other processes with identical logic but not this one. I am posting from mobile so apologies for any formatting issues. Thanks in advance.

1 BEST ANSWER

Helpful Answers

Hi @PeterHeyburn123 ,

Can you try this out once:

On this website , try to paste the path that you are getting from Blue Prism calculation stage result and also paste the path that you get from the 'Copy As Path' option when you manually press 'Shift' + Right Click on the file from File Explorer.

This will tell us what hidden characters are exactly present. My guess here is in your config file you may have these characters that is messing up the overall structure:

devneetmohanty07_0-1718873430499.png

 



---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

View answer in original post

12 REPLIES 12

GeoffHirst
Staff
Staff

Hello Peter,

Thank you for being a SS&C Blue Prism Customer and for using Blue Prism. The problem you are having is likely because of the single '\'. Could you try building your filename using '\\' ? The reason I say this is the asset building the path, MAY be written in C# and this language uses '\' as an escape character. In order to get the backslash character, you have to double up. This is a quick answer, it may not solve your problem so please do come back to me if it doesn't and we can look a bit deeper for you.

Once again, thank you for using Blue Prism.

regards

Geoff Hirst

 

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

GeoffHirst
Staff
Staff

Hi Peter,

Are you using the Utility - File Management - Create Directory action to produce your folder structure?

I just tried it and it works with both single and double '\' so my first suggestion might not be a solution for you.

Can you advise, what error are you getting?

You have permissions to the shared drive to create folders? (Sorry, needed to ask)

Can you take the path created and create a directory manually from it?

That's all for now.

regards

Geoff Hirst

 

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

Hi Geoff,

Thanks for getting back to me.

So the folder structure already exists, I am simply attempting to build a dynamic file path to access different folders within it depending on the current month. For example, I may occasionally need to grab a file from two months ago, so I have ensured to use FormatDate(AddMonths(Now(), -2), "yyyy") and FormatDate(AddMonths(Now(), -2), "MM. MMMM") to account for a scenario in e.g. January 2025 where two months in the past would be November 2024.

The thing I can't understand is that I have used identical logic for two other processes that will be accessing the same folder (it's a reporting solution which accesses the same files for different purposes), and there is no problem with the generated dynamic file paths. It's just this process.

To answer your questions:

  • I have full access to the folders
  • I am using a 'File Exists' action to check whether the file is there, which returns false. If I copy the generated file path from the data item and paste it into the address bar in file explorer I get the error "Windows can't find '<File path here>'. Check the spelling and try again".
  • If I directly copy the file path from the file explorer and paste it into the current value of the data item, and then run the File Exists action again, it returns true.

Here is a screenshot of the multi-calc I am using to generate the file:

PeterHeyburn123_0-1718870774429.png

I have redacted any identifying information, but essentially I am retrieving the base string from the config file, using a series of Replace functions to replace text placeholders with dynamic values. The red redaction is one file, and the blue redaction is another file. Neither path is working.

Hi @PeterHeyburn123 ,

Can you try this out once:

On this website , try to paste the path that you are getting from Blue Prism calculation stage result and also paste the path that you get from the 'Copy As Path' option when you manually press 'Shift' + Right Click on the file from File Explorer.

This will tell us what hidden characters are exactly present. My guess here is in your config file you may have these characters that is messing up the overall structure:

devneetmohanty07_0-1718873430499.png

 



---------------------------------------------------------------------------------------------------------------------------------------
Hope this helps you out and if so, please mark the current thread as the 'Answer', so others can refer to the same for reference in future.
Regards,
Devneet Mohanty,
SS&C Blueprism Community MVP 2024,
Automation Architect,
Wonderbotz India Pvt. Ltd.

GeoffHirst
Staff
Staff

HI,

Sorry, I got the wrong end of the stick there. This is a strange one. So, the File Exists action returns the true/false value to a File.Exists method. Now, if this method throws an exception, it returns False, if the file exists, it should return true, otherwise it returns false. So, lets explore this possibility of a spurious character making its way into the pathname. Can you create a data item and get the length of the pathname, after your pathname is created by your multicalc. At least this way we might be able to see if there is an unprintable getting in there somehow. In the interim, I will try and build a replica of what you are trying to do. Let me know how you get on.

regards

 

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

Hi Devneet,

Thanks for replying.

That's a very useful tool, it has revealed that when Blue Prism reads in values from the config file, it is adding Unicode characters 'U+202A' which appears to be Left-to-Right Embedding. I have verified that the text string I am adding to the config does not contain those characters, but they are present immediately after I use the 'Get Worksheet as Collection' action within the 'MS Excel VBO'.

I suppose I could just remove these characters, however I would be concerned that the issue may crop up elsewhere.

Have you seen this before?

Hi Geoff,

Thanks for getting back to me. Please see my response to Devneet above - when Blue Prism reads in the config data it is adding Unicode characters 'U+202A' to the start of the string which means Left-to-Right Embedding.

Before I saw Devneet's response I had performed a comparison between the dynamically created file path and the actual file path using a BP Decision Stage and it was flagged as False, i.e. not equal.

GeoffHirst
Staff
Staff

Hi Peter,

Yes that tool is indeed very useful, nice one Devneet!!! That's gone in my list of bookmarks. So, moving forward for you. I wasn't aware that you were using the Excel VBO, I have seen odd characters get emitted from using this asset. However, as a sticking plaster for you, and this is a sticking plaster until we can resolve what might be happening with the Excel VBO (Assuming it is a problem our side of course !) You might do well to employ a regex check of the path and remove unprintables. Now there is an asset called Utility - Strings that has a couple of regex actions, whether they will provide you with what you need I will wait for your response. I hope this helps.

regards

Geoff Hirst Senior DX Engineer - Digital Exchange - EMEA SS&C Blue Prism

Hi Geoff,

Just to close the loop on this one, the config excel file has a number of columns but interestingly it was only one specific column where these Unicode characters were being added after BP read it to a collection. I deleted the column and recreated it, which has solved the problem.

Simple solution but the issue was only discovered using Devneet's tool so I am going to mark his answer as the solution. I really appreciate your help as well.

Cheers