您的位置:首页 > 其它

全文检索输出统计表格

2015-03-24 16:16 155 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: