Jump to content

Copyfitline and Inline Graphic


gregmaze

Recommended Posts

Hello...

I am having a problem getting a copyfitline with an inline graphic to work properly. This template will ultimately be on MarcomCentral Web. When I preview my template locally the Copyfitline rule works fine, but when I upload it to MarcomCentral's web the problems start.

The rule is

if (Field("Name")!="" & Field("PMP Logo")!="")
   return CopyfitLine("", Field("Name") + " " + Resource("PMP logo").content, "Aparajita Bold", 11, 144, 6, true)
else if (Field("Name")!="" & Field("PMP Logo")=="")
   return CopyfitLine("", Field("Name"), "Aparajita Bold", 11, 144, 6, true)
else return "";

When the logo is requested the logo appears fine, but when the logo is not requested it still appears. This only happens when I run this template within MarcomCentral.

 

I would appreciate any assistance on this.

Thanks in advance

Greg

Mac 10.11.6

FusionPro VDP Designer 10.0.3

Link to comment
Share on other sites

The first problem I can see offhand is that your Boolean "and" operator is wrong. You need to use a double ampersand (&&) instead of a single ampersand (&) for "and" in JavaScript.

 

Though I would rework the logic a bit to simplify the Boolean logic and remove the need for the "and" operator completely, like so:

 

if (!Field("Name"))
   return "";
//else
if (Field("PMP Logo"))
   return CopyfitLine("", Field("Name") + " " + Resource("PMP logo").content, "Aparajita Bold", 11, 144, 6, true);
//else
return CopyfitLine("", Field("Name"), "Aparajita Bold", 11, 144, 6, true);

Or, more in line with the DRY principle:

if (!Field("Name"))
   return "";

var text = Field("Name");
if (Field("PMP Logo"))
   text += " " + Resource("PMP logo").content;

return CopyfitLine("", text, "Aparajita Bold", 11, 144, 6, true);

However, the real problem might be that the values of the fields in the data generated by MarcomCentral may not be what you think. Specifically, I'm guessing that the value of Field("PMP Logo") when the logo is NOT requested by the user is something different from an empty string, such as "No" or "False". The best way to find out what is in that field is empirically, by simply putting that field in a text frame and looking at the output. Or, you can temporarily change the rule to just this:

return Field("PMP Logo");

And see what comes out.

 

Once you know what that value is from MarcomCentral, you can change the rule logic to account for it properly.

Link to comment
Share on other sites

Good Morning Dan,

Sorry it has taken me a couple days to reply. Thank you for your assistance. I changed my rule to the rule you sent but unfortunately it did the same. But after seeing your script, I do need to improve my coding. :)

I also entered a text box and entered the script

return Field("PMP Logo");

and got a very strange result

\\sdfsc01.dc.pti.com\ISR

I am definitely confused now.

 

I hope you can assist further

Thanks

Greg

Link to comment
Share on other sites

I also entered a text box and entered the script
return Field("PMP Logo");

and got a very strange result

So you're taking a bit of a peek through a keyhole into how the MarcomCentral application works. You have graphics stored in an image library in MarcomCentral, and when you select one of them from the MCC storefront, it puts the path where the graphic is stored on its servers, along with any other data entered on the form by the user, into a data file that it generates for the FusionPro composition.

 

It looks like, in this case, when "the logo is not requested", MarcomCentral is writing a folder path instead of a file path into the data file. I don't know exactly why that is either. It's probably something that needs to change in the Template Setup in the MarcomCentral app, rather than in FusionPro. At this point, you would need to ask your MarcomCentral Support person, or BRM/CPM/whatever we're calling them now, about this.

Link to comment
Share on other sites

×
×
  • Create New...