NotesIn9: 24 – Fancy Type Ahead in XPages

In this show I try and do something rather dangerous. I attempt to explain a Tim Tripcony blog post on creating Fancy TypeAheads which are TypeAheads that show additional data in the lookup results. This helps aid the user to select the correct record.

I had some technical problems in the show. The sound changed for the demo portion somehow. Also I messed up due to the last Extended Edition and missed episode 23. So the next one will be 23. :-)

So anyway – here you go. I hope you like it.

The code for my function is:
Code Sample

  • Russ Maher

    Thanks David. Nice to see the concept in play.

  • Toby Samples

    Great Tutorial, I used Tim’s Code in an app a couple of months ago, users loved it so much I put it on almost everything…FYI Its an array of Javascript Objects, so you were right both times.

  • John Turnbow

    Thanks… This is very cool… I’ll give it a try and check the CSS.

  • Thomas Adrian

    Hello David,
    I have not gone through your code very deeply but I think you should be able to do a match on both first name and last name in a single loop if you put the fields as a list in the column e.g FirstName:LastName and use show multiple values as separarate entries.

    I use this “key” technique very much on
    the main benefit of this is that you only need one view. in fact you could build a whole website with this and only have one view. regardles of how many forms you have.

    Thomas Adrian

  • DavidLeedy

    Thanks! you’re absolutely right of course! In this example it would be better. I’ve done the exact same thing in the Notes Client already.
    I think in my original day job version of the code, the possible lookup entries were more separate and it didn’t make sense to combine them in a view. But if you can of course, that’s a good way to do. Though I admit I guess I don’t know which is better.. Bigger views – since you might be doubling the entries, or multiple smaller views doing different loops. Hmmm. might be something to look into.
    But a great point. Thanks for reminding me about that!!!

  • DavidLeedy

    Thanks Russ!

  • DavidLeedy

    Thanks Toby. I just haven’t grasped the terminal of JavaScript or gotten a good comfortzone yet. But I’m trying. :)

  • Thomas Adrian

    I actually did a test using getAllDocumentsByKey and getAllEntriesByKey methods on a view with about hundred thousand docments and I guess a half amillion entries (using the list technique) and it was really slow.

    the reason is ofcourse that these functions return every entrybykey (in my case 70.000 entries) even it I am only intetested in the first ten. I am trying to figure out if there is a better way, maybe the caching mechanism coming in 8.5.3 will help. would be nice with a function like getFirstXEntriesByKey(x,key,true) which I think would be much faster ;-)

    another way could be to cache or preload unids and use getDocumentByUnid which should be the fastest method to get a document (I think tim tripcony have an example of this where unds are stored/cached in a hashmap, not sure how this works though ;-) )

    - Thomas