View Single Post
  #1  
Old September 4th, 2020, 07:19 AM
sschardan sschardan is offline
Regular Contributor
 
Join Date: Oct 2008
Location: St. Louis, MO
Posts: 100
Default 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
Reply With Quote