Jump to content

comma rule


Fabian

Recommended Posts

hello, id like write a rule that returns literal text (in this case a comma). for example:

 

if Field"FirstName" and/or Field"LastName" have a value, return a "," after the last field with a value.

so for instance if Field"FirstName" was Joe and Field"LastName" was Sample; return Joe Sample,

 

or if Field"FirstName" was Joe and Field"LastName" had no value; return Joe,

or if Field"FirstName" had no value and Field"LastName" was Sample; return Sample,

 

and if Field"FirstName" and Field"LastName" have no value; return nothing

 

im not too sure on how to write the javascriptin for this, so id appreciate anyones help :)

Link to comment
Share on other sites

I think this should do it:

 

Create an empty text rule, give it a name and paste the following (adjusting your field names of course).

 

if (Field("FirstName")||Field("LastName"))

return ",";

else return "";

 

This is saying if either field has a value of any kind return the ",". Otherwise return nothing.

 

You may need to check the "return tagged strings as text" checkbox in the rule editor.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...