Jump to content

Recommended Posts

Posted

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!

Posted

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

Posted
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(/^,.+|, $/, '');

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

Posted

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;

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

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.

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