9 Replies Latest reply on Mar 10, 2010 11:20 AM by Steve Wright

    Script to print/don't print button?

    LeoB

      Title

      Script to print/don't print button?

      Post

      On a list/report layout I have some icons inserted (up/down arrows) adjacent to headers to sort records.  Works fine.

       

      Currently I have the icons set to not print, but now I would like to figure out how to make one of them print if the records are sorted in that direction.

       

      I already have the headers scripted and with conditional formatting to highlight which column is the one sorted in the print, but for the two columns with up/down arrows I would like it to print the arrow to let the user know in which direction the report is sorted.

       

      I can't find anything in scripting that's a print option that would apply to an object.

       

      Anybody have any ideas?

        • 1. Re: Script to print/don't print button?
          Steve Wright

          Its not something I have had to do so bear with me on this...

          What I would try is to have layered text objects using conditional formatting based on a variable.

           

          If you sort column 1 ascending, set a variable to $$sort = "column1A"

          Likewise if you sort column 2 descending, set a variable $$sort = "column2D"

           

          Then use something like : ∇   (downward text based arrow if it doesnt display) to show how the record is sorted.

           

          On each of the text objects / arrows add conditional formatting to reflect the variable, so for instance...

          $$sort <> "column1a"   - apply text size formatting to make it 500px thus hiding the text

           

          For each column you would have two text objects 1 for ascending, 1 for descending

           

          Because the text size is being set to 500px if the variable doesn't match, it will expand outside of the boundaries for the text object and disapear.

           

          I hope something I have wrote above makes sense :-P  Its been a long day....

          There may be an easier way, but that one springs to mind.

          • 2. Re: Script to print/don't print button?
            philmodjunk

            You can also hide text by making it the same color as your layout background.

            • 3. Re: Script to print/don't print button?
              LeoB

              I've already done that with other functions.  The problem is that I want to use arrows to show up/down (for spacing), and I can't find any way to create an arrow in text.  I installed Symbol and Wingding fonts, but can't figure out how to get to the character map to select one.

               

              I've tried importing text symbols from other programs, but without success.

               

              Thanks.

              • 4. Re: Script to print/don't print button?
                JoshO.

                For this type of thing...I typically use calculations (result type container).  You should be able to stack 2 fields, one that prints, one that doesn't.  Have the calculations determine which field displays what image (arrow) and when.

                 

                You can store the various graphics in a global repeating field...and then use them in the above calculations.

                • 5. Re: Script to print/don't print button?
                  LeoB

                  Josh:

                   

                  Well, I figured it could be done.  But since I've never used calculations, this is going to get complicated.  I haven't yet found any type of basic guideline/primer on how to do calculations.

                   

                  Thanks.

                  • 6. Re: Script to print/don't print button?
                    JoshO.

                    If you can write out in words what you need to do...someone on the forum should be able to translate that into a calculation.

                     

                     

                    Something like:

                    "When Table1::SortState is either 'this' or 'that, then use the graphic in the first repetition of Graphics::SortArrows...if not then use repetition 2."

                     

                    The calc would be something similar to:

                    Case ( 

                    Table1::SortState = "this"; GetRepetition ( Graphics::SortArrows ; 1 ) ;

                    Table1::SortState = "that"; GetRepetition ( Graphics::SortArrows ; 1 ) ;

                    IsEmpty ( Table1::SortState ) ; "" ) ;

                    GetRepetition ( Table1::SortState ; 2 )

                    )

                    • 7. Re: Script to print/don't print button?
                      Greg123

                      Hi Leo B

                      It sounds to me like you could just make a layout with the icon set to print for each sort and in your script tell it which layout to use based on how it is sorted.

                       

                      What jmormond suggested will work as well but you might find just "go to layout" easier to deal with

                      • 8. Re: Script to print/don't print button?
                        philmodjunk

                        "I installed Symbol and Wingding fonts, but can't figure out how to get to the character map to select one."

                         

                        For this, I open a word processor that can access the charactere map, select the character and then copy/paste it to filemaker.

                        • 9. Re: Script to print/don't print button?
                          Steve Wright

                          For me, I open charmap.exe on windows  or show character viewer on mac, both of these allow you to copy / paste and browse each character easily.