5 Replies Latest reply on Apr 4, 2017 12:44 PM by danshockley

    Edit Script display truncates after certain TAB characters

    danshockley

      Summary

      Edit Script display truncates after certain TAB characters

      Product

      FileMaker Pro

      Version

      12.0v4

      Operating system version

      Mac OS X 10.8.5

      Description of the issue

      When viewing the list of script steps that make up a script, the Edit Script window displays a summary view (often a complete view) of what that script step does, without requiring a click on it. Some script steps are truncated with an ellipsis if they have too much information to display. In a specific situation, including a TAB character in a calculation as part of a script step (e.g. Set Variable, Set Field, If) truncates that display without any indication that code is missing.

      Viewing your script steps with this bug active can lead you to believe that a calculation is much shorter than it actually is. This bug thus causes problems for developers trying to use whitespace as part of a best practice to make calculations more legible.

      Specific situations where this occurs: The script step display is truncated after the first TAB after (about) the 27th character in the calc string when the total length of the calculation is more than about 186 characters. Strangely, the exact TAB cutoff point shifts by a few characters if there is another TAB before that one. The cutoff point also shifts depending on what script step it is. The above is for "Set Variable" and "Set Field." When the script step is an "If" the cutoff is not 27, but rather about 51. 

      This did not occur in FileMaker 11. In FileMaker 11, tab characters were stripped out in the display list so that neighboring characters were jammed together, but they did not cause following characters to disappear.

      Steps to reproduce the problem

      Add a Set Variable script step to a script.
      Choose a variable name like $testVar
      For the Value, use the following calculation (NOTE that there is a TAB character between the 6 and 7 in the third number grouping that was entered by hitting option-tab on a Mac):
      "123456789 123456789 123456     789 123456789 123456789 123456789 123456789 123456789 "
      & "123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 "

      Hit OK.
      Notice that the Edit Script window shows that entire calculation - you can scroll to the right and see the whole thing, including the closing square bracket.
      Now, Duplicate that script step and click Specify on the duplicate, the Specify to edit the Value's calculation.
      Edit the calculation so that the TAB character is between the 7 and 8 instead of between the 6 and 7.
      Hit OK to save the calculation and then OK again to save the script step.
      Notice that the script step display is now truncated after the 7 in that third grouping of numbers, without any indication that the calculation is longer than what is shown. There is no ellipsis, no closing bracket. If the TAB occurred outside of a string to format a calculation for better legibility, there wouldn't even be the hint of an unmatched quote character to indicate the display is misleading you.

      Expected result

      Tab characters in calculations should not break the script step display feature.

      Actual result

      Using tab characters can break the Edit Script window's display feature, misleading developers about the content of their scripts.

      Exact text of any error message(s) that appear

      There is no error message, only incorrect display.

      Workaround

      None, other than avoiding use of actually typed TAB characters. If you want to include a literal TAB character within a string, you could concatenate Char ( 9 ) into a string. However, that doesn't help with the way this breaks using TABs to format complex calculations as part of a legible code best practice.

      bug-tab-truncation.png

        • 1. Re: Edit Script display truncates after certain TAB characters
          philmodjunk

               Hmmm, I'm not disagreeing that this is a bug, but: I would not put such an invisible character into a calculation expression as the very fact that you can't easily tell what character was used could result in a great deal of confusion. I'd use the Char function and it's code number such as Char ( 9 ) for tabs so that I can readily tell what invisible characters are included in that text.

          • 2. Re: Edit Script display truncates after certain TAB characters
            danshockley

                 I totally understand and agree with using Char(9) in places of hard-coded TABs in a literal string, Phil. However, that critique is of the overly-simplified example I posted here to visually demonstrate the exact nature of the problem (as far as the strange specificity of when it fails). This was example code, not working code. 

                 Attached is an example where your critique does not apply - using whitespace to format a calculation for legibility according to fairly typical best practices. Of course, we could use multiple spaces instead of a TAB, but as FileMaker chose to use a proportionate font (instead of fixed-width) for its programming code interface, that is problematic, as well. 

                 So, until we get a fixed-width font for programming interfaces like the calculation definition boxes, we should use TABs. Unfortunately, this bug breaks the display of script steps in a way that can potentially mislead a developer about what a script step contains. 

                 I'd characterize this as a potential data-loss bug, as it can lead a developer to believe that a script or variable is being set to something simple, while the actual calculation is much more complex (but truncated in the Edit Script window), and will change data in unexpected ways when that script is run. 

            • 3. Re: Edit Script display truncates after certain TAB characters

              DanShockley:

                   Thank you for the post.

                    

                   I am able to reproduce this with FileMaker Pro 12.0v4 (Advanced) on my workstation computer with Mac OS X 10.8.5. Windows does not appear to be affected. 

                    

                   The behavior in FileMaker Pro 11 was to also display the tab spaces but show an "…" when the text was too long to display in the Edit Script window. Since this behavior changed from FileMaker Pro 11, I forwarded a report to Testing and Development for review. 

                    

                   TSFalcon

                   FileMaker, Inc.

              • 4. Re: Edit Script display truncates after certain TAB characters
                philmodjunk

                     Hmmm, but formatting the script step and including invisible characters in a string are two very different uses. I agree that we need the elipsis back but I can also easily tell that not all I want to see is visible due to the mssing ] character in the line.

                     Of course a text based editor--something that developers have been requesting for many years would make the whole issue moot.

                • 5. Re: Edit Script display truncates after certain TAB characters
                  danshockley

                  I'm marking this as answered since Script Workspace fixed this specific problem.