Topic Options
#39549 - 05/13/12 06:09 PM Variable call to metadata
jim3108 Offline
OL Toddler

Registered: 04/19/10
Posts: 48
Loc: London, UK
I have a loop in a workflow and for each iteration of the loop, I want to overwrite the variable {global.var} with the following:

Code:
GetMeta('a_token%i[0]', 0, 'Job.Group.Document.DataPage.Page')

...where '%i' is the iteration index.

For background: The document strips numbers from the body of the incoming data and stores each token as a new meta field.

Quote:
Example
if found { definemeta('a_token'&count,'DATA') }
presume count = 4 for this purpose

So in effect we now have 4 meta data entries called 'a_token' and appended to the end of this is the number of the token which is found.

In the workflow I then need to loop over the tokens (I can use '&count' calculated by the ptalk in the document as a control variable) and extract them for each iteration of the loop - I then take the result, compare it to the current record in memory and conditionally perform an action - in this case it uses the token as a mask for a folder input command ('a_token' should match a filename in a directory)

The problem I am having is that when the loop executes, for the first iteration (0) the following works:

Code:
GetMeta('a_token%i[0]', 0, 'Job.Group.Document.DataPage.Page')

...returning the data value stored in 'a_token', entry 0. When the loop then iterates again (iteration 1) it fails, giving error:

Quote:
W3001 : Error while executing plugin: Error resolving data selection: Error loading metadata file: File not found
Set Job Infos and Variables: W1603 : Plugin failed - 23:00:04

Any ideas? Is there an easier way of doing this? Am I being a total plank?!
_________________________

James Stacey
KMF TECH LIMITED
james@kmftech.co.uk

gmail: 'sirstace' (contact me on Google Talk)
-----------------------------------------------------------------------------

Top
#39554 - 05/14/12 10:00 AM Re: Variable call to metadata [Re: jim3108]
Raphael Lalonde Lefebvre Online   content
OL Expert

Registered: 10/14/05
Posts: 3643
Loc: Objectif Lune Montreal
jim3108,

I think the problem may be that you're doing a Create File after your loop(or maybe another input) at some point in the process. I've tested with a Create File, and what it does is delete the current metadata file. Makes sense, since you're changing the input file, so PlanetPress thinks it's better to delete the metadata that doesn't match the new input file.

A workaround in this case would be to replace the Create File or other input by a branch, then in the branch, first use a Set Job Info and Variables action to store the value of the metadata field in a job info, and then use the Create File. You can then use the job info variable to refer to the information found in the metadata.

Hope that helps!

Regards,
Raphaël Lalonde Lefebvre

Top
#39556 - 05/14/12 11:04 AM Re: Variable call to metadata [Re: Raphael Lalonde Lefebvre]
jim3108 Offline
OL Toddler

Registered: 04/19/10
Posts: 48
Loc: London, UK
I am not sure that I fully understand what you mean...

Here is my workflow:



(I have removed locations etc. for confidentiality reasons for my client.)

Maybe you can point me in the right direction.

Thanks,

James.
_________________________

James Stacey
KMF TECH LIMITED
james@kmftech.co.uk

gmail: 'sirstace' (contact me on Google Talk)
-----------------------------------------------------------------------------

Top
#39558 - 05/14/12 12:49 PM Re: Variable call to metadata [Re: jim3108]
Raphael Lalonde Lefebvre Online   content
OL Expert

Registered: 10/14/05
Posts: 3643
Loc: Objectif Lune Montreal
James,

Problem most likely occur after the Folder Capture in the branch, at which point the metadata will be replaced.

What I'd recommend is after your Loop, you create another branch. The you put the various Set Job Infos and Variables in that branch, along with the Folder Capture and Send to Folder. Then, back to the previous branch, just put a Delete output just to end the loop, since we don't need to do anything else after the branch.

Try it out, and let us know if that works.

Regards,
Raphaël Lalonde Lefebvre

Top
#39569 - 05/14/12 05:11 PM Re: Variable call to metadata [Re: Raphael Lalonde Lefebvre]
jim3108 Offline
OL Toddler

Registered: 04/19/10
Posts: 48
Loc: London, UK
Thank you! You are my hero!

I will remember that PP deletes the metadata at end of any branch.

Regards,
James.
_________________________

James Stacey
KMF TECH LIMITED
james@kmftech.co.uk

gmail: 'sirstace' (contact me on Google Talk)
-----------------------------------------------------------------------------

Top
#39576 - 05/16/12 10:14 AM Re: Variable call to metadata [Re: jim3108]
Raphael Lalonde Lefebvre Online   content
OL Expert

Registered: 10/14/05
Posts: 3643
Loc: Objectif Lune Montreal
To be more accurate, it doesn't necessarely delete it at the end of a branch. Rather, it deletes it when a new input action is called.

In your case, the Folder Capture happens to be at the end of your branch, but even if it wasn't the end of your branch, it's at this point that the metadata would be deleted.

Raphaël

Top