8 Replies Latest reply on Jul 5, 2017 7:27 AM by TSGal

    Why is my Base64encode function failing in V16?

    john_wolff

      Product and version       FMPA 16.0.1.162

      OS and version              macOS 10.12.4 & macOS 10.12.5

      Hardware:                   

      27" iMac (late 2015) with 32GB RAM or MacPro  6,1 6core, 1TB SSD, with 16GB  RAM

      Accessing solution hosted on FMS 15  running on 8-core 2008 MacPro on OSX 10.11.

      Description:

      We use the Base64 encode function to create a text data for uploading jpg files to our web site via ESS.

      The function has worked perfectly for V14 and V15 but we are only seeing the first 3 generic lines of Text when we try to use the same function in V 16. Here is the Calc:

      Base64Encode ( "imagemac:" & MM::gSuperContainerPath & Products::MWProductCode & "/" & Products::MWProductCode & ".jpg”  ) where MM::gSuperContainerPath = "/GMG_FMS15/Users/Shared/SuperContainer/Files/Grandmothers Garden/Products/“, the fully qualified path prefix.

      Changing “imagemac” to “filemac” does not overcome the glitch.

      Have contacted 360Works, who have advised that it is not a problem with accessing the file from our SuperContainer destination.

      How to replicate:

      Tested with Data Viewer.

      Workaround: Will the problem be resolved when the solution is hosted from FMS 16? Possibly not, as when I test the function with the data viewer using my FDS version of FMS 16, the problem persists.

       

        • 1. Re: Why is my Base64encode function failing in V16?
          TSGal

          john_wolff:

           

          Thank you for your post.

           

          Our Development and Testing departments are aware of this issue under FileMaker Pro 16 where the Base64Encode results from file in a Container field are different than a file on the Desktop.  I have attached your post to the original report.  When more information becomes available, I will post again.

           

          One workaround is to export the field contents before using Base64Encode.  Another workaround is to wrap the file path URL with an unstored Calculation (Container) field, and feed that into Base64Encode.  See the attached file.

           

          TSGal

          FileMaker, Inc.

          2 of 2 people found this helpful
          • 2. Re: Why is my Base64encode function failing in V16?
            john_wolff

            Thank you for confirming my observations.

             

            Can you please post the "attached file" as it will certainly help me construct the workaround.

             

            Regards,

             

            John Wolff

            • 3. Re: Why is my Base64encode function failing in V16?
              john_wolff

              Hi TSGal,

               

              I've resolved the problem by firstly inserting the .jpg file into a FileMaker container and once there the Base64encode function generates the required text.

               

              Ryan from 360Works advised that the easiest way to load the file from its SuperContainer location is to use the SCGetContainer function from their Companion Plugin. But first you must use their SCSetBaseURL function then append to that output, the relevant directory structure to reach the particular file.

               

              As we're currently using both V15 & V16 for the testing phase, it has been necessary to brach the script so that the appropriate code is used with each version of FMP.

               

              The example file was helpful in confirming the process.

               

              Regards,

               

              John Wolff

              1 of 1 people found this helpful
              • 4. Re: Why is my Base64encode function failing in V16?
                David_McKee

                The "Wrapping" method that TSGal mentions is actually the correct thing to do, and should work in both 15 and 16.  The fact that Base64Encode encoded text strings that happen to "look" like file paths, as file paths on disk, was a bug.   A "beneficial/neat" bug, but a bug nonetheless.  (You should be able to encode the text "file:whatever" as base 64 if you need to.)

                 

                Doing it that way should allow you to avoid using branching logic based on app version, and relying on unsupported behavior.

                 

                Hope this helps!

                1 of 1 people found this helpful
                • 5. Re: Why is my Base64encode function failing in V16?
                  john_wolff

                  Hi David,

                   

                  Thank you for forcing me to continue searching for ways of making our script behave without the need for branching, which has only been needed to allow the web site updates to continue from our regular users while I fathomed out the script steps needed for the revised Base64Encode behaviour.

                   

                  For the SuperContainer storage of our images, I've found it necessary to use these three script steps:

                  Screen Shot 2017-07-04 at 8.26.33 AM.png

                  The last variable has this definition:

                  Screen Shot 2017-07-04 at 8.27.13 AM.png

                  Despite numerous attempts I was unable to define the "file:whatever" without using the SuperContainer Companion Plugin commands as shown above.

                   

                  Is there something I've overlooked?

                   

                  Regards,

                   

                  John Wolff

                  • 6. Re: Why is my Base64encode function failing in V16?
                    TSGal

                    john_wolff:

                     

                    "SCGetContainer" (and "SCSetBaseURL") is not a FileMaker function, but probably a Super Container custom function, as the first two letters are initials for Super Container.

                     

                    TSGal

                    FileMaker, Inc.

                    • 7. Re: Why is my Base64encode function failing in V16?
                      john_wolff

                      Hi TSGal,

                       

                      I recognise those functions as derived from the SuperContainer Companion Plugin. None of my attempts to build a filepath without using those two functions were successful.

                       

                      If it can be done then, obviously I don't know how and that's the reason for my post this morning. With the Example file you posted earlier, I tried every combination I could think of for generating a path. Only after I loaded an FMP container field on our layout with the same SC functions used above could I generate the required string of some 54K characters.

                       

                      Sincerely,

                       

                      John

                      • 8. Re: Why is my Base64encode function failing in V16?
                        TSGal

                        john_wolff:

                         

                        I'm not familiar with the inner workings of Super Container.

                         

                        In FileMaker Pro, you need to reference the location of the file.  Using a simple example, assume you have a database file "Test.fmp12" on your Desktop.  A Container field "RemoteContainer" is created with the default Storage options of "Store container data externally" relative to:

                        [database location]/Test/

                        Select Open storage:  "Table/RemoteContainer"

                        Assume the image "FileMaker.jpg" was inserted into the Container field.

                         

                        Your full path would be:

                        file:/<name of hard disk>/Users/<your user name>/Desktop/Test/Table/RemoteContainer/FileMaker.jpg

                         

                        This should give you a good starting point.

                         

                        TSGal

                        FileMaker, Inc.