3 Replies Latest reply on Oct 21, 2015 3:22 PM by user19752

    How do we identify value delimiters in a list of values?

    Malcolm

      FMPA v14.0.3 running on Mac OS X 10.10.5

       

      I've been using the calculation below to generate images in the web viewer.

       

      Let (

          B64 =  "data:image/png;base64," & Substitute( Base64Encode(Resource::AVInput) ; ¶ ; "" ) ;

          "<img id=" & Quote ( "rid" & Get(RecordID) ) & " src=" & Quote( B64 ) & ">"

      )

       

      The output of the base64Encode function adds a line break every 76 characters. If I strip the line breaks the web viewer displays the image nicely. If I don't strip them the image doesn't display, so I strip them.

       

      Now I want to be able to use these resources in a list context. The line breaks have been stripped, so the output should be suitable for stacking in a list.

       

      A quick test shows that there are no line breaks left:

      patternCount( Substitute( Base64Encode(Resource::AVStimulus) ; ¶ ; "" )  ; ¶ ) // --> zero

       

      The next test shows that line breaks are not the only way to separate values.

      ValueCount( Substitute( Base64Encode(Resource::AVStimulus) ; ¶ ; "" ) ) // --> 2204

       

      When I copy the output and paste it into TextWrangler there are 2204 lines of text. Is some sort of conversion taking place on the clipboard or in TextWrangler?

       

      In the Data Viewer I've grabbed the white space which is evident in the output from Base64Encode(Resource::AVStimulus) and the Code() function shows that the value is 3200032, in other words it is two space characters. This seems to contradict the documentation, unless two space characters are a way to represent a line break?

       

      I've done the same with the ouput from Substitute( Base64Encode(Resource::AVStimulus) ; ¶ ; "" ). I've grabbed the white space which is evident, put it into the Code() function and the value is 32, a single space character.

       

      However,

      PatternCount( Base64Encode(Resource::AVStimulus)   ; char(32) ) // --> zero

      and

      PatternCount( Substitute( Base64Encode(Resource::AVStimulus) ; ¶ ; "" )   ; char(32) ) // --> zero

       

      So, I have questions:

      1. Why are line breaks being represented by two space characters?
      2. Why does the line break substitution result in a single space being displayed when the substitution should remove all line breaks?
      3. What is being represented by the single space character?
      4. What is being recognised as a delimiter to produce 2204 values?