6 Replies Latest reply on Jul 15, 2009 6:45 PM by comment_1

    Can script have user entered parameters at time of execution???

    NeoTekCorp

      Title

      Can script have user entered parameters at time of execution???

      Post

      Already received amazing help on how to merge records and replace data. My question is this: Can certain portions of a script be entered at the time of script running???

       

      Example. Set Field [ DATA ; "Education" ]

       

      Is there a way to prompt the user to enter the desired data ("Education" in this example) in the field ("DATA" in this example). That way if we need to make multiple changes we don't need a script for every variable.

       

      Any help, as always, is appreciated.

       

      Adam 

        • 1. Re: Can script have user entered parameters at time of execution???
          mrvodka
             You can use a global field to capture the users' input and thenn refer to the global field in your Set Field [].
          • 2. Re: Can script have user entered parameters at time of execution???
            comment_1
               Check out the Show Custom Dialog [] script step.
            • 3. Re: Can script have user entered parameters at time of execution???
              NeoTekCorp
                

              Thanks for the suggestions. I'm a little unclear on the applications of either a global field or the custom dialogue to the script we've set up. Below is that script. So for example, in this script we're looking to find all records with "AUTOMOBILE" and replacing it with "Automotive". The database has hundreds of category names we want to change/modify. Obviously we don't want to create a script for every variable. Rather, it'd be nice to scan the database, find something we want to change, run the script and enter the text to be found and the text to replace it.

               

              Obviously I'm somewhat a novice so simple is better. Thanks. 

               

              Set Error Capture [ On ] 

              Enter Find Mode [  ] 

              Set Field [ SSF_db_AK::Category; "AUTOMOBILE" ] 

              Show Custom Dialog [  ] 

              New Record/Request 

              Set Field [ SSF_db_AK::Category; "Automotive" ] 

              Omit Record 

              Perform Find [  ] 

              If [ Get ( FoundCount ) = 0 ] 

              Show Custom Dialog [ Title: "No Records"; Message: "No Records Found"; Buttons: “OK”, “Cancel” ] 

              Show All Records 

              Exit Script [  ] 

              End If 

              Go to Record/Request/Page 

              [ First ] 

              Loop 

              Set Field [ SSF_db_AK::Category; Substitute ( SSF_db_AK::Category ; "AUTOMOBILE" ; "Automotive") ] 

              Go to Record/Request/Page 

              [ Next; Exit after last ] 

              End Loop


              • 4. Re: Can script have user entered parameters at time of execution???
                comment_1
                  

                 This example uses a global text field for user input (which could be be in any table):

                 

                 

                # GET THE CATEGORY OF THE CURRENT RECORD

                Set Variable [ $searchString ; SSF_db_AK::Category ]
                #

                # FIND ALL RECORDS IN THIS CATEGORY

                Enter Find Mode [  ]
                Set Field [ SSF_db_AK::Category ;
                $searchString ]
                Perform Find [  ]
                #

                # GET USER INPUT

                Show Custom Dialog [ Input #1: XYZ::gReplaceString ]

                #

                # RENAME CATEGORY

                Replace Field Contents [ SSF_db_AK::Category; XYZ::gReplaceString ]

                 

                 

                Note that this is just a rough sketch, with no error handling.

                • 5. Re: Can script have user entered parameters at time of execution???
                  NeoTekCorp
                    

                  Thanks for the descriptive explanation of the global field method. I think that may work. Here is exactly what I'm trying to accomplish.

                   

                  We're developing a business directory data comes from a few sources we've purchased, each having some variations in the data. At the same time much of it overlaps (same businesses, different fields).

                   

                  Anyhow, we're consolidating them and assigning them more uniform Category & Subcategory fields.

                   

                  Now what I'd like is to be able to scan the database. Say I come across one that has an original BusCode field "GROCERY STORES" which we would like to change to a category field "SHOPPING" and a subcategory field of "GROCERIES"

                   

                  My thoughts we if we could run a script similar to the find/replace I posted that would prompt a find dialogue box that I could put "GROCERY STORES" in the BusCode field and a replace dialogue box to enter a category and subcategory field that I want to enter. Preferably I would setup drop down boxes showing the category/subcategory fields we already set up.

                   

                  Any thoughts and input would be appreciated. 

                  • 6. Re: Can script have user entered parameters at time of execution???
                    comment_1
                      

                    I believe it would be much better to normalize your data, i.e. have a table of Categories with fields for CategoryID and Category, and leave only a CategoryID in the table where the business are.

                     

                    This way, you only need to change the category name in one place, and the change will be automatically propagated to all related businesses.