3 Replies Latest reply on Feb 26, 2013 7:26 AM by philmodjunk

    script help - why is this deleteing my records

    ericjlindholm

      Title

      script help - why is this deleteing my records

      Post

                          This script is supposed to create a record in the table "event days" by getting the start and end dates from a record in the table "events"  and re-adding them in event days.  For some reason it is wiping out the events table and i cannot figure out y.  plz help.  thx

                           

                           

                           

      Event Date insert
                          If
      [ not IsEmpty(EVENT::Event End Date) and not IsEmpty(EVENT::Account Manager ID) and not IsEmpty(EVENT::Event Type)and

      not IsEmpty(EVENT::Event Status) ]

      Freeze Window

      Set Error Capture [ On ]

      Set Variable [ $STARTDATE; Value:EVENT::Event Start Date ]

      Set Variable [ $$TriggersOFF; Value:True ]

      Set Variable [ $ENDDATE; Value:EVENT::Event End Date ]

      Set Variable [ $EVENTID; Value:Equipment List::Event ID ]

      Freeze Window

      Go to Layout [ “Event Days” (Event Days) ]

      Perform Find [ Specified Find Requests: Find Records; Criteria: Event Days::event ID: “=$EventID” ] [ Restore ]

      Delete All Records

      [ No dialog ]

      Loop
                          Exit Loop If
      [ $STARTDATE > $ENDDATE ]
      New Record/Request
                          Set Field
      [ Event Days::date; $STARTDATE ]
      Set Field [ Event Days::event ID; $EVENTID ]
      Set Variable [ $STARTDATE; Value:$STARTDATE+1 ]

      End Loop
                          Go to Layout
      [ “EVENT” (EVENT) ]
      Go to Related Record [ From table: “EVENT”; Using layout: “EVENT” (EVENT) ]

      Set Variable [ $$TriggersOff; Value:False ]
      Set Error Capture [ Off ]

      End If

      February 25, 2013 17:32:47 SWP EMS V3.6 - Event Date insert -1-