#1
|
|||
|
|||
![]()
I picked this rule in a post from 2013. What am I missing? The Labels (Office, Direct, Cell) still appear when the cell is empty. I should also add that I need to labels for each a particular font and color, and the actual phone numbers a separate font and color. I'll upload my csv file and a jpg image to show.
var numbers = ["Office: " + Field("Office"),"Direct: " + Field("Direct"),"Cell: " + Field("cell")]; return numbers.filter(function(s){return s.length>4;}).join(" ");
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. Last edited by Fletch; March 15th, 2022 at 07:28 AM.. |
#2
|
|||
|
|||
![]()
It will not let me attach the xlsx or csv file.
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. |
#3
|
||||
|
||||
![]()
It's not working because you are filtering on the length being greater than 4. Your shortest length is "Cell: " which is 6.
Anyways, that wont work with the formatting you want. Give this a shot: Code:
function format_phone(prefix, phone_num) { if (phone_num) return '<span color="Red">' + prefix + ": " + '</span><span color="Blue">' + phone_num + '</span>'; else return false; } var numbers = [format_phone("Office", Field("Office")), format_phone("Direct", Field("Direct")), format_phone("Cell", Field("Cell"))]; return numbers.filter(Boolean).join(" "); Edit: The forums turned my "& # 32;" into a space (without the spaces between them). You will need to use that entity instead of a literal space character in the join(" ") Last edited by ThomasLewis; March 15th, 2022 at 10:58 AM.. |
#4
|
|||
|
|||
![]()
That worked like a charm. I tweaked it a bit for the proper colors and to add a space between the numbers.
I also duped a section to add a extension to the Office number. I need the 'ext' to be black as well as the actual extension number, and a '.' after the ext instead of a ':' colon. Can that be done? (Code below) function format_phone(prefix, phone_num) { if (phone_num) return '<span color="PANTONE BLUE 072 U">' + prefix + ": " + '</span><span color="Black">' + phone_num + '</span>'; else return false; } var numbers = [format_phone("<b> Office</b>", Field("Office")), format_phone("<b> ext</b>", Field("Ext")), format_phone("<b> Direct</b>", Field("Direct")), format_phone("<b> Cell</b>", Field("Cell"))]; return numbers.filter(Boolean).join(" ");
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. |
#5
|
||||
|
||||
![]() Quote:
Code:
function format_phone(prefix, phone_num) { if (!Field(phone_num)) return ""; var endsWithDot = prefix.match(/\.$/); var result = '<span bold=true'; if (!endsWithDot) result += ' color="PANTONE BLUE 072 U"'; result +='>' + prefix; if (!endsWithDot) result += ":"; result += " " + '</span>' + Field(phone_num); return result; } var numbers = { Office: "Office", "ext.": "Ext", Direct: "Direct", Cell: "Cell" }; var result = []; for (var label in numbers) result.push(format_phone(label, numbers[label])); return result.filter(String).join(" \n");
__________________
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)}); ![]() |
#6
|
|||
|
|||
![]()
That codes works perfectly! I do need one adjustment. I need the 'ext.' to be not bold.
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. |
#7
|
||||
|
||||
![]() Quote:
Code:
function format_phone(prefix, phone_num) { if (!Field(phone_num)) return ""; var endsWithDot = prefix.match(/\.$/); var result = '<span'; if (!endsWithDot) result += ' bold=true color="PANTONE BLUE 072 U"'; result +='>' + prefix; if (!endsWithDot) result += ":"; result += " " + '</span>' + Field(phone_num); return result; } var numbers = { Office: "Office", "ext.": "Ext", Direct: "Direct", Cell: "Cell" }; var result = []; for (var label in numbers) result.push(format_phone(label, numbers[label])); return result.filter(String).join(" \n");
__________________
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)}); ![]() |
#8
|
|||
|
|||
![]()
Dan, thanks a million. I truly am grateful. For some reason, the 'ext.' is still Bold. I've examined the code to see if I could possibly figure it out and it's not really jumping out at me. So sorry. Can you adjust the code for the 'ext.' to not be bold?
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. |
#9
|
||||
|
||||
![]()
Hmm, it works for me. Though I don't have your job files, so I had to change the field names and use a different test job. Are you sure you have the exact code I posted? Anyway, there's nothing I can do to diagnose what's happening in your specific job without the files.
__________________
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)}); ![]() |
#10
|
|||
|
|||
![]()
I found my mistake. I had duped the original Rule you sent, to create the second Rule, but forgot to swap the Rules in the Text Frame. It works perfectly. Again, many thanks.
__________________
Using FusionPro Desktop 12.1.3 on Widows 10 Pro i7-8700 CPU, 3.2 Ghz with 16GBRam. Acrobat DC (the Cloud) Also Running FusionPro Producer on a Windows 7 Professional Virtual Machine. |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|