Search a date range over the Web

Need to search a range of dates based on a user's selection of a beginning and end?

Need to search a range of dates based on a user's selection of a beginning and end? 2 Steps: Write the search string, and convert the date characters to ASCII. Here's the code!

STEP 1: On a search form in a query field, calc the search string. (In this example, INVOICE_DATE is the DATE field on the doc that needs to be in the range. StartDate and EndDate are fields on the Search form. Be sure that the field searched is a DATE. This will not work if the field is text. Also, be sure the date format used on the search form matches the stored format of the document.)

@If(StartDate!=""; "[INVOICE_DATE]>"+@Text(@Adjust(StartDate;0;0;-1;0;0;0))+"+AND+[INVOICE_DATE]<"+@Text(@Adjust(EndDate;0;0;1;0;0;0)); "");

STEP 2: Convert non URL characters to ASCII (i.e. /," ")

" ":""":"#":"$":"&":"+":"/":":":";": "<":"=":">":"?":"@": "[":"\";
"%20":"%22":"%23":"%24": "%26":"%2B":"%2F":"%3A":"%3B": "%3C":"%3D":"%3E":"%3F":"%40": "%5B":"%5C";

@If(asciiString != ""; asciiString; "")

Your $$Return would have something like this: (SearchString is the field calculating the query in Step 1.)


NOTE: You may not use the greater than or equal to operator in a web search. You must seperate these out. In the case above, I adjust the dates by 1 day to include the days chosen in the range.

Dig Deeper on Domino Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...