MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   The JavaScript Library (http://forums.pti.com/forumdisplay.php?f=23)
-   -   Another way to read page number? (http://forums.pti.com/showthread.php?t=10435)

sschardan September 4th, 2020 07:19 AM

Another way to read page number?
 
For many years we have used a different software for personalized images. That software creates the images and creates an appended data list, such that the name of each unique image is in a new field named "Field1", "Field2", "Field3", etc. I bring that appended data into a simple template that I use to keep an updated contact sheet. Each page consists of 8 picture and text frames using the rules below:

Text frame rule called label1:

HTML Code:

return (((FusionPro.Composition.currentPageNumber-1) * 8) + 1)
Graphic frame rule called graphic1:

HTML Code:

var pic = CreateResource(".//images//" + Field("Field" + Rule("label1")), "graphic", true)

return pic

Theses rules are duplicated 7 more times and customized for each position.

This works great. As I get more images, I duplicate as many pages as necessary, and it keeps bringing in the appropriate images and labels. Right now, I am up to 134 images.

Now we are using FP Expression. So I thought I could continue with a similar style by using this rule:

HTML Code:

var ResourceName = Rule("label1");
var Field1 = "First";

var myPI = Resource(ResourceName);
myPI.AddData(UntaggedRuleOrField(Field1) || " ");


return myPI;

and then name my FP Expression resources beginning at 135 to pick up where the other images ended.

This is not working, because the call to create the Expression images happens before composition, so it is not bringing the composition page number into the label rule calculation, thus resulting in not being able to find resource 0, resource -1, resource -2, etc.

Is there an alternative way to read the template body page number so it can be calculated up front?

Thanks

Dan Korn September 9th, 2020 01:11 PM

Re: Another way to read page number?
 
Sure, check the "Re-evaluate this rule for every graphic frame" box on the Rule Editor, and you can use the property FusionPro.Composition.currentPageNumber in the rule.

Though, instead of having to manually add pages to the template whenever there's a new resource, you could just repeat the record with a single page with one graphic and text frame on it, and use imposition to place an arbitrary number of those pages on each output sheet.

sschardan September 10th, 2020 01:28 PM

Re: Another way to read page number?
 
Thanks, Dan! I had forgotten to check the re-evaluate box on my FP Expression rules. I'll have to try the imposition method sometime.


All times are GMT -7. The time now is 07:17 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.