1 Reply Latest reply on May 26, 2015 7:29 AM by disabled_menno

    [Solved] Error in DataViewer for function that works correct

      Summary

      [Solved] Error in DataViewer for function that works correct

      Product

      FileMaker Pro

      Version

      Advanced 11, Advanced 13 and Advanced 14 (not tested in 12)

      Operating system version

      MacOSX, Windows

      Description of the issue

      A working function, that works in FieldDefinition, Scripts and even in the DataViewer results in and error: "" when "Refresh Values" is clicked.

      Steps to reproduce the problem

      1) Create a Custom Function:
      <!- Start function -->
      /* Function: CF_FilterNonPrintingASCII ( Text ; Iteration )
      Purpose: Filter non-printing characters from text. Except for TAB (9), CR (10) and LF (13)*/
      Let ( [
         lst = "0¶1¶2¶3¶4¶5¶6¶7¶8¶11¶12¶14¶15¶16¶17¶18¶19¶20¶21¶22¶23¶24¶25¶26¶27¶28¶29¶30¶31" ;
         N = Int ( Iteration ) + 1 ;
         V = GetValue ( lst ; N ) ;
         C = Evaluate ( "Char(" & V & ")" ) ;
         L = ValueCount ( lst ) ;
         R = Substitute ( Text ; [ C ; "" ] )
      ] ;
         If ( N > L ; Substitute ( Text ; [ Char ( 10 ) ; ¶ ] ; [ Char ( 13 ) ; ¶ ] ) ; CF_FilterNonPrintingASCII ( R ; N ) )
      )
      <!- End function -->
      2) Open DataViewer and use the function like:
      CF_FilterNonPrintingASCII ( SomeTextField ; "" )
      3) Click "Evaluate Now" button

      Expected result

      No error

      Actual result

      Error-message

      Exact text of any error message(s) that appear

      A number, text constant, field name or "(" is expected here.

      Workaround

      If the part:
      Evaluate ( "Char(" & V & ")" )
      Is substituted with:
      Char ( x )
      No error-message appears.

      Another workaround would be to rewrite this function to:
      Substitute ( Text ; [ Char ( 0 ) ; "" ] ; .... ;  [ Char ( 31 ) ; "" ] )
      However that doesn't solve the problem that I can't use:
      Evaluate ( "Char(" & V & ")" )
      in a recursive function when I use it in a DataViewer