2 Replies Latest reply on Jan 6, 2011 6:14 PM by Bill P. Chie

    Convert document back to string

    Bill P. Chie Level 1

      Dear all,

       

      I just find out that if I assign a string into a document variable, I will be able to see the string in the document content.

       

      But if I assign this document back to a string variable, I won't get the original string back.

       

      Would like to know what should I do to get it back?

       

      Regards

      Bill

        • 1. Re: Convert document back to string
          $Nith$ Level 4

          document is a complex type while the string is a simple data type.

           

          While coercing document to string, the document's content will be converted into base64 encoded string and will be assigned to the string variable.

           

          You can try any of these options:

           

          Option 1: You could write a custom component to decode the base64 string

           

          Option 2: save the document content to a temporary file and read the file content as string (Using readString activity).

           

          Hope that may help you.

          Nith

          1 person found this helpful
          • 2. Re: Convert document back to string
            Bill P. Chie Level 1

            Hi Nith,

             

            Thanks for the reply.

             

            That's mean that is not directly supported, I should:

             

            1) Write java in script object

            2) Write a user component

            3) Workaround by using read/write files service

             

            Regards

            Bill