4 Replies Latest reply on Feb 28, 2014 2:25 PM by Stephen Huston

    Date find

    nsmith9110@gmail.com

      My employer wants to be able to filter all documents in his database based off the date, meaning due today, due tomorrow, overdue, etc.... I tried to program my find as field name:Doc_ExpectedDate < Get(CurrentDate); however I gget the message "The value of this field must be a valid date in the range of years 1 to 4000 and should look like '12/25/2003.'" How do I create this find?

        • 1. Re: Date find
          ch0c0halic

          This kind of construct works well to preform the Find and is self-documenting.

          Enter Find mode

          Set field [“Doc_ExpectedDate” ; “<//“]

          Perform Find [] //no restore

           

           

           

          Another way is to use a variable.

           

          Set Variable [“$my_date” ; “<“ & GetAsText(Get(CurrentDate))”]

          /concatenate the “<“ with todays date as a text string

           

          Perform Find =  Find (“Doc_ExpectedDate” ; $my_date)

          //instead of text just enter the variable name as the criteria

          • 2. Re: Date find
            Stephen Huston

            The problem is that the calculation you specified is a true-false test, and won't generate a date as the result.

             

            For instance,

            Today - Yesterday = 1

            and

            Tomorrow - Yesterday = 2

             

            Neither result will render as a valid date entry.

             

            You could create an unstored calc, which will be slow to search depending on your total record count, with text results, something like:

            Case ( Doc_ExpectedDate < Get(CurrentDate) ; "Overdue" ;

            Doc_ExpectedDate = Get(CurrentDate) ; "Due Now";

            { additional tests... ; and results } ; default result )

             

            And then program scripted searches for each result you want to report, or just use the resulting status field in a list report.

            • 3. Re: Date find
              erolst

              Stephen Huston wrote:

              You could create an unstored calc, which will be slow to search depending on your total record count, with text results, something like:

              Case ( Doc_ExpectedDate < Get(CurrentDate) ; "Overdue" ;

              Doc_ExpectedDate = Get(CurrentDate) ; "Due Now";

              { additional tests... ; and results } ; default result )

               

              And then program scripted searches for each result you want to report, or just use the resulting status field in a list report.

               

              If this in the interest of user-friendliness, why not take the reverse route? Let them select from a list of these human-readable choices, then convert it (the selection) into a query that works on the actual, indexed data.

              • 4. Re: Date find
                Stephen Huston

                That's another perfectly valid option, requiring a slightly different scripted process.

                 

                My response was focused on understanding the effect of using calculations within a Find request.