AnsweredAssumed Answered

Find records with date range of "This Week" etc

Question asked by ToddCarlson on Sep 24, 2013
Latest reply on Sep 30, 2013 by ToddCarlson

Title

Find records with date range of "This Week" etc

Post

     I am trying to use the sample below to generate a lists of records that fall in This Week and Next Week using a value list for those two and another value list for the "action field" being Measure Start Date, Install Start Date, ETA Houston etc.

     Here is what I used as a resource:

Enter Find Mode []
If [IsEmpty ( Globals::gRangeOption ) // user didn't select a range option, check for arbitrary date range ]
   If [ Not IsEmpty ( Globals::gDate1 )  and Globals::gDate2 > Globals::gDate1 //valid date range was entered ]
      Set Field [ YourTable::YourDateField ; Globals::gDate1 & "..." & Globals::gDate2 ]
   Else
      Enter Browse Mode []
      Show Custom Dialog ["ERROR: No valid search criteria was entered"]
   End If
Else IF [ Globals::gRangeOption = "This Week" ]
    Set Field [YourTable::YourDateField ; Let ( [T = Get ( CurrentDate ) ; D = T - DayOfWeek ( T ) ] ; D + 1 & "..." & D + 7 ]
Else If [ Globals::gRangeOption = "This Month" ]
     Set Field [YourTable::YourDateField ; Month ( Get ( CurrentDate ) ) & "/" & Year ( Get ( CurrentDate ) ) ]
Else
      Set Field [YourTable::YourDateField ;Year ( get ( CurrentDate ) ) ]
End IF
Set Error Capture [on]
Perform Find []

      

And the attached picture is what I came up with.  It doesn't work.  The gRangeOption field has a value list of This Week and Next Week (initially wrote script just for This Week).  The gActionSearch field is a value list of fields that I want the date range for (not sure if I can do this)  Thank you.

      

Screen_Shot_2013-09-24_at_7.57.27_AM.png

Outcomes