Hello
I would like to loop on metadata after Data Mapper execution and add some fields only to pages
Can you guys tell me how to add any field on Page level in loop?
Greeting
Hello
I would like to loop on metadata after Data Mapper execution and add some fields only to pages
Can you guys tell me how to add any field on Page level in loop?
Greeting
Just add the âMetdata Fields Managementâ plugin after the âMetadata Sequenzerâ plugin. There you can choose to add a new metadata field on page level, insert a field name and a field value.
Thank You but I am preffering script
â Loop on all metadata leves throug Page level
â Add WAS value field on Page level (because WAS needs to icnrement for each page of document)
Function LoopOnMetadataPagesLevel(MyMeta)
Dim x, y, z, totalPages, generatedWAS, counter
counter = 1 ' This counter will help us to reset WAS
totalPages = MyMeta.Job.PageCount ' Get total amount of pages from Job level
' Loop on metadata groups
For x = 0 to MyMeta.Job.Count - 1
' Loop on all Documents in group
For y = 0 to MyMeta.Job.Group(x).Count - 1
' Loop on all DataPages
For z = 0 to MyMeta.Job.Group(x).Document(y).Count - 1
Next
Next
Next
End Function
There shouldnât be any reason to do this in the workflow metadata. You can build up a WAS sequence quite simply in the Output Preset via Add Additional Content.
Below is some code I wrote for an example template that uses either OMR marks or a datamatrix barcode to drive an inserter. In the case of OMR, there are built in tools for the WAS sequence, but they arenât available to the other barcode types. Therefore we need to calculate it based the documentâs metadata (sheet count).
${var resetVal = 7;
var startVal = 0;
var sequence = sheet.sequence.job;
if(startVal === 0){
sequence = sequence -1;
while (sequence > resetVal) {sequence = sequence - resetVal - 1;}
}
else{
while (sequence > resetVal) {sequence = sequence - resetVal;}
}
sequence = â000â+sequence;
sequence.slice(-2);}
This is a configurable code block, allowing you to set the starting point as well as the reset point. As written, it starts at 0 and resets once it reaches 7. The startVal can be either 0 or 1. You can insert it as is into the Text section of any Barcode or Additional Text entry in the Additional Content menu.
Furthermore, if youâre doing any sort of grouping, you may need to use a variable other than sheet.sequence.job for the sequence variable. Youâll find a list of those here: PlanetPress Connect 2018.2 User Guide
Thats great solution
This piece of code should be placed inside Output Preset Barcode additional content?
Correct. Specifically in the Text area. You can pretty much run any javascript you want inside there as long as itâs contained within the brackets. Iâd say your primary limitation is going to be the lack of global values. Thatâs why this code recalculates the current WAS on each page based on the current sheet number, rather than incrementing a value and storing it for the next record.
${//javascriptCodeHere}
And of course, you can chain several of these together while interspersing static text between them if you need to.
${//javascriptCodeHere}StaticText${//MoreCodeHere}
I will try Your solution later
At this moment we used additonal data mapper to generate WAS code for each record using java script code.
What if I want to have WAS BASE32 using Your code? So instead of reset WAS value on 7, I want to reset it when page counter = VVV and start from beginning.
Thanks