Jump to content
Welcome to the new FusionPro User Forum! ×

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...