Tuesday, February 3, 2009

Xpages, how to make type ahead work for more than 64kb

I needed a type ahead for a field and needed it to work for about 6400 items in a view in another database. @DbColumn would return the value "Infinity" in a combobox, it would return nothing in the type ahead computed area. I am guessing the 64kb thing, but dont know for sure. So i decided to filter of a filter.

in the computed value of the type ahead i get the current field value

key1 = dominoDocument1.getItemValueString('vendor')

Then i do a lookup on that value with a @dblookup command with partial match turned on.

db1 = new Array("notes1","Applications\\vendors.nsf")

@DbLookup(db1, "PickList",@UpperCase(@Text(key1)), 1 ,"[PARTIALMATCH]")

I am guessing this has to do with how this function is implemented, getting the entire column and then doing a lookup on it, instead of doing a lookup on the column to begin with.

5 comments:

Anonymous said...

Nice tip Mark! I have to try this....

John

Anonymous said...

I have used your code to make a typeahead field work for City, State. Works very while, but since the input box allows values not in the suggestion list, I need to validate the entry. I used a Validation Expression, but when the validation fails then the typeahead does not work. It seems to Validate after each key stroke, so the validation keeps failing and never returns any typeahead suggestions. Have you tried to make this method of typeahead work with a validation expression? Thanks

Mark Hughes said...

Have you tried to change the event that is calling the typeahead to uncheck the validate box?

Anonymous said...

Where would I find that, there is no setting like that on the type ahead tab of a fields properties. There is a "No Data Validations" box on the events of the field, but those events are onclick, onblur, ect.

Anonymous said...

What evetn is calling the typeahead? the events that are on the field have to do with unblur and onfocus, would it be the onchange event. The typeahead tab on the properties for the field do not have events.

Thanks

Post a Comment