Select documents within a given date range

Hi,I need to select documents whereby they fall in a specific date range.

For example, the form I am using has a submit date.

I want to see all the documents between a user entered date variable…

So far, I can do this for example by year, using prompts and @SetViewInfo.

I can now also prompt for the date, but it doesn’t work, presumably because I don’t know how to convert it to a range of dates, or because the @SetViewInfo is only looking for a specific value…

Heres the current code, produces nothing:

date1:=@Text(@Adjust(@Date(@Today);-1;0;0;0;0;0));

date2:=@Text(@Date(@Today));

choice:=@Prompt([OkCancelEdit]; “Select a date”; “Please select the date range you are interested in”; date1);

choice2:=@Prompt([OkCancelEdit]; “Select a date”; “Please select the date range you are interested in”; date2);

date1:=@Date(choice);

date2:=@Date(choice2);

@SetViewInfo([SetViewFilter];choice+choice2;SubmitDate;1);

@Command( [ReloadWindow] );

@Command([ViewRefreshFields])

I don’t particulary have to use @setviewinfo, and am happy to use LS if there is possibilities there. I don’t want the user to do anything other than just click on the view and enter some dates however…

Any ideas? Thanks…

ab

Subject: Select documents within a given date range

I don’t think the @SetViewInfo will work because you can’t come up with a single category to filter by using a date range.

My thought was to use LS to do a search with your date range then loop through the result set and drop those documents into a folder.

Depending on the volume of documents, you could use a view that is sorted by date and just walk the view, making sure the date is between the dates provided by the user.

Regards,

Don

Subject: RE: Select documents within a given date range

Thanks Don. As the view will be used by more than one user, I am trying to avoid using folders…

Does anyone else have an idea? It seem’s strange that notes can’t handle this. it’s really quite a basic thing I would have thought…

Subject: RE: Select documents within a given date range

In LS you can create a NotesDaterange variable and use it as the key in a NotesView.GetAllEntries by Key.

I believe this works with @DBlookup also.

Subject: RE: Select documents within a given date range

Do you know where to put the code, for example, in the PostOpen of an already existing view? Or an agent which uses this code to create a view or somewhere else???

Subject: RE: Select documents within a given date range

Views Part 1 Views Part 2

If not a subscriber, you can still download the sample database. Part 2 shows how to display results of an arbitrary search, including based on a range of dates.

Subject: RE: Select documents within a given date range

OK, I’ve downloaded the database. It doesn’t help really. I need to select a range of dates. As in my original post.

I had found this article before, but a) I can’t access it ($399 is a lot of money!), and b) The sample database does not have a range of dates selection anywhere…

What I’m really after is having a view, whereby, the user can enter a range of dates, and then the view displays documents whose field SubmitDate is between the dates they select…

Any examples/code samplers on how to do this would be great…

Otherwise, I’ll have to give up, and hard code the dates into the view - this is annoying, because it means every year I will have the same problem…

Subject: RE: Select documents within a given date range

This is one of those things that’s easier to do on the web than in the Notes client.

on the web, you’d use &Starkey= and &untilkey

In the client, I think you have to use a private on first use or desktop private on first use view. Embed it in a form, and use the NotesView.SelectionFormula property to get the right documents. Then refresh the view, and then the workspace.