Xpages no results after viewing FTSearch

I have a search module in my application that filters several views, depending on the user's choice.

I want to add a dialog if the search has no results, instead of showing an empty view. How can i do this?

I tried to get rowCount (), but it seems that it is not getting the correct number of rows, I don’t know why.

SSJS Code:

var vw=database.getView("vwCautareDocI");
var tmpArray = new Array("");
var cTerms = 0; 
var dateFormatter = new java.text.SimpleDateFormat( "MM-dd-yyyy" ); 

if (sessionScope.numprenum) { 
   tmpArray[cTerms++] = "(Field NumePrenume = \"*" + sessionScope.numprenum + "*\")"; 
} 

if (sessionScope.postvizat) { 
   tmpArray[cTerms++] = "(Field PostulVizat = \"*" + sessionScope.postvizat + "*\")"; 
} 

if (sessionScope.din && sessionScope.pana) {
    tmpArray[cTerms++] = "Field _creationDate >= " + dateFormatter.format(sessionScope.din) + " AND Field _creationDate <= " + dateFormatter.format(sessionScope.pana);
}


filter = tmpArray.join(" AND ").trim(); 
var vec=vw.getAllDocumentsByKey(filter , true);
return vec.getCount();

This is the filter that I use to filter my view. I would like to add this code to the button, and if the result is 0, instead of showing the view, it should show a dialog with the message.

+1
source share
1 answer

getAllDocumentsByKey fTSearch . , , . , .

0

Source: https://habr.com/ru/post/1656890/


All Articles