Relevance - Name of File Starts with abc and contains xyz

Hello and Happy New Year to everyone.

Please I need some assistance with the below. It works with a majority of the endpoints but throws up the ‘Singular expression refers to non-unique object’ message. the issue I am having is that there are 2 files in the folder with names that start the same but then have differing strings further on in the file name. see example file names below. It is the file that has ‘processed’ in the name that I required for my relevance

File 1 > esp_processing_data_230103174300_full.xml.processed_230104124206

File 2 > esp_processing_data_230103174300_full.xml.ignored_230103181448

if exist files whose (name of it starts with “esp_processing_data_”) of folder “C:\postilion\esocket.pos\incoming” AND (name of file whose (name of it starts with “esp_processing_data_”) of folder “C:\postilion\esocket.pos\incoming” does not contain “full.xml.ignored” as string) then (following text of first “=” of preceding text of last " " of (line 13075 of file whose (name of it starts with “esp_processing_data_”) of folder “C:\postilion\esocket.pos\incoming” as string)) else ("")

Any guidance will be most appreciated.

Thank you.

It’s easier if you combine the conditions and just work with one instance of the file:

(following text of first "=" of preceding text of last " " of line 13075 of file whose (name of it starts with "esp_processing_data_" and name of it does not contain "full.xml.ignored") of folder "C:\postilion\esocket.pos\incoming")|""

The pipe means “if there’s an error with the preceding expression then use this value instead” which is why the entire preceding expression is parenthesized.

Also, I’d go with contains "full.xml.processed" rather than does not contain "full.xml.ignored" if your circumstances allow… you know, just in case other files get in there somehow. :wink:

2 Likes

Hp3, Thanks so much, for this. Much appreciated! :slight_smile: