Jump to content

Duplicating Pick Lists


daanrud

Recommended Posts

Is it possible to duplicate a graphic pick list?

I am creating 5 graphic frames and all 5 of these will have the same drop list and graphic resources available to choose from for each frame. My issue is that there are about 70 graphic resources to choose from and adding these values one by one is a huge time eater.

 

Any help on this would be great.

Thanks!

Link to comment
Share on other sites

I assume this is with DSF or other solution. But you're probably looking for AddGraphicVariable.

 

var array = ["Frame1","Frame2","Frame3","Frame4","Frame5"];

for (i=0; i < array.length; i++){
FusionPro.Composition.AddGraphicVariable(array[i],  CreateResource("./img.pdf"));
}

 

I'm not familiar with DSF, but I'm assuming you can just put your logic above this snippet, then instead of returning something, return an empty string "" and replace what you would return where "./img.pdf" is.

Edited by ScottHillock
Link to comment
Share on other sites

  • 2 weeks later...
Thanks for your input Scott, and yes, this will be used in DSF. I'm pretty uneducated in JavaScript, that being said, how do I know what to put in the CreateResource string when the .pdf will be selected out of about 70 images in a dropdown?
Link to comment
Share on other sites

I got the dropdown to work, but I'm still not sure what to put in the CreateResource string. When I select one of the options from the dropdown, it doesn't populate an image.

I'll keep trying different things. Any pointers would be greatly appreciated!

Thanks

Link to comment
Share on other sites

Here is the attached .zip file.

This was my attempt at getting this to work. I'm not exactly sure what to put in between the () after CreateResource, since it will be choosing an image from the resources I have uploaded. The dropdown is working, but it will not return a graphic...obviously.

 

Thanks for your help

Corn_Pick_Brochure_TEST.zip

Link to comment
Share on other sites

Here is the attached .zip file.

This was my attempt at getting this to work. I'm not exactly sure what to put in between the () after CreateResource, since it will be choosing an image from the resources I have uploaded. The dropdown is working, but it will not return a graphic...obviously.

Okay, this is something. Although there's no actual data to test with, just one empty record. Since I don't have access to DSF to be able to fill out the web form that you set up with the HTML Form Definition dialog and generate a data file, I was hoping you would have provided some dummy data to plug in to use to test the template. If I preview with the basically empty data file you sent, I just get a whole lotta nothin'.

 

Anyway, you seem to have changed what you're asking from your original question about how to duplicate the Pick Lists themselves in the HTML Form Definition dialog. (I assume you just broke down and did it all manually, although you could collect to generate the XML file, edit it, and re-import it with FusionPro -> Define HTML Form -> From XML File. I'll also note that if you were using MarcomCentral [the application] instead of DSF, you would just point each of the five data fields to the same graphic library in the Template Setup.)

 

What you're really asking now, I think, is how to propagate the five different graphic frames from the five different data fields without writing five different rules.

 

The short answer is that you don't need to write any JavaScript at all, because you already have set up those fields as Graphic fields, and the values to be names of Graphic resources. And you have already assigned each frame the graphic field name directly, so it should just work. And I can verify that if I actually put the names of some of your resources into the data file for those graphic fields, it does work.

 

Now, having said that you don't actually need to write any code, you were on the right track with calling FusionPro.Composition.AddGraphicVariable in a loop, but (a) you need to it in OnRecordStart, and (b) you need to build up the names properly. You also don't need to call Resource or Create resource, as just the field value (the graphic name) will work. If you really wanted to do this in a rule, which you don't have to, I think this is what would be the right code, again, in OnRecordStart:

for (var i = 1; i <= 5; i++)
   FusionPro.Composition.AddGraphicVariable("Base Genetics " + i,  Field("Base Genetics " + i));

But I have to reiterate that you don't need any JavaScript code at all to do what you're doing.

 

Now, having said again that you don't actually need to write any code, and at the risk of muddying the waters, there is a way to make this template without having to manually lay out five sets of graphic and text frames: Create a repeatable component (Template Page), with one text and graphic frame on it, and write code to call out the template as many times as you need, into a single text frame (which can overflow to new pages). If you need to scale this up and call out more than five graphics, that's the way to automate it. But if you only ever have up to five of them, the template you have is fine.

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...