2 Replies Latest reply on Jul 2, 2016 12:38 AM by ndveitch

    Script Parameters or Loop Script


      Hi There,


      I need to find out which idea would be the best.


      I have a situation where a client has a file on a number of iPads which is a copy of the main hosted file. The users enter in their data on the iPad's and because there is no internet where they are working. They have to come back to the office before the data can be synced back to the main system. I have tried GoZync with another client and it worked great, the issue here is, there is a chance that the data might need to be manipulated slightly before being synced back to the main program. With the file being a copy of the live system, there is a lot of data in those files that is not needed. I would first have to clean them up before doing any kind of import. Another factor that was not taken into consideration was the numbering sequence of one of the fields which is a legacy issue that is only being found out now.


      Anyway, I got cracking doing the clean up script and while thinking about what is going to go into it, I believe that there are going to be multiple times where I just duplicate that portion of the find request and change the go to layout and set field name in the find. The rest of that portion of script is fairly the same,


      Go to Layout [????]

      Enter Find More (off)

      Set Field [ ?????::JobNumber ; "ABC111" ]

      Perform Find

      Show Omitted Only

      If [ Get ( FoundCount ) <> 0 ]

      Delete All Records [Off]

      End If


      For many of the layouts I go to, only the "????" will be different. Would it be better to have 1 script and build 2 lists, one for Layout name and the other for field table name, and then run the script with a loop and use the 2 lists as indexes. Or would it be better to rather run 2 scripts, one with a whole whack of perform script steps, passing the layout name and field table name as script parameters to a second script. Then the second script sets variables using GetValue ( ) and those variables are used to replace the "????" accordingly?

        • 1. Re: Script Parameters or Loop Script

          Did you try to use the Set Field By Name.  You should be able to set the field name to a variable and then use that for setting the field. 

          • 2. Re: Script Parameters or Loop Script

            That is what I ended up doing. I am using 2 scripts. 1 that is a whole bunch of perform scripts with script parameters, then the second script that uses those parameters to build the set field by name and search option.


            The last time I did a script like this, I created a list variable and then using a loop and getValue(), I achieved the same thing, so I am just wondering which would be better? One of the differences I can see if that if anything changes, I would have to modify that list exactly, whereas using the 2 script approach, it seems that I have more flexibility.