Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 25th, 2019, 06:34 PM
dml1280 dml1280 is offline
Junior Community Member
 
Join Date: Apr 2016
Posts: 19
Default Ampersand in external data file

I am using an external data file to bring in different location addresses.

The names of the locations uses an ampersand rather than "and". This is how their logos are set up and I would like to keep it all consistent.

When I code the card with Fusion Pro, everything works fine and it composes correctly, but when I upload onto MarcomCentral, the list doesn't work with the ampersand.

Is there a way to make it work without replacing "&" with "and"?
Reply With Quote
  #2  
Old November 25th, 2019, 08:39 PM
Alex Marshall's Avatar
Alex Marshall Alex Marshall is offline
FusionPro VDP Support
 
Join Date: Sep 2008
Location: Chicago,Illinois
Posts: 384
Default Re: Ampersand in external data file

This rule should do what you want:
{code}
var title = TaggedDataField("Address"); // Handles both flat-file data in Acrobat and tagged data generated by DSF.
title = ReplaceSubstring(title, "&", "&"); // "Normalize" numeric entities for ampersands to the named entity.
title = ReplaceSubstring(title, "&amp;", '<f name="Times New Roman">&amp;</f>'); // Replace the font just for ampersands.
return title;
Reply With Quote
  #3  
Old November 26th, 2019, 04:47 AM
dml1280 dml1280 is offline
Junior Community Member
 
Join Date: Apr 2016
Posts: 19
Default Re: Ampersand in external data file

This is the "record walker" code. I have a separate rule for each variable I am bringing in from the external data file:

Code:
returnStr = '';

if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true)
{
    Rule("OnJobStart");
}

numRecsExtDF = externalDF.recordCount;

for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
    if (externalDF.GetFieldValue(recordWalker, 'Facility') == Field("Facility"))
    {
        returnStr += externalDF.GetFieldValue(recordWalker, 'Facility');
    }
}

return returnStr;
The facility names have "&" in them. The issue is that in Fusion Pro it pulls the record correctly. Once uploaded to MarcomCentral, the record doesn't get pulled when the facility name is selected from the dropdown.

I tried adding "TaggedDataField" before "Facility"
Code:
 if (externalDF.GetFieldValue(recordWalker, 'Facility') == TaggedDataField("Facility"))
But that didn't work.

Any other ideas? Or is there somewhere else I should add the "TaggedDataField"?

Thanks for your help!
Reply With Quote
  #4  
Old November 26th, 2019, 09:24 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,549
Default Re: Ampersand in external data file

Code:
returnStr += TaggedTextFromRaw(externalDF.GetFieldValue(recordWalker, 'Facility'));
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old November 26th, 2019, 02:45 PM
dml1280 dml1280 is offline
Junior Community Member
 
Join Date: Apr 2016
Posts: 19
Default Re: Ampersand in external data file

Thanks but that didn't work.

It shows up fine in FusionPro but not in MarcomCentral.

It's not pulling the address and website.

Code:
returnStr = '';

if(FusionPro.Composition.isPreview == true || FusionPro.inValidation == true)
{
    Rule("OnJobStart");
}

numRecsExtDF = externalDF.recordCount;

for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
    if (externalDF.GetFieldValue(recordWalker, 'Facility') == Field("Facility"))
    {
        returnStr += TaggedTextFromRaw(externalDF.GetFieldValue(recordWalker, 'Address'));
    }
}

return returnStr;


Reply With Quote
  #6  
Old November 26th, 2019, 05:24 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,549
Default Re: Ampersand in external data file

Quote:
Originally Posted by dml1280 View Post
Thanks but that didn't work.

It shows up fine in FusionPro but not in MarcomCentral.

It's not pulling the address and website.
Okay, well, I'm trying to diagnose this through a keyhole, with no actual files to examine.

I'm assuming that the XDF itself is the same in both the local composition and the online MarcomCentral composition, and that it's the primary data file that's different, as it's being generated as tagged markup by MarcomCentral.

So you might need to do this to match up the tagged value in the main data file with the value in the XDF:
Code:
for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
    if (TaggedTextFromRaw(externalDF.GetFieldValue(recordWalker, 'Facility')) == TaggedDataField("Facility"))
    {
        returnStr += externalDF.GetFieldValue(recordWalker, 'Facility');
    }
}
Or, more succinctly:
Code:
for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
    var val = externalDF.GetFieldValue(recordWalker, 'Facility');
    if (TaggedTextFromRaw(val) == TaggedDataField("Facility"))
        returnStr += val;
}
Whether you want to call TaggedTextFromRaw on the value you're appending to the return string depends on whether the rule itself is returning tagged markup.
Quote:
Originally Posted by dml1280 View Post


Not sure what you're trying to show here; I don't see anything. I think you need to make the pictures publicly accessible, or upload them here.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #7  
Old November 27th, 2019, 02:32 PM
dml1280 dml1280 is offline
Junior Community Member
 
Join Date: Apr 2016
Posts: 19
Default Re: Ampersand in external data file

I am sorry, I thought I had sent the files previously. Attached here. I also included in the package the screenshots I tried to post.

It shows that the code works in FusionPro but doesn't work once up on MarcomCentral.

Archive.zip

Thank you so much.
Reply With Quote
  #8  
Old December 2nd, 2019, 03:07 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,549
Default Re: Ampersand in external data file

Quote:
Originally Posted by dml1280 View Post
I am sorry, I thought I had sent the files previously. Attached here. I also included in the package the screenshots I tried to post.

It shows that the code works in FusionPro but doesn't work once up on MarcomCentral.
Okay, thanks. What I suggested in my previous post should work. Did you try that?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #9  
Old December 2nd, 2019, 04:26 PM
dml1280 dml1280 is offline
Junior Community Member
 
Join Date: Apr 2016
Posts: 19
Default Re: Ampersand in external data file

No, I still can't get it to work.

I also checked in MarcomCentral to make sure I have the file linked correctly and that the drop down list is exact.

I even tested the settings by changing one of the facilities on the drop down to use "and" instead of "&" and it worked...so it's definitely the tagged text.

Did you see the file I attached? Did I place the code correctly?

Otherwise I will just have to bite the bullet and forget about using the "&" and hopefully I won't run into consistency issues.

Thanks,
Dena
Reply With Quote
  #10  
Old December 3rd, 2019, 12:00 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,549
Default Re: Ampersand in external data file

Quote:
Originally Posted by dml1280 View Post
No, I still can't get it to work.

I also checked in MarcomCentral to make sure I have the file linked correctly and that the drop down list is exact.

I even tested the settings by changing one of the facilities on the drop down to use "and" instead of "&" and it worked...so it's definitely the tagged text.

Did you see the file I attached? Did I place the code correctly?

Otherwise I will just have to bite the bullet and forget about using the "&" and hopefully I won't run into consistency issues.

Thanks,
Dena
Well, first of all, there's a reason why I always suggest that MarcomCentral-specific issues get posted to the MarcomCentral-specific sub-forum, rather than to the general FusionPro forum, because people who know more about MarcomCentral (the application) than I do answer questions there.

What I don't know specifically here is exactly what MarcomCentral is putting into the XML (tagged markup) data file that it's generating based on the user input into the web form, which is then presented to FusionPro as the input data file. The easiest way find this out is to ask your MarcomCentral Support person; the next easiest is to post on that MarcomCentral-specific sub-forum.

The thing is, there are multiple ways in which MarcomCentral could be representing the value in that XML data file, all of which are valid, and we don't know for sure which one it's using. So, without knowing exactly what's in that data file, it's hard to know what we're trying to match.

It might work better to use NormalizeEntities rather than TaggedTextFromRaw. There are some subtle differences in how those two functions handle spaces after entities. Again, it all depends on how MarcomCentral is generating the data on its end.

Or, maybe the right answer here is to use UntaggedDataField, and compare that to the XDF value directly, like so:
Code:
for (recordWalker=1; recordWalker <= numRecsExtDF; recordWalker++)
{
    var val = externalDF.GetFieldValue(recordWalker, 'Facility');
    if (val == UntaggedDataField("Facility"))
        returnStr += externalDF.GetFieldValue(recordWalker, 'Address');
}
In which case you probably want to UNcheck the "Treat returned strings as tagged text" box in your rule, and remove all other calls to TaggedTextFromRaw.

That will probably work, regardless of how MarcomCentral is encoding the data.

Also, the whole rule can be simplified quite a bit, to just this:
Code:
var XDF = new ExternalDataFileEx('PHFacilities_Data_PTI.txt');
if (!XDF.valid)
    return 'Failed to link to the external data file';

var rec = XDF.FindRecord("Facility", UntaggedDataField("Facility"));
return XDF.GetFieldValue(rec, 'Address');
You can put the call to new ExternalDataFileEx in as many rules as you need; in later versions of FusionPro (9.3 and newer), external data files are cached, so that calling new ExternalDataFileEx on a file you've already opened incurs no penalty. Also, note the use of the FindRecord function instead of iterating all the records yourself in the code.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:49 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.