6 Replies Latest reply on Nov 26, 2014 4:11 PM by steve_ssh

    Calculation Size Limit when using fields

    madmike6537

      Hello,

       

      I have a quick question. I know that there is a limit to length with a calculation, but what if inside the calcuation I have a text field that is very long, over the length of the calculation limit. If I reference this field inside the calculation, will it cause problems?

       

      The reason I ask is because I have a webviewer in which the HTML/Javascript code runs fine outside of filemaker, but it wont run in the filemaker webviewer. Inside of my calculation code I have a <script> Preferences::javascriptFileText </script> and I am wondering if that text field with the javascript in it is too long so its not working?

       

      Is there anyway to debug the filemaker webviewer to find out what might be the error?

       

      Thanks.

        • 1. Re: Calculation Size Limit when using fields
          Mike Duncan

          Hi madmike6537,

           

          I do similar all the time, but it is likely an error somewhere in the javascript that causes it not to load, or a broken reference. To debug, you really need to have FMP Advanced to use the data viewer. Here's a way I use sometimes to debug code I run in a webviewer...

           

          1. Copy/paste the code that your webviewer uses and evaluate it in the data viewer.

          2. Copy the result.

          3. Past result in new text file, save as "zxzx.html" (or similar) and save on the desktop

          4. Open new window/tab in your browser and use the debugging features there to look for errors.

           

          One tick out of place in javascript can kill the whole thing, so seeing how it all loads in a more robust browser is needed to troubleshoot sometimes. Hope this helps.

           

          Mike

          1 of 1 people found this helpful
          • 2. Re: Calculation Size Limit when using fields
            madmike6537

            Thanks Mike I do have advanced so I will give this a try.

            • 3. Re: Calculation Size Limit when using fields
              madmike6537

              Strangely enough - when I do that it works perfectly fine. It just wont load in my webviewer for some reason. Hmmmm.

               

              Are there any documents that discuss best practises for using a webviewer with your own HTML? Things that you shouldnt put in there because the webviewer doesnt like them, etc?

               

              If it helps, I believe it is related to my background picture. I am trying to put a background picture on a canvas. I have tried it a few ways, using Base64 and putting the data right into the calculation field. I have tried putting the base64 string into a text field in filemaker and referencing that, I have even tried putting the picture in a container field and then using Base64Decode function in my text string field to have filemaker get the string. I am fairly confident this is what is causing it to fail.

              • 4. Re: Calculation Size Limit when using fields
                steve_ssh

                Hello Mike,

                 

                +1 to Mike Duncan's response for being the best first step towards troubleshooting.

                 

                 

                A few things that I would do:

                 

                1) See if you can get a simplified version of your code running in both the browser and webviewer.  In this case, perhaps that would mean removing all other code but the canvas with the background image.  I'll bet you've probably already done this, but if not, this sort of isolation helps you to hone in more closely on what part of the code is breaking.  With this process, be sure to continue to use Mike's methodology to compare what works in the browser versus what works in the WebViewer.

                 

                2) If you are on Windows:

                 

                Note that the browser functionality available in your webviewer is not necessarily on par with the functionality available in your web browser.  My understanding is that, unless you have specially tweaked your machine, the webviewer is going to offer you the functionality available in IE8.   Chances are, you are using a more modern browser than IE8, and therefore your browser may support features that the webviewer does not.  Sometimes the desired feature will still exist in IE8, but the API is slightly different, and you may need to adapt your code.

                 

                Focusing on this aspect of troubleshooting could mean:

                 

                  - Using Mike D's approach with the additional caveat of finding and using a version of an IE8 browser to test your code.

                   - Researching the Javascript features that you are using to make sure they are available in IE8.  One nice site for doing this type of research is:  http://caniuse.com

                   - Running your FM code on OSX, and seeing if the webviewer runs your code properly, or if it also breaks.  If it does not break in OSX, this suggests that there may be a compatibility issue with IE8.

                 

                3) Simulate having a console to log to by using alert() statements:

                 

                  - Start injecting alert() statements into your Javascript code, and watch them pop up as your webviewer processes your code.

                 

                At the point when things break, you'll stop seeing your alert messages.  Strategically modifying where you place these alerts can allow you to discover the exact line(s) of code where things are breaking.

                 

                 

                HTH & Good luck!

                 

                -steve

                • 5. Re: Calculation Size Limit when using fields
                  madmike6537

                  Thanks Steve,

                   

                  Thats a great write up on troubleshooting your webviewer code, I will definitely save it.

                   

                  I was able to refactor a bit and got it working. I am not exactly sure what was causing the issue, but its working now! Thanks for all the replies.

                  • 6. Re: Calculation Size Limit when using fields
                    steve_ssh

                    Hi Mike,

                     

                    I'm glad to hear that you got it working.  Thanks for the update.

                     

                    Very best,

                     

                    -steve