10 Replies Latest reply on Aug 27, 2013 10:56 AM by RickDearden

    Conditional formatting a picture

    RickDearden

      Title

      Conditional formatting a picture

      Post

           Hi all,

           I'm trying to get a picture, in this case an icon of a clock, to be conditionally formatted; so when a certain condition is true it'll display the picture and when it's not - it'll be invisible.

           The picture is to show at the end of a portal line to give me a more visual indication on how a old a quote is - one clock for one week, two clocks for 2 weeks, 3 for 3 weeks, etc. etc.. Upto 5 weeks...

           At the moment I'm using conditional formatting using text to give me a graphical space which has a background colour (see attachment for pic). The picture shows how I've done it using spaces. It'd just be a lot better to do this with a clock icon!

           The 'C' that's displayed is also another conditional format for 'Chase' which I'd like to change for a telephone icon..

           The 'GF' is a gut feeling for probibility it's going to convert to an order. I'd like to change that to a thumb icon... 

           What they're for isn't important I know but hopefully it'll give you an idea what I'm trying to achieve within this portal.

           Any help would be much appreciated!

           Cheers,

           Rick.

            

      Screen_Shot_2013-08-22_at_18.19.11.png

        • 1. Re: Conditional formatting a picture
          philmodjunk

               Conditional formatting only works with alphanumeric data, not images.

               But you could set up series of calculation fields with Container result types that display either Null or the contents of a different container field--such as a colored rectangle in a global field or a field in a related table's record. (This is how we produced conditional fill colors before FileMaker added conditional formatting and is still a useful technique with IWP layouts since IWP doesn't support conditional formatting.

          • 2. Re: Conditional formatting a picture
            RickDearden

                 Thanks Phil...

                 I think this is a bit beyond my abilities at the moment. Do you know anywhere there would be an example to download/etc?

                 If not - no problem - I'll try and make sense of it with a bit of research!

                 Rick.

            • 3. Re: Conditional formatting a picture
              RickDearden

                   Can I interprit this as follows....

                   1) Create a new table with three container fields (1 containing a clock icon, another with a phone icon and en empty one).

                   2) Create a relationship betwen my portal table and the new image container table

                   3) Create a new calculation field to do something like...

                   If

                     Get (CurrentDate) <= WhateverTable::QuoteDate +7

                   Then

                     WhateverTable::StarImage = WhateverTable::EmptyImage

                   Else

                    WhateverTable::StarImage = WhateverTable::StarImage

                   ---

                   How does something like that look?

                   Rick.

              • 4. Re: Conditional formatting a picture
                philmodjunk

                     It's actually not that difficult to set up.

                     Here's how to get the first colored rectangle to appear.

                     Define a container field in your system and specify global storage. I'll assume that it's named Globals::gFirstColor. Put it on a layout somewhere. (Can be any layout and you can remove it from the layout after we load it with the needed colored rectangle.)

                      While still in layout mode, use the rectangle tool to create a rectangle of the desired color. Don't worry about size or proportions, they won't matter in the final result. Copy this rectangle to the clipboard. Return to browse mode, click on the container field and paste from the clip board to put the rectangle into it.

                     Now define a new calculation field like this.

                     IF ( YourDateField > Get ( CurrentDate ) - 7 ; Globals::gFirstColor ) // this will return the contents of gFirstColor if date is at least 1 week old.

                     Be sure to select "Container" as the result type in the drop down inside Specify Calculation dialog.

                     Now add this calculation field to your layout. Using the data formatting options at the bottom of the Inspector's data tab, specify that the field both enlarge or reduce graphic to fit and clear the "maintain proportions" option. That way, the rectangle will scale to fully fill the calculation field when it appears.

                     That's it for one "Timer graphic".

                • 5. Re: Conditional formatting a picture
                  RickDearden

                       Thanks Phil...

                       I've tried this out now but don't have any success. I've tried it with a rectangle and also an image. 

                       Attached is the table I've created.

                       gStar is a container containing the 'png' of a Star

                       gTelephone is a container containing the 'png' of a Telephone

                       QuoteDate is the related field from my Quotations Table

                       Star1 is the calculation field as you explained it.

                       I still can't get the star to display using that calculation. 

                       I've tried just inserting the gStar field into the portal and that displays the star as expected so figure it must be something to do with the calucation field.

                       Also the image shows up super small no matter if I select 'Enlarge to Fit'/etc.

                       Any ideas?!

                       Rick. 

                  Edit: I changed the calculation field from a Global field to a non-global field as all instances would be seperate and still no joy...

                        

                  • 6. Re: Conditional formatting a picture
                    RickDearden

                         Additional info picture...

                    • 7. Re: Conditional formatting a picture
                      RickDearden

                           And another!

                      • 8. Re: Conditional formatting a picture
                        philmodjunk

                             Star1 should NOT be a global field. What result type have you specified for this field? You need to select "Container" as the result type inside the specify calculation dialog.

                        • 9. Re: Conditional formatting a picture
                          raybaudi
                               "Conditional formatting only works with alphanumeric data, not images."
                                
                               With FMP12 you can have an image that appears or not appears using conditional formatting.
                               The trick is to place a button with an image as its filling option and then conditional format the button to have a transparent fill.
                          • 10. Re: Conditional formatting a picture
                            RickDearden

                                 Phil - I posted a comment just above the image saying that I'd changed the field to a non-global field just after I sent the message. It doesnt make any difference... Thanks for all your help but Ray's hit the nail right on the head!

                                 Ray - that solution worked perfectly and the picture displays in the correct proportions too - many many thanks!