Armando Pena Posted August 2, 2016 Share Posted August 2, 2016 I need to create a rule that will remove a checkbox graphic if there is no content in that line, I have attached a screen shot. The user will select wether they have product_2 & product_3. Any help would be greatly appreciate it. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted August 2, 2016 Share Posted August 2, 2016 You don't actually need a rule at all. You can simply select all of those lines in the Text Editor, click Paragraph, check the "Suppress if" box, and select "Containing Empty Variables." That said, if you really want to write a rule, then instead of looking at this in a substractive way, i.e. trying to remove things when other things are not there, I would look at it in an additive way, and only actually output something when appropriate. Something like this: var graphic = '<graphic file="yourFile.jpg" height=1000>'; var result = ""; for (var i = 1; i <= 3; i++) { var fieldValue = Field("Product " + i); if (fieldValue) result += graphic + "<t>" + fieldValue + "<p>\n"; } return result; or: var graphic = '<graphic file="yourFile.jpg" height=1000>'; var result = []; for (var i = 1; i <= 3; i++) { var fieldValue = Field("Product " + i); if (fieldValue) result.push(graphic + "<t>" + fieldValue); } return result.join("<p>\n"); Or, if you want to be a bit more JavaScript-y: var graphic = '<graphic file="yourFile.jpg" height=1000>'; var result = []; for (var i = 1; i <= 3; i++) result.push(Field("Product " + i)); return result.filter(String).map(function(e){return graphic + "<t>" + e;}).join("<p>\n"); 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.