PDA

View Full Version : A Rule associating with a comma and suffix of a name


swilson
July 24th, 2012, 09:46 AM
Hi,

I have a data file with the fields:
Pre Name
First Name
Initial
Last Name
Post Name (Suffix)

When I create my text box in Fusion Pro and add in the fields, I also type a comma in there. However, not everyone has a Post Name (Suffix). I would need somehow for that comma only to be used when the person has a Post Name. Please let me know how I can accomplish this.

thanks,
Stephanie

Dan Korn
July 24th, 2012, 12:06 PM
return Field("Post Name") ? ", " + Field("Post Name") : "";

esmith
July 24th, 2012, 01:14 PM
GASP! Dan must be feeling under the weather. I've never seen him post code without the code tags. ;)

malmazan
December 2nd, 2013, 10:52 AM
To elaborate and revive this thread, I am having the same issue but the code Dan posted isn't working for me. I've played around with it quite a bit and think I must be missing something obvious here.

I have the fields:
First Name
Last Name
Title

In my variable text is set up as so: «First Name» «Last Name», «Title»

Not every name has a title, so I want to remove the comma when the Title field is empty.

The code I was using is:
return Field("Title") ? ", " + Field("Title") : "";

Help please!

Mariah

jwhittaker
December 2nd, 2013, 12:35 PM
This is definitely not the best, easiest or most efficient but you could us something like this:

//commaRule (This is the rule name)

if (Field("Title") != "")
return ", " + Field("Title");
else
return "";

Then in your text frame you wouldn't put the comma just the rule.
Field("First Name") Field("Last Name")commaRule

malmazan
December 2nd, 2013, 12:47 PM
Thank you, Jon! That worked like a charm. :D