Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Xpages Type ahead NAB picker cheat

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#xpages-nab-picker or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/xpages-nab-picker


To add a simple name picker to an xpage you can use this bit of code.





On the Edit Box field you need to have a name in, go to Type Ahead.

Tick "Enable Type Ahead".

In Suggestions make it compute Dynamically and enter:


@DbLookup("names.nsf", "($VIMPeople)", getComponent("Manager1Picker").getValue(),1,"[PARTIALMATCH]")

...where Manager1Picker is the name of the Edit Box.

The use of DbLookup and PARTIALMATCH helps reduce the chance of getting more than 64k returned.

If you used @DbColumn on that view it would fail quite quickly.

You can change Minimum Characters to more than 1 if you have a lot of people with the same name, ie more than 64k. Not seen this needed yet though.

If you want common names you can make it:
@Name("[CN]",
@DbLookup("names.nsf", "($VIMPeople)", getComponent("Employee").getValue(),1,"[PARTIALMATCH]")
)

If you want them to pick the Abbreviated name but actually store the canonicalized name you can set up a simple onchange event that modifies a field using this sort of formula:

@Name("[CANONICALIZE]",getComponent("Manager1Picker").getValue())

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
man and boy by Tony Parsons
British book of the year 2000. Great book, hard to put down, but I nearly threw it away half way through. You'll know why when you read it.
See at: Amazon.co.uk | Amazon.com |