Sub Initialize
On Error GoTo errhandle
Dim ss As New NotesSession
Dim curdb As NotesDatabase
Dim docs As NotesDocumentCollection
Dim tdoc As NotesDocument
Dim searchStr As String
Dim sum1 As Long
Dim showtabel As String
sum1=0
Set curdb=ss.Currentdatabase
Set docct=ss.Documentcontext
sDate=docct.fldSdate(0)
eDate=docct.fldEdate(0)
'searchstr={Form="Newfile" & delflag="" &Postflag="0"}
'searchstr="Form='Newfile'&delflag=''&Postflag='0'& PostTime> @TextToTime('" + sDate+"') & PostTime < @TextToTime('" + eDate+"')"
'searchstr="[PostTime] >=" +sDate + " and [PostTime] <= " +eDate+" and [Subject] contains 2013"
searchstr="[PostTime] >=" +sDate + " and [PostTime] <= " +eDate
' Set docs=curdb.Search(searchstr, nothing, 0)
showtabel={<html><table border="1" bordercolor="#000000" cellspacing="0" cellpadding="2" style="border-collapse:collapse;" width="100%"><tr ><td width="40%" align="center">标题 </td><td width="10%" align="center">发布人</td>}
showtabel=showtabel + {<td width="15%" align="center">部门</td><td width="20%" align="center">发布日期</td> <td width="15%" align="center">点击次数</td></tr>}
If curdb.Isftindexed Then
Set docs=curdb.Ftsearch(searchstr, 0,FT_DATECREATED_DES)
If (docs.Count) >0 Then
Set tdoc=docs.Getfirstdocument()
While(Not tdoc Is Nothing)
showtabel=showtabel +{<tr><td >} +tdoc.Subject(0)+"</td><td>" +tdoc.AddName(0)+"</td><td>" +tdoc.deptname(0)+"</td><td>" +CStr(tdoc.PostTime(0))+"</td><td>" +tdoc.ClickNum(0)+"</td></tr>"
sum1=sum1+CInt(tdoc.ClickNum(0))
Set tdoc=docs.Getnextdocument(tdoc)
Wend
End If
Else
Print "this database is not ftindex"
End If
showtabel=showtabel+"<tr><td colSpan='5'>"+"合计"+CStr(docs.Count)+"篇,点击次数合计"+CStr(sum1)+"次</td>"
showtabel=showtabel+ "</table><html>"
Print showtabel
Exit sub
errhandle:
Print CStr(Error) + CStr(Erl)
End Sub
全文检索输出统计表格
最新推荐文章于 2023-12-23 20:41:02 发布