Here's some code that should do what you want. Just copy and paste it into your 
rule.


if (Trim(Field("FirstName2")) == "" && Trim(Field("LastName2")) == "")
  return Field("FirstName1") + " " + Field("LastName1");
else if ((Trim(Field("LastName2")) == "") || (Trim(Field("LastName1"))) == 
Trim(Field("LastName2")))
  return Field("FirstName1") + " & " + Field("FirstName2") + " " + 
Field("LastName1");
else
  return Field("FirstName1") + " " + Field("LastName1") + " & " + 
Field("FirstName2") + " " + Field("LastName2");



Lauren Nackoney
Senior Quality Assurance Engineer
Printable Technologies, Inc.
[EMAIL PROTECTED]


-----Original Message-----
From: Spencer Whetstone [mailto:[EMAIL PROTECTED]
Sent: Friday, September 07, 2007 7:37 AM
To: FusionPro Users Forum
Subject: [fusionpro] I need a rule that properly concatenates names


Can the resident JavaScript gurus help with this?


I have a database that looks like this.

        <FirstName1>    <LastName1>     <FirstName2>    <LastName2>
1       Joseph          Smith                   Jane                    *no
data*   
2       Jane                    Jones                   *no data*
*no data*
3       Alice                   Wilson          Gerald          Green

*no data* means literally an empty field

I need to address these people as follows"

Joseph & Jane Smith     <!-- concatenate FirstName1," & ", FirstName2,"
",LastName1 -->
Jane Jones                      <!-- concatenate FirstName1, " ",LastName1
-->
Alice Wilson & Gerald Green <!-- concatenate FirstName1,"  ",LastName1," &
",FirstName2," ",LastName2  -->

Example 1 - I need to test if LastName2 is empty OR THE SAME as LastName1,
in which case return result of { concatenate FirstName1," & ", FirstName2,"
",LastName1}

Example 2 - If BOTH FirstName2 and LastName2 are empty return result of {
concatenate FirstName1," ",LastName1}

Example 3 - if all fields are NON-EMPTY and if LastName1 AND LastName2 are
unique return result of { FirstName1,"  ",LastName1," & ",FirstName2,"
",LastName2}

Thanks for all responses,

Spencer



+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- 
Calling all FP Web Users!

Do you have a question or lots of knowledge to share about FusionPro Web?

If so, join our Printable Web to Print Users' Forum today!

Send email to [EMAIL PROTECTED] to find out how! 
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-


--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED] 
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Calling all FP Web Users!

Do you have a question or lots of knowledge to share about FusionPro Web?

If so, join our Printable Web to Print Users' Forum today!

Send email to [EMAIL PROTECTED] to find out how!
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-


--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to