XML Pickup to retreive pdf job

Post Reply
tsellem
Newbie
Posts: 8
Joined: Thu Feb 02, 2012 6:11 pm

XML Pickup to retreive pdf job

Post by tsellem »

Hello,
As a newbee in manipulating xml files and data, i'm looking correct ways to use XML Pickup and Inject Job in sw 13 up1.

For example, in a folder I have pdf files and xml files name like this:
12345_aaaaaaa.pdf
23456_bbbbbbbbb.pdf
56789_ccccc.pdf
and
12345_zzzzz.xml
23456_xxx.xml
56789_yyyyyyyy.xml

Informations about the pdf files are stored in the xml files matching the first 5 numbers in their names.

My goal is to remame the pdf files with informations (like name and date) that are in fields <Agency> and <IssueDate> of the matching xml file.
For example obtain pdf: 12345_MyAgency_2017-03-05.pdf with datas from the xml 12345_zzzzz.xml in the fields <Agency>MyAgency</Agency> and <Issuedate>2017-03-05</IssueDate>

I think is possible standard function XML Pickup and Inject Job, but I don't know how to retreive information about xml files.

Many many Thanks for your help and advices.

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

Re: XML Pickup to retreive pdf job

Post by gabrielp »

No Inject needed, just XML pickup and Rename. Just do an XML pickup with metadata alongside asset and give it a matching property like segment 1-5 (or everything before the _) and a wildcard. I don't have Switch anymore but it should be something like [job.name segment 1-5]_* that should match those two files. Once the XML is picked up, you can pass the PDF through a rename and use dataset variables to rename it.
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.
tsellem
Newbie
Posts: 8
Joined: Thu Feb 02, 2012 6:11 pm

Re: XML Pickup to retreive pdf job

Post by tsellem »

Hello Gabrielp,

Thanks for your help.
Your method is ok, it works !

In fact, I keep the radical of the two files (xml and pdf) with job.nameproper before "_", so the xml pickup is active as it sees the 2 files with the same name in folder, and now I can easyly take values in fields of dataset xml to re-compose my new names.
Once again, many, many thanks.

Thierry.
Post Reply