Jump to content

FP Expression resource from CSV file


bhm8hwcm

Recommended Posts

I am tyring to create a rule whereby I get the name of the FP Expression to be used from a CSV file rather than attaching a particular Expressions image to a variable graphic box. I am new to javascript so having some problems with creating the resource i think.

 

I converted the FP rule for inserting a personalized picture to javascript. I need to create the resource though not sure how.

 

My javascript is setup like this:

my csv file has a field called file and value is name of template I want to use like "cookie.fpx" (without quotes...have also tried with quotes)

 

var Pic1 = "";

var Var1 = "name";

var Var2 = "";

var Var3 = "";

var Var4 = "";

 

Pic1 = CreateResource(Field("file"), "graphic",true);

 

var myPI = Resource(Pic1);

 

When i try to validate i get an error saying :

Error: In Resource(), no resource named Resource("Cookie.fpx)

 

Any thoughts? thanks

Link to comment
Share on other sites

You need to change that next-to-last line to:

Pic1 = CreateResource(Field("file"), "FP Expression Image");

And right after that you'll want to add aline like this to add the personalization data:

Pic1.AddData(Field("Name"));

Then you can just "return Pic1." You don't need that other call to Resource().

Link to comment
Share on other sites

Hi Dan thanks a lot...this worked!

 

One last question, in my rule I would also like to access the page number of the PDF. I am working with a multipage pdf with rules on each page and want to access the page numbers within the rules.

 

I was looking through the building blocks but was not sure which one to use and could not get them to work. I know you can access the page number as a variable in a text box so I assume the variable is available for use in a rule.

 

thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...