Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Extra Page Only If Necessary (2003 / 2007)

    Good evening.

    Is there a way to format a page within a multi-page document such that the page will print only if there is actual text to populate it?

    I have an existing two-page document, both pages of which contain "hard" text. I added a third page, on which I inserted field codes - not formulas, but individual field codes with IF / THEN instructions added in. These codes will cause customized "Warning" message text to print if the the corresponding field is not populated with the appropriate character, but will print nothing if the field is filled n appropriately. There is no actual text on this page - just the bookmarked field code information..

    Configured thus, the document prints as three pages if the required data entry was not performed. The third page contains the "Warning" text.

    If the required data entry is performed, a blank third page is generated. This occurs regardless of whether I make the "Warning" page the first page or the third page. Ideally, I would like to have this page be the first page, so that when applicable, the "Warning" page will be on top.

    Is it possible to have this third page print only if it is necessary - when the required data entry is not performed, and there is actual data being pulled and printed from the designated field codes?

    Thank you.

    Kevin

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    You can include a manual page break (Ctrl+Enter) within field codes, so you could place a page break in the IF part or in the ELSE part of an IF field:
    <code>
    { IF condition "Warning Text---Page Break---" "" }
    </code>
    where <code>---Page Break---</code> stands for a manual page break

  3. #3
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    I added the page break, but the blank page still prints (when a "1" is entered ion the program field). Would you mind taking a look at the field code to see if I placed the page break appropriately? I have attached a document with the code inserted. Thank you.

    Kevin
    Attached Files Attached Files

  4. #4
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    I have combined the two IF statements & I believe the attached will do what you want. As you are only testing for one thing, PNT_9950 equaling "1", there really isn't a need to have the second IF statement.

    Regards,

    Matthew
    Attached Files Attached Files

  5. #5
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Well, the second IF statement instructs the code to print nothing if the program field contains "1", so it is important to the mission at hand. Without it, the document is populated with "1", which is not desired.

    I am attempting to get the following result: When "1" is entered in field PNT_9950 and nothing prints on the document (which I have accomplished), the page on which the PNT_9950 code has been inserted will not print. The only instance in which that page would print would be when field PNT_9950 did not contain "1".

    Thank you very much for your suggestion, though.

    Kevin

  6. #6
    Star Lounger
    Join Date
    May 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Kevin,

    The IF statement has both a true & false section. If the PNT_9950 field does NOT equal "1" it prints the warning text. If PNT_9950 field has any other value (i.e. the IF statement is FALSE), a page break and the PNT_9950 field is inserted.

    Maybe that's not you are aiming for. I might have the IF around the wrong way. If that is the case you could simply change the IF statement sign from <> to = . IF «PNT_9950» <font color=red>=</font color=red> "1"

    Regards

    Matthew

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Try the attached version. Like that posted by Matthew, it has only one IF field.
    Attached Files Attached Files

  8. #8
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Matthew and Hans -

    Here is what I have determined (in case you are interested):

    Hans, your first suggestion does actually work. I was still getting the unwanted blank page (when PNT_9950 equaled "1") because I had page numbers inserted on the document. Once they were removed, the document "behaved" as instructed in both scenarios - When PNT 9950 = "1", no page was generated. When PNT 9950 did not = "1", the error message printed on a third page.

    The modified document version you offered also works as desired, though I do not understand how, since you removed the instruction to print nothing if PNT 99950 does equal 1.

    Matthew, your version did generate the warning message when appropriate, but also populated the document with a "1" when PNT 99950 = "1" Which is what I expected, since you removed the second IF statement. However, yours looks just like Hans'. So I am not sure how and why these things are working, or not.

    Regardless, you have proved a solution. Thank you very much.

    May I prevail upon either or both of you for one more step? I need to accommodate two or three different field entry errors or omissions. So I would need to have two or three field codes (modified as you have suggested), on the same page. The problem is. the page breaks push each successive error message onto a new page, as would be expected. So potentially, three extra pages would be generated.

    Could I format some other way, so as to allow two or three error messages to print on a single page?

    Thank you for your time and attention to detail.

    Kevin

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    The field code that I used looks like this:

    <div style="width: 100%; background-color: #FFFFFF;">{ IF { MERGEFIELD PNT_9950 } <> "1" <font color=red>"Warning blah blah<page break>"</font color=red> <font color=blue>""</font color=blue> }</div hiblock>
    If the merge field does NOT equal "1", the warning and page break is displayed (indicated in red above). Otherwise, i.e. if the merge field equals "1", only an empty string "" is displayed (indicated in blue above).

    The built-in help for IF and for COMPARE shows how to test for multiple conditions. You could do something like this:

    { IF { MERGEFIELD PNT_9950 } <> "1" "Warning number 1<paragraph break>" ""}{ IF { MERGEFIELD This } <> "37" "Warning number 2<paragraph break>" ""}{ IF { MERGEFIELD That } <> "A" "Warning number 3
    " ""}{ IF { = OR ( { COMPARE { MERGEFIELD PNT_9950 } <> "1" }, { COMPARE { MERGEFIELD This } <> "37" }, { COMPARE { MERGEFIELD That } <> "A" } ) } = 1 "<page break>" ""}

    Keep in mind that you should NEVER type the field braces { } yourself, always use Ctrl+F9 (or Insert | Field...) to create them.
    <paragraph break> and <page break> are meant to be replaced by real paragraph breaks (Enter) and page breaks (Ctrl+Enter).

  10. #10
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    OK. I will roll up my sleeves tomorrow and see what I can do. Thanks so much for the explantions and ideas.

    Kevin

  11. #11
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Hans -

    I don't use the term "genius" very often, except, of course, when referring to myself. (It's my humility that makes me better than other people.) However, I must say, once again, you found a way to make my almost-functional conception perfectly functional. The supplementary COMPARE code you provided produces the exact result needed. I could have plugged away at it for a week, but I would not have come up with that.

    The suggestions I have received from the Lounge have been enormously helpful, enabling me to accomplish things I would otherwise not been been able to do. I get some weird ideas, but do not possess the technical knowledge to bring them all to fruition. Please know that I appreciate all of the assistance I have received from such clever and knowledgeable people Thank you.

    Kevin

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    I'm glad you got it to work. Thank you for your kind words.

  13. #13
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    I have had success with this formula with various field code rule variations. But am encountering a problem I cannot account for. I had been installing it on documents with two WARNING rules each, and it worked perfectly. I had assumed that since two rules worked, any number of rules would, as well. However, the IF / COMPARE code seems to allow no more than two field code rule sets. Installation of any more seems to disconnect the preceding code rules (with the WARNING text) such that the WARNINGs will print with no page break separating them from the hard text on the document.

    I can find no logical reason for this behavior. The IF / COMPARE code seems as though it would allow for any number of rule sets. I have tried many variations, with no real solution or explanation. I did find a way to allow for more than two rule sets, but it causes either of a set of two WARNINGs grouped together to print on a separate page from any others. I can live with that, if there is no other way to arrange it. But I would prefer to have all WARNINGs on the same page.

    I have attached a document which I hope illustrates the situation clearly. I have included three examples and notes derived from my hours of trial and error, to help reduce your trouble shooting time. Example # 2 (name highlighted in green) is the one with which I am encountering the problem.

    Is there a reason that the addition of a third field code rule (or more) would sever the IF / COMPARE code from the rest?

    Could the variable near the end of the code be involved (the "= 1" part, ijust before the final <page break> in the example below)? I am not sure of its function. It may be moot, if the IF / COMPARE code is really severed by the additional rules.

    { IF { MERGEFIELD PNT_9950 } <> "1" "Warning number 1<paragraph break>" ""}{ IF { MERGEFIELD This } <> "37" "Warning number 2<paragraph break>" ""}{ IF { MERGEFIELD That } <> "A" "Warning number 3
    " ""}{ IF { = OR ( { COMPARE { MERGEFIELD PNT_9950 } <> "1" }, { COMPARE { MERGEFIELD This } <> "37" }, { COMPARE { MERGEFIELD That } <> "A" } ) } = 1 "<page break>" ""}

    Sorry to belabor the project. I am about to install these codes into the system, and just wanted to see if I could improve on my work-around (Example # 3 on the attachment) before I proceed.

    Thank you.

    Kevin
    Attached Files Attached Files

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    In addition to toggling the display of field codes, it probably would help to work in Normal View (Word 2003) or Draft View (Word 2007) so you can see where/how the page break is inserted in the IF field.

  15. #15
    Star Lounger
    Join Date
    Jun 2008
    Location
    Baltimore, Maryland, USA
    Posts
    90
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extra Page Only If Necessary (2003 / 2007)

    Agreed. I can see the page break location when Examples 1 and 3 on the attachment are Previewed. For some reason, when Example 2 is Previewed, the break is not placed on the document, and the WARNING text is not separated from the hard text. The only difference between Example 1 and Example 2 is that Example 2 has 4 field code rule sets (pardon the awkward terminology) instead of two. I don't see why that would matter.

    Thanks for the observation.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •