7 Replies Latest reply on Jul 9, 2013 8:39 AM by philmodjunk

    ok now how do i type my question

    moogie

      Title

      ok now how do i type my question

      Post

            

             
      •           Go to Layout [ “Alerts and Charges List” (Hold_NeedAlertAndCharges) ]
      •      
      •           Sort Records [ Keep records in sorted order; Specified Sort Order: Hold_NeedAlertAndCharges::name; ascending Hold_NeedAlertAndCharges::name_alert_charges; ascending Hold_NeedAlertAndCharges::name_deliver_pickup; descending Hold_NeedAlertAndCharges::date; ascending ] [ Restore; No dialog ]
      •      
      •           View As [ View as List ]
      •      
      •           Pause/Resume Script [ Indefinitely ]
      •      
      •           Go to Layout [ “Hold_NeedAlertAndCharges” (Hold_NeedAlertAndCharges) ]
      •      
      •           Enter Browse Mode
      •      
      •           Show All Records
      •      
      •           Enter Find Mode [ Specified Find Requests: Find Records; Criteria: Hold_NeedAlertAndCharges::insert: “*” ] [ Restore ]
      •      
      •           Perform Find [ ]
      •      
      •           Loop
      •      
      •           Set Field [ WORK::o_pickup_alert_received; Hold_NeedAlertAndCharges::insert ]
      •      
      •           Set Field [ WORK 2::o_deliver_alert_received; Hold_NeedAlertAndCharges::insert ]
      •      
      •           Go to Record/Request/Page [ Next; Exit after last ]
      •      
      •           End Loop
      •      
      •           Show All Records
      •      
      •           Delete All Records [ No dialog ]
      •      
      •           Close Window [ Current Window ]
      •      
      •           Perform Script [ “go_work” from file: “WorkOrder” ]

            

        • 1. Re: ok now how do i type my question
          moogie

               above script works but enters new records  - how di i keep it from entering new records  - after posting above copy of script how do i ask my question 

          • 2. Re: ok now how do i type my question
            symbister

                 after your Perform Find step, you should include a Go To Record [first] to initialize the Loop

                 which may not solve your 'adding records' problem - which table are records being added to?

                 You're searching in one table, but then posting data into a second table, so it looks as if you need to store your 'insert' field contents into a variable before the Loop, then change layout to 'WORK', then set the WORK fields to the variable in the loop, but then which table are you deleting all records from?

            • 3. Re: ok now how do i type my question
              moogie

                   FM 12 ADVANCED - in WORK table i have 3 different customer id fields  -  the same customer can be in all fields or 2 or 1 in same record  -  to group on the customer id i transfer all record data i need from WORK table to HOLD table  -  this gives me a list of records i need to update,  by a grouped customer list, so i can call each customer once and enter data needed  in HOLD table -   when i termanite pause the script puts the data in WORK table and delets all records in HOLD table  -  this way i have a clean HOLD table next time i run script - 1) never initialized with GO TO RECORD (first) will put in all past and future scripts 2) do you still feel above is best method to stop adding new records? if yes, dont understand how i get to a WORK layout  from a script in HOLD table - maybe?? with a script but then variable would have to be GLOBAL  -  is thre an easier way? thanks   

              • 4. Re: ok now how do i type my question
                philmodjunk

                     Your script goes to a layout for the Hold_NeedAlertAndCharges table occurrence.

                       
                •           Go to Layout [ “Hold_NeedAlertAndCharges” (Hold_NeedAlertAndCharges) ]

                     It performs a find (enter browse mode and show all records do nothing and can be removed)

                       
                •           Enter Browse Mode
                •      
                •           Show All Records
                •      
                •           Enter Find Mode [ Specified Find Requests: Find Records; Criteria: Hold_NeedAlertAndCharges::insert: “*” ] [ Restore ]
                •      
                •           Perform Find [ ]

                     Then in the loop, it uses set field to modify data via a reference to the Work table occurrence

                       
                •           Loop
                •      
                •           Set Field [ WORK::o_pickup_alert_received; Hold_NeedAlertAndCharges::insert ]
                •      
                •           Set Field [ WORK 2::o_deliver_alert_received; Hold_NeedAlertAndCharges::insert ]

                     Since this is not that table occurrence of the current layout, the relationship between the current record of Hold_NeedAlertAndCharges and records in the WORK table occurrence will control what happens when these set field setps execute. IF new records are being created in the WOrk table, then there is no related record in the Work table at the time the script executes and you have selected the "allow creation of records via this relationship" option in the relationship(s) linking these two table occurrences.

                • 5. Re: ok now how do i type my question
                  moogie

                       ok unchecking the ALLOW CREATION makes sense and it works correctly - does this mean i have my relationship wrong? or script wrong? when it makes  a new record it inserts the fields i use for the relationship - thanks

                  • 6. Re: ok now how do i type my question
                    moogie

                         think symbister answered my question  - would GO TO RECORD first solve the problem?

                    • 7. Re: ok now how do i type my question
                      philmodjunk

                           Go to record will change what record in is the current record in Hold_NeedAlertAndCharges. That will affect the results, but I can't say whether or not it will resolve the issue as it depends on the design of your database and what results you want produced for your script.

                           Likewise, disabling allow creation will prevent your script from creating new records via the relationship, but then the set field steps do nothing when there is no related record in WORK for the record that is current in Hold_NeedAlertAndCharges at the time these steps execute. That also may or may not be what you need to happen.