Jump to content

Tags in rules affecting suppress???


Ryan_B

Recommended Posts

I have a rule that uses a couple of different tags. Also within this rule I have a couple of <br>'s. My question is: If I have <br>'s in a rule, will Suppress if containing... still work?

 

This is my rule:

return '<z newsize="9.94">' + ToUpper(Rule("RULE 1st address comma")) + '<br/>' + 
ToUpper(Field("1stCity")) + ", " + Field("1stState") + " " + Field("1stZipcode") + 
'<br/>' + '<f name="Gotham Medium">' + '<z newsize="12.94"/>' + Rule("RULE 1st phone");

 

Surely you can suppress a rule, right? I don't feel like I've run in to this problem in the past. Thanks for the help.

Link to comment
Share on other sites

I don't understand why you've created a rule to return other rules with formatting. Why not just put your rules into the text editor and apply the formatting there rather than with tags?

 

Regardless, I'm always weary about returning tags if they aren't tagging anything for this very reason. If you really want to format the text via tags as opposed to the rules themselves or the text editor (as I previously mentioned), one thing you could do is check that your rule is not just entirely tags by slightly modifying your code to be:

[color="Red"]var result = [/color]'<z newsize="9.94">' + ToUpper(Rule("RULE 1st address comma")) + '<br/>' + 
   ToUpper(Field("1stCity")) + ", " + Field("1stState") + " " + Field("1stZipcode") + 
   '<br/>' + '<f name="Gotham Medium">' + '<z newsize="12.94"/>' + Rule("RULE 1st phone");
[color="red"]return (Trim(RawTextFromTagged(result)) != ',') ? result : '';[/color]

Link to comment
Share on other sites

I think the reason I created one big rule was to keep my text frame from getting too convoluted. Rather than have three lines of code, I reduced it to one.

In the end, I figured out why it wasn't suppressing. I wasn't checking the condition of anything, I was just returning something. In this case, even though the variables were empty, I was still returning tagged text. I believe the <br>'s were keeping FP from seeing it as actually empty? Therefore it wasn't getting suppressed? To fix it, I simply checked to see if the field was empty or not. If it wasn't, return my code block. If it was, return nothing. Thanks Step for helping me out.

Link to comment
Share on other sites

As its presence in the Paragraph Formatting dialog suggests, the "Suppress if empty" setting applies to the entire paragraph. When you use a <br> tag, that's a "soft return," which forces a line break, but doesn't actually end the paragraph. (You can see this if you set something like a first line indent, or space above the paragraph. The <br> tag doesn't trigger either of those, because it's not actually starting a new paragraph.)

 

I think what will make your rule work is to use <p> tags instead of <br> tags, so that each line actually is a separate paragraph, which will be suppressed as appropriate.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...