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



Mar 15, 2011, 9:02 PM
5 Posts

How can I set view panel keys using search criteria input by the user?

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: view,keys,search
  • Replies: 2
I would like to be able to search within a category for specific documents.  My view is categorized by the first initial of employees' last names, and I have A-B-C links setting the 'categoryFilter' so I can restrict the categories as desired.  When I tried using appending 'keys=' and 'searchValue=" to execute a search, didn't work.  Seems it's not possible to combine the two - categoryFilter and keys or searchValue.  So...
I tried, using a view where the first column is sorted (not categorized) by the first initial of the last name, and the second column is simply sorted by last name.  I tested setting the keys using a code example from "Mastering XPages....". ("Thank you" to the authors) 

var v:java.util.Vector = new java.util.Vector();

v.addElement("B");

v.addElement("Banks");

return v; 

This worked as expected with my criteria hard-coded.  So instead of using my text field where the user can input their search criteria to set the searchValue parameter on the view, what I'd like to do is have my code take the first initial of the last name as the first element and the last name as the second element, and use these to set the 'keys' property on this view panel when I initiate the search using a link.  Is this possible? How?
 
Thanks in advance. 
Mar 16, 2011, 4:29 AM
22 Posts
Re: How can I set view panel keys using search criteria input by the user?
I've not really done this before, but perhaps you could try the following...
 
var userName=context.getUser().getCommonName();
var lastName = (userName.indexOf(' ')==-1) ? userName : userName.split(' ')[1];
var initial=lastName.charAt(0); 
var v:java.util.Vector = new java.util.Vector();
v.addElement(initial);
v.addElement(lastName);
return v;
 
I haven't tested this, but it essentially breaks down the user's name into teh components you require and adds them into the vector.
 
I hope this helps! 
 
 
 
Mar 17, 2011, 8:15 PM
5 Posts
Re: How can I set view panel keys using search criteria input by the user?
This is basically the route I'm taking but I need to modify it somewhat do I can use the user-entered value I've captured from the search box.  So instead of putting this code as the computed value of the keys property, I need the values assigned by code that runs when the user clicks on the Search icon/label and write the keys to the view panel properties.  Can't seem to locate a method that will allow me to write to that property.

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