ksohayda Posted February 14, 2011 Share Posted February 14, 2011 Hi, I'm trying to set-up a variable postcard with bulleted copy. The bullets need to disappear if no copy is present in the field. However, my field has to have hard returns as well? Please see attached PDF for visual. I created two seperate varaible text boxes. One for the bullet and one for the varaiable field? Not sure if this is the way I should go? Also, I can't get the bullet to disappear. Not good at writing Javascript code. Here's a code I've been working on? if (Field("Treatment Center1") == "") return ""; else return '• '+Field("Treatment Center1"); if (Field("Treatment Center2") == "") return ""; else return '• '+Field("Treatment Center2"); if (Field("Treatment Center3") == "") return ""; else return '• '+Field("Treatment Center3"); if (Field("Treatment Center4") == "") return ""; else return '• '+Field("Treatment Center3"); Anyone out there that can help or give advice as to what to do?PostcardExample.pdf Link to comment Share on other sites More sharing options...
FreightTrain Posted March 30, 2011 Share Posted March 30, 2011 ksohayda, Here is an easier way to accomplish your bullet list: outstr = ""; for (item = 1; item < 9; item ++) //we are establishing the Loop where item loops thru each number less than 9 { itemName = "Treatment Center" + FormatNumber("0", item); //our field is Treatment Center1-8 we are formatting it based on whatever item is if (Len(Field(itemName)) > 0) //this is saying if the length is > 0 or could also be != "" { outstr += '<p>' +' • ' + Field(itemName); } } outstr += "<p>"; return outstr;Make sure that you have the "Treat return strings as tagged text" check box checked for the Rule. Hope this helps Link to comment Share on other sites More sharing options...
Dan Korn Posted March 30, 2011 Share Posted March 30, 2011 You don't need a rule at all. You can do this in the Variable Text Editor: on each line, type the bullet character and insert the field name variable. Then do a "Select All" (Ctrl-A), click the "Paragraph" button, check the "Suppress if" box, and change the drop-down to "Containing Empty Variables." Link to comment Share on other sites More sharing options...
dcb_creative Posted July 27, 2011 Share Posted July 27, 2011 Does this only work with a bullet character? I just tried it with a "»" character and it didn't work. Any help with that?? Link to comment Share on other sites More sharing options...
Dan Korn Posted July 28, 2011 Share Posted July 28, 2011 Does this only work with a bullet character? I just tried it with a "»" character and it didn't work. Any help with that?? Change line 11 to: outstr += '<p>' +' ⇒ ' + Field(itemName); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.