4 Replies Latest reply on Oct 4, 2011 6:50 AM by james.gould

    Exporting Container Fields

    james.gould

      Title

      Exporting Container Fields

      Post

      A client asked for a way to "open" files from containers without having to save them. The solution I've come up with uses the Get ( TemporaryPath ) function and saves a copy to their temporary folder and takes advantage of the automatically open option on the Export Field Contents script step. Nice and simple.

      The difficult bit occurs in the fact they have multiple container fields and I don't fancy writing a seperate script to calculate the filepath and filename etc each time. I have a script that takes in Table::field as a script parameter and then copies the contents of Table::field to Table::GLOBALCONTAINER and then always exports Table::GLOBALCONTAINER

      While this script functions, it is quite slow as copying the file between the two fields takes some time - so this script takes roughly twice the amount of time that right-click -> export takes. The ideal solution here would be something similar to the Set Field By Name script step - I have tried this but it does not select the field. If I could select the field by name I could then export the active field contents.

      Any help to resolve this issue would be greatly appreciated.

        • 1. Re: Exporting Container Fields
          philmodjunk

          Unfortunately, there's no way to indirectly reference a field with an Export Field Contents step.

          Best alternative that I can think of, is to put a series of Export Field Contents steps inside an If, Else IF structure so that the script performs the appropriate export field Contents step based on info passed as your script parameter.

          Either that, or store all these files in the same container field in different records of a related table so that you only export from the same field in every case, but now select the appropriate record instead of the field...

          • 2. Re: Exporting Container Fields
            mgores

            would it be possible to set the container fields as buttons so that they are set as the active field when you click on them to run the script.

            Or as Phil described have each of the containers in separate records in another table.  You could then show all the containers you want in a portal with a button next to each one to open it.  That way you only have to define one button and write one script.

            • 3. Re: Exporting Container Fields
              philmodjunk

              A portal is only one of many interface options for using the related table approach...

              • 4. Re: Exporting Container Fields
                james.gould

                After a bit of thinking time I came back to this and found a simple solution that didn't involve an overhaul to the db! I did a little test and discovered that an onObjectEnter script does the trick nicely! You can then have the Export Field Contents step export the selected field to the temporary path.