Jump to content

Image rule with 2 Conditions


Vimal

Recommended Posts

Hi All:

 

I’m trying to write a variable graphic rule but having a bit of trouble with it. I have very little experience with javascript so please forgive me if any of this is simple.

 

I have a field in my data, lets call it “image” This image field contains the name of all the variable images I need for my document. Using the wizard I was able to set it up so that the images change based on that field (no problems, everything worked great!).

 

However the second condition I need met is where I’m having trouble. I have a second field, lets call it “align” that either has a “L” or “R”. I need two graphic boxes and if “L” appears in “align” I need the “image” to make the variable image in graphic box 1 (while making graphic box 2 blank) and if “R” appears in “align” I need the “image” to make the variable image in graphic box 2 (while making graphic box 1 blank).

 

The reason I’m doing it this way is with our previous software which ran through indesign this was a simple task/set up of turning on or off variable layers. The position of the graphic boxes are different because when we impose it up it comes together as a booklet (so one box is 2 inches to the right and one box is two inches to the left).

 

I hope that all makes sense, let me know if it doesn’t. If anyone has any advice or help it would be greatly appreciated!

 

Thanks!

Link to comment
Share on other sites

Vimal

Create 2 Graphic rules, one for the L graphic box and 1 for the R graphic box:

L graphic box Rule

if (Field("align") == "L")

return Field(image");

else

return "";

R graphic box Rule

if (Field("align") == "R")

return Field(image");

else

return "";

Insert each rule into its respective frame and that should do it.
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...