Jump to content

Need help!


Recommended Posts

I am trying to create a rule that will compare 2 fields and if both fields exist, a bullet will be returned between them. If only one field exists there is no bullet. Here is where I am at...


if (Field("2nd Email")&&(Field("Cottage Name"))

return NormalizeEntities(Field("2nd Email")) " • " + NormalizeEntities(Field("Cottage Name"));


return "" + NormalizeEntities(Field("Cottage Name"));



So my outcome would be

bob@abc.com • Bobs House




Bobs House


Any help would be GREATLY appreciated

Edited by Craig
Link to comment
Share on other sites

You could write it the way you have with if/else statements:

var result = "";
if (Field("2nd Email") != "" && Field("Cottage Name") != ""){
result = NormalizeEntities(Field("2nd Email")) " • " + NormalizeEntities(Field("Cottage Name"));
else if (Field("2nd Email") != ""){
result = NormalizeEntities(Field("2nd Email"));
else if (Field("Cottage Name") != ""){
result = NormalizeEntities(Field("Cottage Name"));

return result;


or you could simplify the code by using an array:

var s = NormalizeEntities(Field("2nd Email"));
var f = NormalizeEntities(Field("Cottage Name"))";
var result = [];
(s != "") ? result.push(s) : "" ;
(f != "") ? result.push(f) : "" ;

return result.join(" • ");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...