VERY URGENT: Count documents within date range

Hi

Is there a way to count the number of documents from a view that fall within a given date range? The view has a column with dates.

Thx in advance for any ideas & help.

zicky

Subject: VERY URGENT: Count documents within date range

Hi,

why you don´t make a view with a viewselection, considered your daterange ??

regards

Bernhard

Subject: RE: VERY URGENT: Count documents within date range

I agree, I think one of these easiest ways to get the information you are looking for is to create a view and in the selection formula use the date range you are looking for. This way you do not have work through all the documens of the database.

Subject: RE: VERY URGENT: Count documents within date range

If you don’t want to create another view, make the first sorted column of your existing view show the date range (i.e. formula could be startDate + endDate), then get a NotesDocumentCollection by doing view.getalldocumentsbykey(startDate+endDate). You can then use NotesDocumentCollection.count to get the total.

Subject: RE: VERY URGENT: Count documents within date range

Hi, thx for your response guys!

This is what I’m trying to do (i’ve pasted the code below).

Users create funds disbursment data. The code needs to consolidate on a monthly as well on a ‘As On Date’ way. So if the funds were disbursed on Feb 2007, if I generate a report in Sept 2007 the info generated should cumulate till Sept 2007 only and not beyond that month.

The code i’ve written in Formula lang.:


space:= " ";

month:=@Select(@Month oirFDate);“Jan”;“Feb”;“Mar”;“Apr”;“May”; “Jun”;“Jul”;“Aug”;“Sep”;“Oct”;“Nov”;“Dec”);

day:=@Text(@Day(oirFDate));

year:=@Text(@Year(oirFDate));

Odate:= day + space + “Feb” + space + year;

dateToFind:=@If(oirMonth=“”;@Today;Odate);

datelist:= @DbColumn(“”:“NoCache”;“”:“”;“mstrClients”;10);

counter := 0;

@For(n := 1; n <= @Elements(listName); n := n + 1;

@If(datelist[n] < dateToFind;

counter := counter + 1;0));

counter

---------------------------------------------------<<

The ‘mstrClients’ view has the doc created date on the 10th COL (that I’m using as my search list). This code throws up the total number of records & does not limit based on the criteria. If there is a better way, wud appreciate your help.

Thx for any help in advance once again.

Zicky

Subject: RESOLVED: VERY URGENT: Count documents within date range

Hi guys! Thx for all the tips u provided. I have resolved this issue. T’was pretty simple - text conversion!! Will definitely switch over to LotusScript ASAP. beginning to understand it to be a better option

The code anyway:


Fdate:=oirAsOnDate;

space:= " ";

month:=@Select(@Month(Fdate);“Jan”;“Feb”;“Mar”;“Apr”;“May”; “Jun”;“Jul”;“Aug”;“Sep”;“Oct”;“Nov”;“Dec”);

month2:=@Month(Fdate);

day:=@Text(@Day(Fdate));

year:=@Text(@Year(Fdate));

Odate:= day + space + “Sep” + space + year;

Adate:=@TextToTime(Odate);

dateList:= @DbColumn(“”:“NoCache”;“”:“”;“mstrClients”;10);

Acounter := 0;

@For(n := 1; n <= @Elements(dateList); n := n + 1;

@If(@TextToTime(dateList[n]) < Adate;

Acounter := Acounter + 1;10));

@If(oirMonth=“”;0;Acounter)

-------------------------------<<

Thx once again.

Zicky