This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Feb 23, 2012, 5:45 PM
11 Posts
topic has been resolvedResolved

Get First Document of Search Resutls in a viewPanel

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: viewPanel,search
  • Replies: 2
Hello,
 
I have a view control and I am performing a FTSearch on it using scoped variables ( search="#{javascript:viewScope.searchCustomerNo;}" )
Now, I want to be able to get a handle of the first document in the search results view. I am not sure if there is any property that I can get that in the viewPanel component.
 
Any help/suggestions/directions for this requirement is gladly appreciated. 
Thanks!
 
Chay
Feb 24, 2012, 9:48 AM
261 Posts
Re: Get First Document of Search Resutls in a viewPanel
Chay,
 
You can access the data from a viewPanel and use that to get the first entry in the resulting view:
 
var viewPanel = getComponent("viewPanel1");
var data = viewPanel.getData();
var dataObject:lotus.domino.local.View = data.getDataObject();
var viewEntryCollection:lotus.domino.local.ViewEntryCollection = dataObject.getAllEntries();

var firstEntry = viewEntryCollection.getFirstEntry();
var firstDocument = firstEntry.getDocument();

var firstUNID = firstDocument.getUniversalID();

Mark
Feb 24, 2012, 2:08 PM
11 Posts
Re: Get First Document of Search Resutls in a viewPanel
Thank you Mark!

I actually came close. I was working on it yesterday and got it to work using the code below:-
 
var viewPanel:com.ibm.xsp.component.xp.XspViewPanel = getComponent('viewPanel1');
var dominoView:com.ibm.xsp.model.domino.DominoViewData = viewPanel.getData();
dominoView.setSearch(viewScope.searchCustomerNo);
var searchView:notesView = dominoView.getView();
var vc:notesViewEntryCollection = searchView.getAllEntries();
vc.FTSearch(viewScope.searchCustomerNo,0);
if (vc.getCount() == 1){
    var vDoc:NotesViewEntry = vc.getFirstEntry();
    if (vDoc != null){
        var firstDoc:notesDocument = vDoc.getDocument();
        <put code here for the firstDoc>
    }
}
 
Thanks again!

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal