1 Reply Latest reply on Jul 1, 2015 6:19 AM by philmodjunk

    Show all records error

    DustinWelch

      Title

      Show all records error

      Post

      Set Error Capture [ On ] 

      Set Variable [ $$name; Value:Time off Tracker::Employee Name ]
      Set Variable [ $name; Value:Time off Tracker::Employee Name ]
      Set Variable [ $date1; Value:Get(CurrentDate) - 14 & "..." & Get(CurrentDate) ] 
      Set Variable [ $date2; Value:Get(CurrentDate) - 30 & "..." & Get(CurrentDate) ]
      Set Variable [ $date3; Value:Get(CurrentDate) - 182 & "..." & Get(CurrentDate) ]
      Go to Layout [ “Attendance Tracker” (Attendance Tracker) ]

      Show All Records 

      Perform Find [ Specified Find Requests: Find Records; Criteria: Attendance Tracker::Employee Name: “=$name” AND Attendance Tracker:: Date: “$date1” ] [ Restore ] 

      If [ Get (LastError) > 0 or Get(FoundCount) < 2 ]
      Perform Script [ “attend step 2” ]
      Exit Script [ ] 
      End If

      If [ Get(FoundCount) ≥ 2 ] 
      Set Variable [ $bal[2]; Value:Attendance Tracker::Point ] 
      Set Variable [ $datep[2]; Value:Attendance Tracker::Date ] 
      Set Variable [ $vio[2]; Value:Attendance Tracker::Type ] 
      Set Variable [ $com[2]; Value:Attendance Tracker::Comments ] 
      Set Variable [ $point[2]; Value:Attendance Tracker::Point ] 
      Set Variable [ $c; Value:3 ] 
      Set Variable [ $count; Value:Get(FoundCount) ] 
      Go to Record/Request/Page [ Next ] 

      Loop
      Set Variable
      [ $bal[$c]; Value:($bal[$c -1]) + Attendance Tracker::Point ]
      Set Variable [ $datep[$c]; Value:Attendance Tracker::Date ]
      Set Variable [ $vio[$c]; Value:Attendance Tracker::Type ]
      Set Variable [ $com[$c]; Value:Attendance Tracker::Comments ]
      Set Variable [ $point[$c]; Value:Attendance Tracker::Point ] 
      Set Variable [ $c; Value:$c + 1 ] 
      Go to Record/Request/Page [ Next; Exit after last ] 
      End Loop

      Show All Records

      Go to Layout [ original layout ]
      Go to Object [ Object Name: "at" ]

      If [ ($bal[$c -1]) ≥ 2 ] 
      Show Custom Dialog [ Title: "Violation"; Message: "This user has an Attendance Violation " & "Count: " & $count & " Balance: " & $bal[$c -1]; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ] 

      Send Mail [ Send via E-mail Client; To: "dustin.xxxxx@xxxx.xxx”; Subject: "Violation - " & $name; Message: $name &" has a violation. With " & $bal[$c -1] & " Total Points. ¶¶" & $datep[2] & ": " & $vio[2] & " / " & $com[2] & " Point Value: " & $point[2] & If (IsEmpty($datep[3]);"";"¶" & $datep[3] & ": " & $vio[3] & " / " & $com[3] & " Point Value: " & $point[3]) & If (IsEmpty($datep[4]);"";"¶" & $datep[4] & ": " & $vio[4] & " / " & $com[4] & " Point Value: " & $point[4]) & If (IsEmpty($datep[5]);"";"¶" & $datep[5] & ": " & $vio[5] & " / " & $com[5] & " Point Value: " & $point[5]) & If (IsEmpty($datep[6]);"";"¶" & $datep[6] & ": " & $vio[6] & " / " & $com[6] & " Point Value: " & $point[6]) & If (IsEmpty($datep[7]);"";"¶" & $datep[7] & ": " & $vio[7] & " / " & $com[7] & " Point Value: " & $point[7]) & If (IsEmpty($datep[8]);"";"¶" & $datep[8] & ": " & $vio[8] & " / " & $com[8] & " Point Value: " & $point[8]) & If (IsEmpty($datep[9]);"";"¶" & $datep[9] & ": " & $vio[9] & " / " & $com[9] & " Point Value: " & $point[9]) ] 

      Exit Script [ ]

      Else 

      Go to Layout [ “Attendance Tracker” (Attendance Tracker) ] 
      Show All Records 
      Perform Find [ Specified Find Requests: Find Records; Criteria: Attendance Tracker::Employee Name: “=$name” AND Attendance Tracker::Date: “$date2” ][ Restore ] 

      If [ Get(FoundCount) ≥ 3 ]
      Set Variable [ $bal[2]; Value:Attendance Tracker::Point ]
      Set Variable [ $datep[2]; Value:Attendance Tracker::Date ]
      Set Variable [ $vio[2]; Value:Attendance Tracker::Type ]
      Set Variable [ $com[2]; Value:Attendance Tracker::Comments ]
      Set Variable [ $point[2]; Value:Attendance Tracker::Point ] 
      Set Variable [ $c; Value:3 ] 
      Go to Record/Request/Page [ Next ]
      Set Variable [ $count; Value:Get(FoundCount) ]

      Loop 
      Set Variable [ $bal[$c]; Value:($bal[$c -1]) + Attendance Tracker::Point ] 
      Set Variable [ $datep[$c]; Value:Attendance Tracker::Date ]
      Set Variable [ $vio[$c]; Value:Attendance Tracker::Type ]
      Set Variable [ $com[$c]; Value:Attendance Tracker::Comments ] 
      Set Variable [ $point[$c]; Value:Attendance Tracker::Point ] 
      Set Variable [ $c; Value:$c + 1 ] 
      Go to Record/Request/Page [ Next; Exit after last ] 
      End Loop

      Show All Records
      Go to Layout
      [ original layout ] 
      Go to Object [ Object Name: "at" ] 

      If [ ($bal[$c -1]) ≥ 3 ] 
      Show Custom Dialog [ Title: "Violation"; Message: "This user has an Attendance Violation " & "Count: " & $count & " Balance: " & $bal[$c -1]; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ] 


      Send Mail [ Send via E-mail Client; To: "dustin.xxxxxxxxxxx"; Subject: "Violation - " & $name; Message: $name &" has a violation. With " & $bal[$c -1] & " Total Points. ¶¶" & $datep[2] & ": " & $vio[2] & " / " & $com[2] & " Point Value: " & $point[2] & If (IsEmpty($datep[3]);"";"¶" & $datep[3] & ": " & $vio[3] & " / " & $com[3] & " Point Value: " & $point[3]) & If (IsEmpty($datep[4]);"";"¶" & $datep[4] & ": " & $vio[4] & " / " & $com[4] & " Point Value: " & $point[4]) & If (IsEmpty($datep[5]);"";"¶" & $datep[5] & ": " & $vio[5] & " / " & $com[5] & " Point Value: " & $point[5]) & If (IsEmpty($datep[6]);"";"¶" & $datep[6] & ": " & $vio[6] & " / " & $com[6] & " Point Value: " & $point[6]) & If (IsEmpty($datep[7]);"";"¶" & $datep[7] & ": " & $vio[7] & " / " & $com[7] & " Point Value: " & $point[7]) & If (IsEmpty($datep[8]);"";"¶" & $datep[8] & ": " & $vio[8] & " / " & $com[8] & " Point Value: " & $point[8]) & If (IsEmpty($datep[9]);"";"¶" & $datep[9] & ": " & $vio[9] & " / " & $com[9] & " Point Value: " & $point[9]) ] 

      Exit Script [ ]

      End If 
      End If

      End If
      End If

       

      I have a script basically to manage my employees attendance points..  The script works perfect except I get a error 101 record is missing on script step show all records (I highlighted the line in red).. It doesn't impact the script running correctly.. I just get it if I run the debugger with pause on error... Any ideas why? 

        • 1. Re: Show all records error
          philmodjunk

          You are off by a couple of script steps.

          Go to record/request/page [next ; exist after last]

          will generate that error every time it tries to go to a record and there are no more in the found set to go to. This is normal behavior and something that I have pointed out to FileMaker Inc should not generate an error code.