On Apr 20, 2007, at 12:06 PM, Brian wrote:

Can you guys help me with this, I have been trying to get the salutation to work. I have three fields and they want to bring them together with the "&" symbol. Here is the javascript I have its just not working. ANYTHOUGHTS?


Brian,

Besides your script's several syntactical errors, this approach should work. Although, as a wise manager once told me, the first thing you should do before writing a program is turn your computer off.

So, lets just talk through a better approach--first, in plain English. There are a list of three fields. We wish to take all these fields and join them with an ampersand if they are not empty. Then we wish to add a comma at the end. Finally, we return this as a string. If the list is empty, throw an error.

So, consider the following:

   // 1. Start a list
   var vItems = new Array();

   // 2. If they are not empty, add to list
   if (Field("Full Name") != "")
   {
      vItems.push(Field("Full Name"));
   }
   if (Field("Full Name2") != "")
   {
     vItems.push(Field("Full Name2"));
   }
   if (Field("Full Name3") != "")
   {
      vItems.push(Field("Full Name3"));
   }

   // 3. join together and return
   if (vItems.length > 0)
      return vItems.join(" & ") + ",";

   // 4. list was empty, throw an error
   ThrowError("MakeMSIPlesseyBarcode",
        "The input string is invalid.");

   return ""; // never reached


HTH,  Brian Ray

--
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