(請注意,在我在這篇文章中提出這個問題之前,我在這個網站上發現了一些類似的帖子,但是我不能通過添加評論來請求這些帖子,所以我決定在這裏提問。如果我的問題不適合謝謝)xpages:如何在導出數據時通過值得到總數?
在應用程序中,當用戶登錄到頁面時,sessionScope變量將存儲用戶信息,例如官員姓名和部。有一個按鈕供用戶將數據導出爲excel。報告應該包括該官員發佈的文件的總數。
我在這篇文章中發現了這個解決方案export data from panel非常有用,它給了我如何將數據導出到excel的想法。
我從帖子中獲取代碼並嘗試修改它以適合我的情況。根據代碼,我可以預設報告中的值。但是,我不明白如何獲得該官員發佈的文件的總數。
我在網上搜索,可能有我的信息來解決問題。但我認爲我誤解了這些信息,而且我不知道我做錯了哪一部分。
我會在這裏發佈代碼並請求您的建議。
請注意,大部分的代碼是從這個職位export data from panel的解決方案,我會發布代碼,我猜這是我沒有得到報告總數的原因。
while (viewEnt != null)
{
if(viewEnt.getColumnValues()[1] == officer) //show the record the related to specific officer
{
writer.write("<tr>");
writer.write("<td>" + viewEnt.getColumnValues()[6] + "</td>"); //show document name
writer.write("<td>" + viewEnt.getColumnValues()[5] + "</td>"); //show document type
writer.write("<td align='left'>" + viewEnt.getColumnValues()[4] + "</td>"); //show publish date
writer.write("</tr>");
}
var tmp = vec.getNextEntry(viewEnt);
viewEnt.recycle();
viewEnt = tmp;
}
var officer = sessionScope.Officer;
writer.write("<tr></tr><tr><td>Document published </td><td>" + officer.getCount() + "</td></tr>"); //<--cannot get to the total depends on which officer
//also tried officer.getRowCount() but not work
writer.write("</table>");
writer.endDocument();
另外我想知道是否必須有一個列在視圖中分類,以獲得總數?
我創建了兩個視圖,一個視圖是官員列被分類,另一個視圖未分類並使用排序升序。我應用了代碼,仍然沒有得到與用戶相關的總數。
請問有人讓我知道我的錯誤嗎?謝謝。
參考:
https://www-10.lotus.com/ldd/ddwiki.nsf/dx/NotesViewEntry_sample_JavaScript_code_for_XPages
How to get Categorizied Column Totals into an XPageTotal Value from View column
Get entries count for a multiple category view (two categories) using a key (Xpages)
Getting a summary count in a view export?