wellers_97 Posted August 31, 2017 Share Posted August 31, 2017 First off I'm fairly new to fusion pro so forgive me for my simple questions. I am creating a business card for Digital Store Front and some cards will have just a Full Name and others will also include credentials. When credentials are present I need a comma after the Full Name field. Example: John Doe John Doe, DMD I know this is a very simply thing but nothing I have tired has worked so far. Help! Quote Link to comment Share on other sites More sharing options...
Leosmith Posted September 1, 2017 Share Posted September 1, 2017 This should do it if ((Field("Full Name") != "") && (Field("Credentials") != "")) return Field("Full Name") + ", " + Field("Credentials"); else if ((Field("Full Name") != "") && (Field("Credentials") == "")) return Field("Full Name"); else return ""; Quote Link to comment Share on other sites More sharing options...
step Posted September 1, 2017 Share Posted September 1, 2017 This should do it if ((Field("Full Name") != "") && (Field("Credentials") != "")) return Field("Full Name") + ", " + Field("Credentials"); else if ((Field("Full Name") != "") && (Field("Credentials") == "")) return Field("Full Name"); else return ""; There are quite a few ways to do this. Here are a few more: var result = Field("Full Name"); if (result && Field("Credentials")) result += ", " + Field("Credentials"); return result; return [Field("Full Name"), Field("Credentials")].filter(String).join(", "); return (Field("Full Name") + ", " + Field("Credentials")).replace(/^,.+|, $/, ''); Quote Link to comment Share on other sites More sharing options...
wellers_97 Posted September 1, 2017 Author Share Posted September 1, 2017 This should do it I've used this and it worked great, but now I've run into a related issue. The full name should be in 11pt. font, but the credentials need to be in a 9pt. font. I'm assuming this would need to be taken care of within the same code? Quote Link to comment Share on other sites More sharing options...
Leosmith Posted September 1, 2017 Share Posted September 1, 2017 The 11 point font would be selected in the text box and in this rule the point size for the credentials would be 9 point. if ((Field("Full Name") != "") && (Field("Credentials") != "")) return Field("Full Name") + ", " + '<span font="Arial" pointsize=9>' + Field("Credentials") + '</span>'; else if ((Field("Full Name") != "") && (Field("Credentials") == "")) return Field("Full Name"); else return ""; I do like this better from Step's example var result = Field("Full Name"); if (result && Field("Credentials")) result += ", " + '<span font="Arial" pointsize=9>' + Field("Credentials") + '</span>'; return result; Quote Link to comment Share on other sites More sharing options...
wellers_97 Posted September 1, 2017 Author Share Posted September 1, 2017 The 11 point font would be selected in the text box and in this rule the point size for the credentials would be 9 point. if ((Field("Full Name") != "") && (Field("Credentials") != "")) return Field("Full Name") + ", " + '<span font="Arial" pointsize=9>' + Field("Credentials") + '</span>'; else if ((Field("Full Name") != "") && (Field("Credentials") == "")) return Field("Full Name"); else return ""; I do like this better from Step's example var result = Field("Full Name"); if (result && Field("Credentials")) result += ", " + '<span font="Arial" pointsize=9>' + Field("Credentials") + '</span>'; return result; I used code from Step's example with the font size additions and now it returns Full Name, <span font="Arial" pointsize=9>Credentials</span> Quote Link to comment Share on other sites More sharing options...
Leosmith Posted September 1, 2017 Share Posted September 1, 2017 in the rule editor check the box "treat returned strings as tagged text" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.