سؤال

var component = getComponent("dvwContent");
return component.getRowCount() + " documents have been found";

If I'm placing this code into a computed value outside of a filtered dynamic view (referred to by "dvwContent"), it should return me the number of entries found, referring to this question & answer: Count entries in XPages view

If the number of hits exceeds the page display limit, it is giving me the number of filled rows on the page + 2. So if I display 25 lines per page, it tells me that "27 documents have been found" (if I display 50 docs, it tells me 52) - even if there are a lot more pages. It works correctly if there are less hits than the page display limit.

Does anybody have a solution for displaying/counting the correct number of hits?

هل كانت مفيدة؟

المحلول

As Stefan mentioned in his comment .getRowCount() refers to the rows visible on the page. From what I get you're interested in the entries of the view rather than the rows shown by the redering component.

One option that comes to my mind would be to access the viewEntryCollection object through the Domino view in question and then get the entry count from that:

var vw=database.getView("dvwContent");
var filter=["someFilter"];
var vec=vw.getAllEntriesByKey(filter, true);
return vec.getCount().toString() + " documents have been found";
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top