0
votes

I need to create a custom sort for a FTSearch (can be from a view, with results stored in a viewEntryCollection or from the database, in a NotesDocumentCollection). The order has to do with the number of search terms found in the subject and category of a document. That part is working well, but I am not sure what object type that function needs to return in order to use the results in a dataview control. Is it a NotesDocumentCollection, a JavaScript array, or any other object? And how to push/access values I want in my different columns?

I have seen lots of code for sorting search results, but they all sort a particular column...

Thank you :D

1
The problem is that the DataView seems to require a Notes View. What I'm trying to figure out is if using a DataView to display custom sorted search results is even possible.Ben Dubuc
So now I have a JS object that contains a few properties, one of them is an array of NotesDocuments, sorted the way I want. Can I use that as a datasource on the Data View? And how would I get access to the document's fields from that array if I use a repeat control then? ThanksBen Dubuc
Hello again. Not sure you can use anything but a view in a data view. In a repeat you can add a document data source to a panel within the repeat and access the values from the data source. Or you can access the values from the repeat directly using x.getDocument().getItemValueString("fld") where x is the repeat variable.Thomas Adrian
Thomas, I ended up doing exactly htat: use a data table instead of a data view, and get my values with the methods of the Notesdocument, as this is the object that is stored in the resulting array. It's too bad though as the application is using the DataView a lot, so displaying results in the same type of object would have been great for the users. Thanks for your help :DBen Dubuc

1 Answers

0
votes

I found a way to do this, here is my post: http://www.bleedyellow.com/blogs/DominoHerald/entry/data_view_with_a_notesviewentrycollection?lang=en_us

Brad Balassaitis has a post linked there as well.

I've discovered later (after I did the above) you can create a NotesViewEntryCollection and call a FTSeach on it as well.

Cheers, Brian

Rodigo suggested not linking to answers, so here is the text of my post linked above:

Data View with a NotesViewEntryCollection Brian A Moore | Jan 20 | 4 comments | 388 visits So I've been wanting to use a Date View for a while, but I've not had the time I need to sit down and puzzle it out. And (soap box here) the examples given are pretty complex. I do have a sample based on Brad's work that I will be posting. But as I get that together, here is a tidbit. When you use a Data View, you are only given the option of selecting a Domino View. I wanted to see if you could do it with a collection. It turns out you can. What I did was this (in my odd discovery process) I created a DataTable based on a NotesViewEntryCollection of all entries in a view. I copied the node from it and replaced the nodes in the dataView. And the page renders. I've only put a pager in to see if it's got full functionality, and that's working, so I suspect that various other things will as well. Here is the entire XPage. It should work for you just changing the view name and the field you get. Plus, it's a start to using the Data View if you've not started yet :)

    <?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xsp/coreex">

    <xe:dataView
        id="dataView1"
        var="rowData"><xp:this.facets>
    <xp:pager
        layout="Previous Group Next"
        partialRefresh="true"
        id="pager1"
        xp:key="pagerTopLeft">
    </xp:pager></xp:this.facets>
        <xp:this.value><![CDATA[#{javascript:var nView:NotesView=database.getView('Name');
var nVEC:NotesViewEntryCollection=nView.getAllEntries();
return nVEC;}]]></xp:this.value>
        <xe:this.summaryColumn>
            <xe:viewSummaryColumn value="#{javascript:rowData.getDocument().getItemValueString('Subject');}"></xe:viewSummaryColumn>
        </xe:this.summaryColumn>
    </xe:dataView></xp:view>

Cheers, Brian