2 Replies Latest reply on May 14, 2014 6:22 AM by philmodjunk

    If image exists, display it, if not show a standard image?

    jackmac

      Title

      If image exists, display it, if not show a standard image?

      Post

           Hi all,

           My system has a field which displays an image of a product in a folder. I want to create a means to look in the folder and show the image using the name specified, if not there show a standard image kept in the same folder ('image coming soon' sort of image).

           In the past I've used IF EXIST and those types of conditionals but can't seem to tie this one down. Any help?

           Thanks

           Jackmac

        • 1. Re: If image exists, display it, if not show a standard image?
          philmcgeehan

               Create a new calculation field where the Calculation result is Container. 

               The calculation should be something like this:

               If ( IsEmpty ( StaffImage) ;
                   "imagewin:/X:/FMPfiles/Staff/Images/NoImage.jpg"
               )
                
          StaffImage in my solution, is the name of the Container field which holds a reference to an image, so change this to your Product Image container
               Then change the green text to the location of your default image.
                
               In Layout put the new calculation field on top of the existing container field.
          • 2. Re: If image exists, display it, if not show a standard image?
            philmodjunk

                 I suggest:

                 If ( IsEmpty ( ProductImage ) ;
                     gNoImageContainer ; ProductImage
                 )
                 Select container as the calculation field's result type.
                  
                 ProductImage would be your container field with the product image. gNoImageContainer would be a global container field with the image you want to display if there is no image in ProductImage.