ReneTamol Posted March 15, 2017 Share Posted March 15, 2017 Hello everyone, I hope someone can help me... I have a Rule that's been working great for several projects, but my new project has a field that wants a "Heart" to print when this field is being used. ///////////// Here is my rule: //////////////// var result = ""; result += (Field("CLASSIFICATION 2") != "")? "<f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("CLASSIFICATION 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("CLASSIFICATION 2")+ "</f></leading>\n" : ""; result += (Field("PRESENTED TO 2") != "")? "<br><f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("PRESENTED TO 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("PRESENTED TO 2") + "</f></leading>\n" : ""; result += (Field("TITLE 2") != "")? "<br><f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("TITLE 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("TITLE 2") + "</f></leading>\n" : ""; result += (Field("CUSTOMER 2") != "")? "<br><f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("CUSTOMER 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("CUSTOMER 2") + "</f></leading>\n" : ""; result += (Field("DESIGNER 2") != "")? "<br><f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("DESIGNER 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("DESIGNER 2") + "</f></leading>\n" : ""; result += (Field("AGENCY 2") != "")? "<br><f name=\"TradeGothic Light\"><z newsize=\"6\">" + ToUpper(Field("AGENCY 1")) + "</f><br />\n" + "<leading newsize=\"105\"><f name=\"Weiss\"><z newsize=\"9\">"+ Field("AGENCY 2") + "</f></leading>\n" : ""; return result; Under the TITLE 2, "YesVirginia.org Virginia ♥ Pocket Folder" appears and I don't know how to make the "Heart" visible. Any thoughts on how I can edit this rule to make the heart print correctly? Or is there something I need to add or change in the Data? Thank you for any help or suggestions, Rene Quote Link to comment Share on other sites More sharing options...
step Posted March 15, 2017 Share Posted March 15, 2017 Are you trying to use the heart as a character or as an inline graphic? If you're using a character, one way to do it would be to print the decimal code for the heart character in "Zapf Dingbats": return 'YesVirginia.org Virginia <span font="Zapf Dingbats">[font="Courier New"]&[/font]#9829;</span> Pocket Folder'; Or you could create a text resource that returns the heart in a font that supports that character. By the way, you could also simplify your code a little by using an array: var heart = '<span font="Zapf Dingbats">[font="Courier New"]&[/font]#9829;</span>'; var result = ['CLASSIFICATION','PRESENTED TO','TITLE','CUSTOMER','DESIGNER','AGENCY'] .map(function(s){ if (Field(s + ' 2')) return '<f name="TradeGothic Light"><z newsize="6">' + ToUpper(Field(s + ' 1')) + '</f><br>' + '<leading newsize="105"><f name="Weiss"><z newsize="9">' + Field(s + ' 2') + '</f></leading>'; }).filter(Boolean); result.push('YesVirginia.org Virginia ' + heart + ' Pocket Folder'); return result.join('<br>'); Quote Link to comment Share on other sites More sharing options...
ReneTamol Posted March 15, 2017 Author Share Posted March 15, 2017 You are awesome, my friend... Thank you for the feedback. I will try this as soon as I have a few minutes today. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.