6 Replies Latest reply on Jul 24, 2009 9:17 AM by j-hill

    Populate icon if field is not-null



      Populate icon if field is not-null


      My goal is for Filemaker Pro 10 to automatically populate a 'clickable' icon if a field is populated.  For example, if I had a field named 'Amazon_link' and I were to populate it with a link to an Amazon.com profile for a product, then Filemaker would display an Amazon icon in which if the user were to click on the icon it would take them to the Amazon.com page displaying the product.


      I think it might be a function with maybe an IsValid operator but I'm struggling and haven't found anything when searching the forum.


      Thank you for your help. 

        • 1. Re: Populate icon if field is not-null

          If you store your image in a global container field, you can access it from any table.


          So your calc with container result would simply be:  Case ( not IsEmpty ( Amazon_link  ); gAmazonIcon )

          • 2. Re: Populate icon if field is not-null

            Thanks a ton for the help.  I have now gotten it to show the Amazon icon if there is a URL available but I would like to be able to click on that icon and open a browser window to go to the URL.  In going through the help documentation, it appears I would want to combine the help provided below with the Open URL script.  I have tried to stick it in a few different spots and can't seem to get it working.  Could anyone please advise?  I'm putting more detail below so that should someone else come across this discussion, they could hopefully leverage the solution.


            Here are the pertinent fields:

            field > contents 

            amazon_icon > icon image

            amazon_purchase_link > the URL to the amazon page

            amazon_purchase_indicator > this is where I put the calculation provided below in which it shows the amazon icon if the amazon_purchase_link is populated


            Here's the formula with the result set to container:

            amazon_purchase_indicator = Case (IsEmpty (amazon_purchase_link);"";amazon_icon) 


            My question is where to put the Open URL script so that clicking on the amazon_icon would open a browser window and take them to the URL?


            Thanks so much. 


            • 3. Re: Populate icon if field is not-null

              The calculation where the icon displays. You can make that calc with container result be a button itself.




              If [ not IsEmpty (amazon_purchase_link) ]

              Open URL [ amazon_purchase_link ]

              End If

              • 4. Re: Populate icon if field is not-null

                I apologize if I'm being unusually dense.  I think I have the below working as suggested but the button appears even when there is nothing populated in the amazon_purchase_link field. 


                My goal is that the button (or clickable icon) only appears if there is something populated in the amazon_purchase_link field.  Essentially, the script would be that 'If amazon_purchase_link is populated, then display amazon_icon AND if the user clicks on the amazon icon THEN Open URL [amazon_purchase_link].  Otherwise (i.e,. if amazon_purchase_link is blank) then don't do anything and nothing should appear on the layout.


                 Any help is appreciated.


                Thanks a lot. 

                • 5. Re: Populate icon if field is not-null

                  I dont know what to tell you. I think you have enough from what I have posted to achieve what you are looking for. I would carefully re-read through the posts and try again.




                  Edit: Typo

                  • 6. Re: Populate icon if field is not-null

                    Thanks for the help.  I have gotten it to work and will provide some details below for anyone else who might come across this in searching.  mr_vodka was exactly correct (obviously) and my mistake was in not recognizing that this is two distinct steps.  I was trying to type the Open URL script into the IF portion of the script.


                    1.  Create the field (Type: Calculation; Calculation Result is: Container) with the calculation being

                    amazon_availability_indicator = If ( not IsEmpty (amazon_purchase_link);amazon_icon)

                    2.  Go to layout and in edit mode, insert the field created in Step 1.  Right click and go to Button Set-up.  In that dialog box is where you set the script to Open URL and specify the field containing the URL, in this case amazon_purchase_link.


                    Unchecking 'Change to hand cursor over button' helps, as well.


                    Thanks for the help.