4 Replies Latest reply on Jan 13, 2012 9:16 AM by philmodjunk

    Showing local images in FM Pro 9 database



      Showing local images in FM Pro 9 database


      I am trying to show local images in a calculated container field in my database. The images will all be in the same subdirectly on my hard drive, but which image will appear depends upon a radio button in each record. I have one calculated field called photoPath that determines the local path of the image, thusly:

      If ( imageSelection = "Family Image"; "C:\work\website\current\Web Content\products\\" & family & ".jpg" ; "C:\work\website\current\Web Content\products\\" & prod & ".jpg" )

      Fields noted in bold are all text fields, with imageSelection being the radio button.

      Then I have a calculated field resulting in a container, thusly:

      "imagewin:/" &  photoPath

      It looks like everything is working, but I am getting a message in the container field that the file cannot be found, and I'm not sure why, as it definitely exists in the location listed, as follows:

      The file cannot be found:
      C:\work\website\current\Web Content\products\4141.jpg

      Any idea what could be wrong here?? Any help would be appreciated.

        • 1. Re: Showing local images in FM Pro 9 database

          You have two backslashes:  "...Content\products\\"  Try removing one first before we try anything else.

          Also, you are using a forward slash after imagewin:  I would change them all to be the same.

          • 2. Re: Showing local images in FM Pro 9 database

            Unfortunately, no dice. First of all, if I try putting just a single backslash in the formula, it blows up. I used DOUBLE backslashes in all cases, and that seems to be providing the correct path, as I posted above. It was the same story with the second field: if I use a SINGLE backslash after imagewin, boom. So I used a double backslash there as well. When attempting this fix, I did get a slightly different path, as follows:

            \C:\work\website\current\Web Content\products\4141.jpg

            I also tried the following to determine exactly what path is being seen by the field:


            This provided the following path:

            imagewin:/C:/work/website/current/Web Content/products/4141.jpg

            I'm beginning to think that I need FORWARD slashes, based upon this. I am going to try that next and see what happens.

            • 3. Re: Showing local images in FM Pro 9 database

              Well, that was the fix. It was looking for FORWARD slashes rather than BACK slashes for the local path. It now seems to be working perfectly. Nice.

              • 4. Re: Showing local images in FM Pro 9 database

                Backslashes are the "escape" symbol that tells FileMaker's evaluation code to take the following character as a literal character that's part of the quoted text. That way you can include a double quote inside your quoted text by using \". That makes backslashes invisible when the string is evaluated unless you double them, using \\ where you need \.