Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Graphic Rules

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 14th, 2009, 02:26 PM
mstanton mstanton is offline
Regular Contributor
 
Join Date: Aug 2009
Posts: 65
Question Change Graphic Resource based on String Length of a Different Text Field

Hello,

I am wondering if there is a way I could make a particular graphic appear if there are more than 50 characters in a certain text field. My reason for doing this is that when the line reaches 50 characters, it hits a background color that is too similar to the font color. I want to place a graphic behind that section of text that will help the text show up better. I don't need/want it to be there, though, if the text is less than 50 characters.

I have tried this rule:

Code:
if(Len(Field("Website")>50))
return Resource("BKG")
else return Resource("BKG2")
where BKG is the darker section of the background graphic and BKG2 is the same section of the original background.

Thanks!
__________________
-Megan

I am Using: EFI Digital Storefront v7.0.0.20391 / FusionPro Designer 9.2.25 / Mac OS 10.6.8 / Acrobat 10.1.9 and Acrobat 11.0.06 / InDesign CC v9.2 and InDesign CS5.5 v7.5.3
Reply With Quote
  #2  
Old August 17th, 2009, 08:20 AM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: Change Graphic Resource based on String Length of a Different Text Field

Your logic looks right, but your formatting is wrong. It should be written as:
Code:
if(Len(Field("Website")) > 50) {
    return Resource("BKG");
    }
else return Resource("BKG2");
You had a closing parenthesis in the wrong position in the first line, and no brackets "{}" around the first return. You are also forgetting to end your lines with a semicolon. As a result, the code executes the first return statement every time. Technically, you could also simplify your code to:
Code:
return (Len(Field("Website")) > 50) ? Resource("BKG") : Resource("BKG2");
Of course, this should be a graphic rule since it returns a graphic element.
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
Reply

Tags
graphic resource, graphics, rule

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.