Jump to content

Rules help needed


Steve Blatman

Recommended Posts

I need a rule to build the first line of a mailing address.

 

I have four fields, some of which may be blank:

Client first name

Client last name

Spouse first name

Spouse last name

 

If the spouse fields are empty, I need just the client first and last names, e.g., James Smith

 

If the spouse first name field is not empty, and the spouse last name is empty, I need the line to be John and Mary Smith

 

If both spouse fields are not empty, I need

James Smith and Mary Jones

 

Any help would be most appreciated.

 

Thanks

Link to comment
Share on other sites

I used something similar for a layout using the Rule Wizard. My fields were Address, Room Numbers, Building name etc.... I'm new at JavaScript, so don't know if this is the best or most efficient way to do it.

 

if ((Field("SpouseFirst") == "") && (Field("SpouseLast") == ""))

{

return Field("ClientFirst") + ' ' + Field("ClientLast");

}

if (Field("SpouseLast") == "")

{

return Field("ClientFirst") + ' and ' + Field("SpouseFirst") + ' ' + Field("ClientLast");

}

if ((Field("SpouseFirst") != "") && (Field("SpouseLast") != ""))

{

return Field("ClientFirst") + ' ' + Field("ClientLast") + ' and ' + Field("SpouseFirst") + ' ' + Field("SpouseLast");

}

return "";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...