|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello, I am new and jumping in head first per usual.
I am working on an invite for a client and that will allow them to have multiple sub events (reception, dinner, lecture, movie, etc.) under the date of the main event on the invitation. They are required to enter one and at maximum allowed to have four. The sub events are broken in a 1 | 2 & 3 | 4 format. Format Example: Event 1 00:00 p.m. | Event 2 00:00 p.m. Event 3 00:00 p.m. | Event 4 00:00 p.m. *note two spaces on either side of pipeline (|) FusionPro Rules Code:
if (Field("Event1_title") != "" && Field("Event2_title") != "") return Field("Event1_title") + ' ' + Field("Event1_time") + ' ' + Field("Event1_ap") + ' ' + ' | ' + ' ' + Field("Event2_title") + ' ' + Field("Event2_time") + ' ' + Field("Event2_ap"); else if (Field("Event1_title") != "" && Field("Event2_title") == "") return Field("Event1_title") + ' ' + Field("Event1_time") + ' ' + Field("Event1_ap"); else if (Field("Event1_title") == "" && Field("Event2_title") != "") return Field("Event2_title") + ' ' + Field("Event2_time") + ' ' + Field("Event2_ap"); else return ''; Code:
if (Field("Event3_title") != "" && Field("Event4_title") != "") return Field("Event3_title") + ' ' + Field("Event3_time") + ' ' + Field("Event3_ap") + ' ' + ' | ' + ' ' + Field("Event4_title") + ' ' + Field("Event4_time") + ' ' + Field("Event4_ap"); else if (Field("Event3_title") != "" && Field("Event4_title") == "") return Field("Event3_title") + ' ' + Field("Event3_time") + ' ' + Field("Event3_ap"); else if (Field("Event3_title") == "" && Field("Event4_title") != "") return Field("Event4_title") + ' ' + Field("Event4_time") + ' ' + Field("Event4_ap"); else return ''; ![]() It works and I'm not receiving any errors, but it's loosing my double spacing on either side of my pipeline in just the first rule only on MC and I can't figure out why. Validating the code in FP gives me the correct output and the second rule is formatting correctly. You can see that I have already attempting appending the second space separately to see if that fixed it. Any thoughts? |
#2
|
||||
|
||||
![]()
Look at the "Treat returned strings as tagged text" box in both rules. I'll bet it's checked in one and not the other. When dealing with tagged markup, multiple spaces, tabs, and newlines are collapsed by FusionPro's tagged markup parser.
If this were just a Desktop/Creator job, you would probably want to have that box UNchecked in both rules, since there are no actual markup tags involved. However, you need to be careful, because MarcomCentral will generate a tagged markup data file, and some characters (ampersands, quotes, and angle brackets) will be represented with entities, so you need to account for that possibility. The way to do this is to check the box, and call the TaggedDataField function instead of Field. But when you have that box checked, you're back to the same problem with losing the multiple spaces, so also need to convert those to markup; fortunately, the TaggedTextFromRaw function will do this for you. Therefore, the ultimate solution to handle anything that MarcomCentral may throw at you is to check the box in both rules and use this rule syntax (with a couple of other changes to reduce the amount of repetitive code): Code:
return [TaggedDataField("Event1_title"),TaggedDataField("Event2_title")].filter(String).join(TaggedTextFromRaw(" | "));
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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)}); ![]() |
#3
|
|||
|
|||
![]()
@ Dan Korn
Thanks for your fast response, my rules are already set to "treat returned strings as tagged text". The only issue I am having with my existing code is that the double spaces are not correct in output. I am attempting to understand your code suggestion but it looks like it will return a line without my variables for time and am/pm designation. I am unfamiliar with the TaggedDataField function and do not know what arguments are allowed. If I used your code as provided my MC jpg sample would read: Sing Along | Snacks Is there a way to use the TaggedTextFromRaw a more expanded code that gives me the correct formatting of multiple appended variable fields? |
#4
|
||||
|
||||
![]() Quote:
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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)}); ![]() |
#5
|
|||
|
|||
![]()
@Dan Korn
Unfortunately my manager has informed me that the nondisclosure agreement with our client will prevent me from uploading their templates for your review. I have a theory I'm willing to test if you can confirm that the TaggedTextFromRaw function behaves like the HTML <pre> tag? Maybe I can stick it in where I'm appending my string of ' | ' in my original code. |
#6
|
||||
|
||||
![]() Quote:
Quote:
Sure, you can try that.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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)}); ![]() |
#7
|
|||
|
|||
![]()
@Dan Korn
So the following code…totally worked. I can in no way explain why; but now my event times are all displaying correctly. I can also not explain why the second rule continues to work without modification. Thank you for alerting me to the TaggedTextFromRaw function for this instance. Code:
if (Field("Event1_title") != "" && Field("Event2_title") != "") return Field("Event1_title") + ' ' + Field("Event1_time") + ' ' + Field("Event1_ap") + TaggedTextFromRaw(" | ") + Field("Event2_title") + ' ' + Field("Event2_time") + ' ' + Field("Event2_ap"); else if (Field("Event1_title") != "" && Field("Event2_title") == "") return Field("Event1_title") + ' ' + Field("Event1_time") + ' ' + Field("Event1_ap"); else if (Field("Event1_title") == "" && Field("Event2_title") != "") return Field("Event2_title") + ' ' + Field("Event2_time") + ' ' + Field("Event2_ap"); else return ''; |
![]() |
Tags |
javascript, rule, text formatting |
Thread Tools | Search this Thread |
Display Modes | |
|
|