Jump to content

Issues with Ampersand in All Caps rule


Recommended Posts

Posted

The ampersand is either disappearing or showing as & depending on the different rules I try. Someone else had the same issue and I tried the answers given there (http://forums.printable.com/showthread.php?t=244&highlight=ampersand\) but none of them worked. I have tried all of the following (each once with "Treat returned strings as tagged text" checked and once without):

 

return ToUpper(NormalizeEntities(Field("First")));

return '<uppercase>' + NormalizeEntities(Field("Name")) + '</uppercase>';

return Field("Name").toUpperCase();

return ToUpper(Field("Title"));

 

None of them return just the '&' symbol when I test it on our online storefront (EFI's DSF 4.5). Am I missing something?

Posted

I tried running Field("Product") (data: B&M Beans & Rice) through the following:

 return ToUpper(Field("Product"));

and got the result: B BEANS & RICE

 

Then I changed the code to:

 return ToUpper(Field("Product")).replace(/&(\w)/ig, "&$1");

and correctly got the result: B&M BEANS & RICE

 

FYI: The regular expression in the first part of the replace function is saying to search for any instances of an ampersand followed by an alphanumeric character, regardless of case. The second part is saying to replace the found instance with the HTML code for an ampersand followed by the found alphanumeric character.

 

Hope that helps for your scenario. If not, can you post an example of the data in a sample field for one of your code snippets along with what the code returns?

Posted
hmm, that won't work for me. I selected "Treat returned strings as text" and got the result "MEG &AMP; MIKE". When I deselected "Treat returned strings as text" I got "MEG &&AMP; MIKE"
Posted
hmm, that won't work for me. I selected "Treat returned strings as text" and got the result "MEG &AMP; MIKE". When I deselected "Treat returned strings as text" I got "MEG &&AMP; MIKE"

What do you get if you edit the code above to replace just the stand-alone ampersand (and return tagged content):

return ToUpper(Field("Product")).replace(/&/g, "&");

For the sample you posted (Meg & Mike), this should work, but I think it may hiccup if you have a record like (M&M David Smith).

Posted

I would need to see the exact data as it is being fed into your rule along with the entire rule that is being processed. How are you getting two different results from one line of code?

I either get &AMP;

In this scenario, it would appear that the input data is already "&" to which the replace function is swapping the leading "&" with "&" and changing the balance of your input data to uppercase.

or &AMP;

In this scenario, the replace function is replacing input data of "&" with "&AMP;" but using the uppercase letters instead of lowercase for the HTML code. I'm not sure if HTML code is case sensitive.

 

Either way, I'm guessing that something is happening in a different part of your rule to affect the output OR your input data is in a specific format to cause problems. Is it possible to post the data as it is being fed into your rule on this thread (create a test rule that just returns the field as is to see what the original data looks like), and the entire rule that is processing the data?

 

Sorry for the confusion. I hate to be like those HelpDesk types that say, "well, it works for me" but I am having a hard time reproducing your problem. :(

Posted
None of them return just the '&' symbol when I test it on our online storefront (EFI's DSF 4.5). Am I missing something?

If the output composes correctly for you in FusionPro Desktop but not in the EFI Digital Storefront, then it would seem to be an issue specific to the DSF. (That's probably also why Eric is unable to reproduce the problem on his end in Desktop). I suggest contacting EFI Support.

Posted

The exact rule I was originally using, just to return all caps was:

 

return ToUpper(Field("First"));

 

I have tried the following rules:

 

return ToUpper(NormalizeEntities(Field("First")));

 

return '<uppercase>' + NormalizeEntities(Field("Name")) + '</uppercase>';

 

return Field("Name").toUpperCase();

 

return ToUpper(Field("Title"));

 

return ToUpper(Field("First")).replace(/&(\w)/ig, "&$1");

 

return ToUpper(Field("Product")).replace(/&/g, "&");

 

I have tried them all with and without the "Treat returned strings as tagged text" box checked.

 

With some of these rules the preview shows up just fine, but when I test it through our online ordering system they all fail in one way or another.

 

I have a sneaking suspicion that it's the online ordering system's software messing something up but I could very well be missing something in Acrobat as well.

 

Thanks

Posted
With some of these rules the preview shows up just fine, but when I test it through our online ordering system they all fail in one way or another.

 

I have a sneaking suspicion that it's the online ordering system's software messing something up

Yes, it's an issue in the DSF, specifically in the way it's taking the data from the web form and presenting it to FusionPro for composition.

 

When you Preview or compose locally, you are specifying the data directly to the FusionPro composition engine via your input data file. When you go through the DSF, the data from the web form is being collated by EFI's web application to create an input data file for FusionPro, but that algorithm is not properly handing the ampersands, and thus the data in the generated input file is wrong.

 

Printable's own Web-to-Print system, MarcomCentral, does a better job of handling these kinds of issues. Unfortunately, however, Printable can't do anything to fix the problem in the DSF, which is EFI's technology. Again, I suggest contacting EFI Support.

  • 7 months later...
Posted
Re: Issues with Ampersand in All Caps rule
Hi Megan,

I have come across this problem in the past and have found that this is the only way to get the results that I was looking for? It may very well be that it is completely unconventional to say the least but it DOES WORK. I hope it can help you in the same regard!:)

 

return '<uppercase>'+Field("Department")+'</uppercase>';

Archived

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

×
×
  • Create New...