10 Replies Latest reply on Dec 10, 2009 4:12 PM by MB321

    Omit merge field in label when it is empty

    MB321

      Title

      Omit merge field in label when it is empty

      Post

      Filemaker Pro 10 running on 10.4.11

      I have an address label layout that shows "Home Address 1" and "Home Address 2" as merge fields on separate lines of the label. If a record has no "Home Address 2" the label prints a blank line.  How do I correct this?  In Access there was a grow/shrink option for fields.  I can't find anything similar in FM. 

        • 1. Re: Omit merge field in label when it is empty
          Steve Wright
            

          I take it you are formatting the merge field as

           

          Home Address 1¶

          Home Address 2¶

          Etc. Etc

           

          Instead use

           

          Case(

          not isempty(Home Address 1) ; Home Address 1&"¶" ;

          not isempty(Home Address 2) ; Home Address 2&"¶" ;

          etc....

          not isempty(Home Address 4) ; Home Address 4

          )

           

           

          I think thats formatted correctly.... 

          • 2. Re: Omit merge field in label when it is empty
            comment_1
              

            See:

            http://www.filemaker.com/help/html/create_layout.9.46.html#1030089

             

             

            Note:

            Don't put both your merge fields in the same text object, separated by a carriage return. Use two text objects, each containing a single merge fields.

            • 3. Re: Omit merge field in label when it is empty
              Steve Wright
                

              Both cases are valid, depending on what you require as the final output.

               

              There are reasons where sliding and/or individual fields are in-appropriate.

               

              We use a single unstored calculation to populate based on a template chosen by the user.

              For example, we have a single field which contains a letter, this can be fully customised by the end user such as

               

              SOME RANDOM TEXT

               

              {name}

              {address}

              {address2}

               

              Dear {name}

               

              Thank you for your interest in {product}

               

               

               

              This gives the end user control over positioning of the fields within their document template..

              In this scenario we use something similar to the above example to remove any blank lines from the final output, altough more care is taken to check if the {mergefield} is used in a paragraph etc, but its just an example.

               

              If using a preset layout with sliding as you suggest, the layout then becomes hindered by what you design, not what the end user wants.

              Also, it does not solve the issue when sending the information by email for example, since you wont use a layout for this.

               

              Edit: Used incorrect tags for [code]

              • 4. Re: Omit merge field in label when it is empty
                MB321
                  

                Still confused!  I set up the address label as follows using the label setup assistant:

                 

                <<First Name>> <<Last Name>>

                <<Company>>

                <<Home Address 1>>

                <<Home Address 2>>

                <<City>>, <<Country>>  <<Postal Code>> 

                 

                Can you tell me specifically what to do with this?  I've tried as best I can to follow the submitted advice and only got further confused!  For example, I found a document below that needs clarification:

                 

                "Placing merge fields on a layout"

                Use merge fields to combine field data and text in documents like form letters, labels, envelopes, or contracts. You create merge fields in text blocks, which allows you to use static text and field data together.
                Merge fields shrink or expand to fit the amount of text in the field for each record. For example:
                  •
                When the merge field <<First Name>> is between the text Dear and a colon (as in Dear <<First Name>>:), FileMaker Pro displays Dear Charles: in Browse mode or Preview mode if the First Name field contains Charles.
                  •
                When a merge field is on a line by itself and the field contains no data (such as an empty Address Line 2 field in a mailing label), FileMaker Pro removes the blank line from the text block, which improves the appearance of the text.

                Note  In Browse mode, you cannot enter or edit data in merge fields. For entering data, use a different layout that contains regular fields that permit data entry." 

                 

                So why isn't  it doing what it's supposed to do? 

                 

                Thanks!  I am using a Trial of Filemaker Pro 10 with the intention of converting my MS Access database if I can get the hang of things.  

                • 5. Re: Omit merge field in label when it is empty
                  Steve Wright
                    

                  In this case, use the method described by comment.

                   

                  1. Dont use merge fields, instead add the actual fields to the layout.

                  2. Then select the fields and goto Format > Set Sliding/Printing

                  3. next choose Sliding Left

                  4. Followed by Sliding up based on - All of the above

                  5. You may not want to reduce the size of the enclosing part, so ensure this is unticked

                   

                  The sliding will not show up in browse mode, only in Preview Mode or when printed, so to see the effect go to

                  View > Preview Mode

                   

                  If no FirstName exists, Lastname will slide left

                  If No Company is entered, Home Address 1 will slide up.

                   

                   

                  • 6. Re: Omit merge field in label when it is empty
                    comment_1
                      

                    MB321 wrote:
                    So why isn't  it doing what it's supposed to do?

                    Shrinking will not remove a blank line if it is the last line of the text block. For example a text block containing:

                     

                    ---

                    <<First Name>> <<Last Name>>

                    <<Home Address 1>>

                    <<Home Address 2>>

                    <<City>>

                    ---

                     

                    will look like this if there is no Home Address 2:

                     

                    ---

                    John Doe

                    1 First Ave.

                    Anytown

                    ---

                     

                    but if the City field is empty; it will look like this:

                     

                    ---

                    John Doe

                    1 First Ave.

                    Suite 8

                     

                    ---

                     


                    • 7. Re: Omit merge field in label when it is empty
                      MB321
                         I think you don't get what I am saying....I am only concerned that a blank line shows when Home Address 2 is empty.  That doesn't meet your examples.  Sorry.  Thanks anyway!
                      • 8. Re: Omit merge field in label when it is empty
                        comment_1
                          

                        If 'Home Address 2' is empty AND 'City' is NOT empty, it should work as advertised. If you see something else, please provide a description detailed enough to recreate the problem.

                         

                        ---

                        Also make sure the line contains the merge field alone, and nothing else. Even a space will cause the line to render.

                        • 9. Re: Omit merge field in label when it is empty
                          philmodjunk
                             Likewise, an invisible character such as a space or a return stored in your field can result in a field that looks empty but isn't.
                          • 10. Re: Omit merge field in label when it is empty
                            MB321
                              

                            A HUGE thank you to both you and Comment!  I had inadvertently created an invisible space that was the culprit.  I have not learned not to try to move text within the text box, but to move the text box itself!

                             

                            I thing I made something quite easy very difficult!!