4 Replies Latest reply on Apr 6, 2014 8:34 AM by garyjones

    Copy field contents script stops if field empty

    garyjones

      Title

      Copy field contents script stops if field empty

      Post

           Hi

           My second post in a couple hours - I am not having a good day. This question is in two parts and kind of relates to my last issue with relationships.

           I have a portal, that links to an external table. I am trying to write a script that sequentially copies the contents of one of the portal fields into another table. I have had it working but the issue is I the script to stop if one of the fileds it is copying is empty.

           My questions are;

           1). Does the script sit and run within the file that the portal relates to or can it live in the file that the portal is part of?

           2). My script doesn't seem to stop at a blank field. Please see attached image for the steps.

           Once again any help would be fab.

           Thanks.

           Best

           G

            

            

            

            

      Script.PNG

        • 1. Re: Copy field contents script stops if field empty
          RickWhitelaw

               Your Else and ElseIf  tests are identical. Are you sure this is what you want?

          • 2. Re: Copy field contents script stops if field empty
            garyjones

                 Hi Rick

                 Not sure. I want the script to copy the contents of the field if there are any and stop, or do something else, if not.

                 Regards

                 Gary

            • 3. Re: Copy field contents script stops if field empty
              philmodjunk

                   Why is To Do List in a different file? If you put all your tables in one file, life is much simpler.

                   With the tables in separate files, you can define an external data source reference to the other table and then a single script in one file can move the data from one table to another. But this may not be needed at all if I recall your other post correctly.

                   More observations:

                   The Copy script step creates problems for your users as it copies data to the system clipboard. If the user has copied data to the clipboard before performing this script, they will not be happy to discover that their copied data has been replaced by data copied by this script.

                   Copy will silently fail to copy any data if the layout that is "current" at the time the script step executes does not have the specified field and it is not accessible in Browse mode.

                   Set Variable can be used in place of Copy and Set field can be used in place of Paste to avoid using copy/paste when the entire script is performed in a single file. If you want to pass this data to a script in another file, you can pass this data as a script parameter and still avoid copy/paste as a way to move data from one table to another.