4 Replies Latest reply on Jul 24, 2014 4:12 AM by jibardhan

    BaseElements BE_ReadTextFromFile() error

    jibardhan

      I have used BE_ReadTextFromFile ( path ) to read the contents of a text file .

       

      The text file is getting read properly and setting in a text field properly in data viewer.

       

      But when that field is represented in a layout , then the text data doesnot show properly . i.e. each linefeed from the text file ,shows 2 line feeds in the text field on the layout .But the data viewer ,for that field show correct line feeds:-

       

      Please help.

        • 1. Re: BaseElements BE_ReadTextFromFile() error
          ibrahim_bittar

          Hi jibardhan

           

          Most likely your text file has hidden carriage returns that are not shown in the Data Viewer.

           

          What you can do is to strip double carriage returns and substitute them by only one:

           

          Substitute ( BE_ReadTextFromFile ( MyFile.txt ) , "¶¶" , "¶" )

           

          Another option could be:

           

          Substitute ( BE_ReadTextFromFile ( MyFile.txt ) , [ Char ( 10 ) , "" ] , [ "" , "¶" ] )

          • 2. Re: BaseElements BE_ReadTextFromFile() error
            jibardhan

            Thanks for the reply.

             

            ----Substitute ( BE_ReadTextFromFile ( MyFile.txt ) , "¶¶" , "¶" )

             

            Will not work as the data viewer is accepting data properly. And there is no double carriage returned on the data viewer .As a result , the above step will not work.

             

            I have made certain changes that as the text field is getting proper data , but while displaying the data , 2 carriage returns are showing instead of 1 carriage return.

             

            For displaying data , i have created another field ,say TextDisplay_xt = Substitute ( GetAsCSS ( Text_xt ); "<BR><BR>" ; "<BR>" )

             

            Because ,GetAsCSS() properly displays the carriage return in the form of double <BR>.

             

            And , showing the field - TextDisplay_xt , in the form of web viewer.

             

             

             

            ------Substitute ( BE_ReadTextFromFile ( MyFile.txt ) , [ Char ( 10 ) , "" ] , [ "" , "¶" ] )

             

            The  character is not getting copied to FM13

            • 3. Re: BaseElements BE_ReadTextFromFile() error
              user19752

              Check it using Code() function. It should be CRLF, so try

              Substitute ( text ; Char ( 13 ) & Char ( 10 ) ; Char ( 13 ) )

              • 4. Re: BaseElements BE_ReadTextFromFile() error
                jibardhan

                Thanks for the reply.

                 

                Flawless.... its working good.