Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Creator

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 14th, 2010, 03:06 PM
bobk_IMbranded bobk_IMbranded is offline
Junior Community Member
 
Join Date: Sep 2010
Location: Midwest
Posts: 15
Default rule that ignores initial caps or all-caps user input

I have a graphic rule that allows a user to enter a name in a variable data field and if it matches a what I want it to, it'll return a graphic- -

if (Field("Dealership Name").indexOf(String("Acura")) > -1)
{
return Resource("Acura.png");

but I want to allow for the possibility that a user may type in all caps or initial caps and or all lower case. As long as the it matches the words, I don't care about the case. How do I amend this rule to do that?

also, what does that "> -1" mean in the first line?

thanks

-bob
__________________
bobk
Using FusionPro Designer 6.0P1e with Indesign CS3, Acrobat 9 Pro
Reply With Quote
  #2  
Old October 15th, 2010, 06:11 AM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: rule that ignores initial caps or all-caps user input

you could change your IF statement to
Code:
if (Field("Dealership Name").toLowerCase().indexOf("acura") > -1)
The toLowerCase method converts your field value to all lowercase which you compare to an all-lowercase string in your indexOf method.

The indexOf method returns the start position of the string you're looking for in the string you're searching. A value of "-1" is returned if there is no match while a value of zero or greater is returned if the string does exist. So the code above is essentially saying "if the string exists anywhere in field value".
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #3  
Old October 15th, 2010, 06:40 AM
bobk_IMbranded bobk_IMbranded is offline
Junior Community Member
 
Join Date: Sep 2010
Location: Midwest
Posts: 15
Default Re: rule that ignores initial caps or all-caps user input

Thanks Eric. That's a lot more straight forward than I expected.
__________________
bobk
Using FusionPro Designer 6.0P1e with Indesign CS3, Acrobat 9 Pro
Reply With Quote
  #4  
Old October 15th, 2010, 07:28 AM
bobk_IMbranded bobk_IMbranded is offline
Junior Community Member
 
Join Date: Sep 2010
Location: Midwest
Posts: 15
Default Re: rule that ignores initial caps or all-caps user input

Eric, I forgot to ask about this..., I noticed you removed the "(String" portion of the rule after .indexOf(). Does leaving this in change the effect? What purpose does it have either way?
__________________
bobk
Using FusionPro Designer 6.0P1e with Indesign CS3, Acrobat 9 Pro
Reply With Quote
  #5  
Old October 15th, 2010, 01:03 PM
esmith's Avatar
esmith esmith is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Charlotte, NC
Posts: 870
Default Re: rule that ignores initial caps or all-caps user input

String() is redundant in this case because anything between the parenthesis is automatically defined to be a string. Leaving it in is not "wrong"; just unnecessary.
__________________
Eric Smith
Content Developer
Classic
FP 9.3.6, MAC OSX 10.9.4, Acrobat 11.0.09
Reply With Quote
  #6  
Old October 15th, 2010, 01:10 PM
bobk_IMbranded bobk_IMbranded is offline
Junior Community Member
 
Join Date: Sep 2010
Location: Midwest
Posts: 15
Default Re: rule that ignores initial caps or all-caps user input

Thanks, that's what I thought. I tested it both ways and it all worked the same. Thanks for confirming!!

-bob
__________________
bobk
Using FusionPro Designer 6.0P1e with Indesign CS3, Acrobat 9 Pro
Reply With Quote
Reply

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 05:24 PM.


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