Getting the number of documents returned to from a viewEntry

强颜欢笑 提交于 2019-12-11 16:46:25

问题


I have a panel on which I have defined a Domino view and called it viewEntry and attached it to a view in the current database. In the Data definition I have it set to filter by Category Names, all of which it does very nicely. Now I want to know how many documents the viewEntry contains. As I understand it viewEntry is a NotesXspViewEntry and I should be able to do something like viewEntry.getChildCount(). So I created a computedFiled inside the panelData with the formula viewEntry.getChildCount() but I get the error: Script interpreter error, line=1, col=11: [TypeError] Error calling method 'getChildCount()' on an object of type 'lotus.domino.local.View [Static Java Interface Wrapper, lotus.domino.local.View: lotus.domino.View]'

So I think this is saying that viewEntry is a NotesView not a NotesXspEntry, guess I was wrong. Then the question still is how do I get a handle on the document count returned in the viewEntry?


回答1:


You are aiming one too high....

 NotesView -> ViewControl --> Entries

I wouldn't call the ViewControl "ViewEntry" confuses the matter very much... since it is rather an EntryCollection. The property you are looking for is ViewControl.getRowCount() The ViewControl does't "know" that it gets only a filtered result from the data source, so ViewControl.getRowCount() returns what the datasource delivered to the control.

Be careful: that method can be quite slow if you have lots of data.

Alternate thought (I'm guessing use cases :-) )...

Quite often we see the category being selectable using a dropdown - that might apply to your use case too. A nice "feature" would be to show the number of entries behind the category name. Something like:

   blue (27) | blue
   red (34) | red
   black (345) | black

In this case you want to use a ViewNavigator to retrieve the values upfront. Steal some code for that.

Let us know how it goes



来源:https://stackoverflow.com/questions/27029453/getting-the-number-of-documents-returned-to-from-a-viewentry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!