3 Replies Latest reply on Aug 19, 2013 3:55 PM by philmodjunk

    finding two fields using a script?

    gasolineman

      Title

      finding two fields using a script?

      Post

           i have a db that i am working on a script for that would allow me to run a script to run a find and then copy certain fields and paste into a new record.

           it happens like this: first person enters a case number and their name in two fields.  they call me and i enter the same case number and then run my script.  the script searches for the case number and then copies the relevant fields from his record and pastes them into my record.  

           what i need to have now is: i need to be able to run the script and have it search for the case number AND the first persons name then copy the fields and paste into my record.  what i cant figure out how to do is to make a script that will find more than one field at a time.  

           my current script looks like this:
           go to field [db::case number]
           copy [select}
           enter find mode []
           paste [select]
           perform find []
           go to record/request/page [previous]
           go to field [select/perform; db::case name]
           copy [select]
           go to record/request/page [next]
           go to field [db;;name]
           paste {select]

           and so on for the rest of my fields

           this works great for findng just the case number but i need to add to the script so it copies both the case number and name field and searches for both at the same time.

            

           thoughts? questions?

        • 1. Re: finding two fields using a script?
          philmodjunk

               Copy and paste are not the best steps to use here. Not only are you limited to the contents of a single field for your find criteria, if the user has previously copied data to the clipboard, the script replaces that data with data copied by this script. It's better to use other means to move your data such as using set variable to copy the data into a variable and then set field to set a field to the variable's value. That completely avoids the clipboard and you can use two variables, one for each field.

               Set Variable [$caseNumb ; value ; db::case number ]
               Set variable [$caseName ; value: db::case name ]
               Enter Find Mode[]
               Set FIeld [db::case number ; $CaseNumb ]
               Set Field [db::case name ; $CaseName ]
               Perform Find []

               For more examples of scripted finds: Scripted Find Examples

          • 2. Re: finding two fields using a script?
            gasolineman

                 when i use the set field command, just as you typed it, i get an error that "an operator is expected here"

            • 3. Re: finding two fields using a script?
              philmodjunk

                   When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.