Metadata variable and the After filter

Post Reply
jackson41
Newbie
Posts: 16
Joined: Tue Apr 03, 2012 12:10 pm

Metadata variable and the After filter

Post by jackson41 »

Hi I don't know if anybody can help but in a metadata variable i need to isolate a file name from its path location.

For example C:\Jobs\FileLoctaion\A4_Poster.pdf- i need to isolate the pdf file name. Currently the way i am trying to do this is to use the 'After' filter where i enter '\FileLoctaion\' in the 'After' field and therefore i should be left with just A4_Poster.pdf but for some reason the filter does not like the last backslash in the 'After' field and the filter does not work and displays nothing.

If i enter '\FileLoctaion' without the last backslash the result is as expected \A4_Poster.pdf but this is not what i need, as i don't need th preceding backslash.

Any help greatly appreciated.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Metadata variable and the After filter

Post by gabrielp »

What you described should work fine. You can test this by looking at the Job.Path variable and adding the preceding path in the "After" box:
Image

I can't imagine why the "/" should be causing issues for you. Perhaps it is not a normal / and instead it is a weird encoding?

As a sanity check, this file path is a metadata variable only and not the Job.Name, right? Because if it's the job's name, Job.Name is the best place to get that.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
jackson41
Newbie
Posts: 16
Joined: Tue Apr 03, 2012 12:10 pm

Re: Metadata variable and the After filter

Post by jackson41 »

Hi

Thanks for the info, the only difference between our two posts is that i am having an issue with a back slash and not a forward slash as illustrated in your screenshot. Do you think it could be the back slash that causes the problem?

Many Thanks Dave
Krzysztof Mycek
Member
Posts: 30
Joined: Tue Mar 03, 2020 11:28 am

Re: Metadata variable and the After filter

Post by Krzysztof Mycek »

I have a the same problem. The \ character is not recognized by After and Before filed
saitok
Member
Posts: 63
Joined: Fri Apr 24, 2015 10:14 am
Location: Tokyo Japan

Re: Metadata variable and the After filter

Post by saitok »

It looks like we can use \ in the Search field.
So, when I enter the following expression, I can get "\A4_Poster.pdf".
\\.[^\\]*$

To slice the \ left at the begining, I think we have to store the value as a Private Data at first.
And then, get the Private Data by another element with an option "2-" of Segment field.
laurentd
Member
Posts: 137
Joined: Wed Mar 13, 2019 2:06 pm

Re: Metadata variable and the After filter

Post by laurentd »

Again, the StringSplitter app can help
https://www.enfocus.com/en/appstore/pro ... ngsplitter
The same question was asked here: viewtopic.php?f=25&t=4146&p=12974

Use separator \
The different parts of the name will be stored in private data Split.Part1, Split.Part2, Split.Part3 etc (default names)
The app always adds Split.NumParts with the number of parts of the string.
So if you want the last part of the name but the number of \ in the name is variable, use
[Job.PrivateData:Key="Split.Part[Job.PrivateData:Key="Split.NumParts"]"]
Laurent De Wilde, Solution Architect @ Enfocus
Post Reply