6 Replies Latest reply on Feb 14, 2017 12:28 AM by user19752

    Container Variable Not Storing Data


      I have a script that does the following:


      1. creates a new record in a log table (TableA)

      2. downloads a file via the Insert from URL script step and stores that in a container field in the new record (regular container field - not external storage)

      3. commits the record

      4. sets a local variable $attachment to the container field value


      It then deletes the newly created record and changes context to create some additional records in a different table (TableB). It then sets a container field with the $attachment variable value, e.g.


      Set Field [TableB::attachment ; $attachment  ]


      I"m getting an error at this step - error 10 (Requested data is missing). I can see the variable is showing in the Data Viewer (showing the file name of the container) but for some reason it appears to not retain the container data when I attempt to populate other container fields with the same container file.


      I'm wondering if deleting the record that it was originally stored in also deletes the storage of the container in the variable as well? Haven't done a similar process before so this is all new to me.

        • 1. Re: Container Variable Not Storing Data

          I think you might have to use Base64Encode (container field value from Table A) when assigning the variable.


          Then Base64Decode when setting it into the new container.


          Just curious...why not just import the file directly into the container in Table B?

          • 2. Re: Container Variable Not Storing Data

            Interesting. This shows variable have reference of container as its value.

            If duplicate record before set variable, the error didn't occur, since same contents remain in another record. (duplicating record also use reference of contents, not duplicate contents.)


            If you use global container field in tableA, it will keep the contents after record is deleted.

            1 of 1 people found this helpful
            • 3. Re: Container Variable Not Storing Data

              Until you close the session, I'll bet.

              • 4. Re: Container Variable Not Storing Data

                I'm creating tens/hundreds of new records in TableB based on the first record that gets created in TableA - I only need to download the file once so I was performing this in the TableA record.


                I'm now storing this in a global container field which is working well in my tests so far.

                • 5. Re: Container Variable Not Storing Data

                  I had switched to using a global container field as well which looks like it's solved the issue - it does require a new field which I don't really need but not a big deal at the end of the day.


                  Still curious why the variable doesn't hold it's value after the record is deleted - I'm assuming this has something to do with how container fields are stored/referenced by variables which store a container value/data type?

                  • 6. Re: Container Variable Not Storing Data

                    It may be a bug, deleting object that have reference yet.


                    You can see the behavior clearer using open external storage.


                    Insert file to container: there is a file in external storage

                    Set variable: data viewer show "remote:..." as text representation of reference to container contents

                    Delete container contents and commit: file removed from storage, but data viewer doesn't change

                    Set Field using variable: Error(10) Requested data is missing


                    I played around some while, after that there is a file that is not referred from any record... remain after deleting all records. may be another bug...