type ahead in 2.1b4 not working?

Hello, maybe I got it wrong, but the type ahead field doesn’t seem to work in 2.1b4. It is a field without a value list. With value lists it works great.

But, just for my understanding, how do you want the field to know how to ‘type ahead’ without a valuelist?

I am not completely sure about the type ahead behaviour.

As far as I understood I can either attach a value list to an editable text field, then I have type ahead “on the fly”.

The other possibility is to make a field of type “type ahead” and Servoy builds a “value list” on its contents. The difference is, that Servoy complains in case 1 if you type a value that is not in the list and won’t do that if it is a text field.

Clarification, someone?

Thanks, Patrick

I really don’t think that the storage of a value is done automatically but I am happy if I am wrong :D

I would find it logical if we pick up the (new) value and put it in our own (defined) valuelist.

2 modus yes:

1> with a valuelist then the values are comming from a valuelist (so different table/column)

2> without a valuelist, then the list is build from the column itself.

Can only be used for text fields no other types are supported.

Which case is now going wrong?

case 2)

and how does it go wrong (B5)??
because that is the case i always test and it works perfectly for me.

it never shows a value list. There is no type ahead functionality at all.

works perfectly in my test

for example in the crm demo. I made in the company_name an TYPE_AHEAD field.
And then when i start typing i see the possible company names ..

I will see if I can produce a reproducable test. The only thing I can say is that the underlaying table is pretty big…

if that is the case. Please add an index to that field where you build the type_ahead field on.

Haven’t tested my other problem yet, but came to a new situation:

I have a global were a user types a search expression. onAction of the global the search is fired. The search criteria is stored in a table per user. Want I want to do is this:

Define a value list for that global, that retrieves all stored searches. On the global I want to use type ahead functionality to show the user his last searches while he types… What happens is this:

  1. When attaching a value list and the global being a combobox there is no type ahead functionality
  2. When attaching a value list and the global being a text field ther is type ahead functionality but only values in the value lists are “allowed”, so you can never search for something new
  3. The field type “type ahead” can not be used here, because the values come from a different field (of course, not the global).

Any ideas about this?

Thanks.

1> is logical in a combo you don’t have type ahead

3> you can use TYPE_AHEAD here but you need to attach a valuelist (But this is exactly the same as a Text Field with a valuelist, there is no difference)

2> That seems to be a bug.. A typeahead never disallows anything. It just gives you options. I will try to make an example so that i can see this for myself.

regarding 2): the text you type that is not in the value list is red and doesn’t get saved…

It can be that a red text means the formatter is wrong
It can’t format the text you input to the right value.

this is what happens if I type something that is not in the value list. It is just a regular text field…

fixed in 2.1b6
this was a case that text should be required to be one of the list
Now it is not possible to have a textfield (no combo) and that a value must be in a valulist. But this is a strange thing. Because how can someone choose something they can’t see.

I don’t think that this is so strange. See my example: you have a “learning” value list. You either choose an item that you have typed before or you type a new value that is then stored for further uses…

I tested typeAhead a little further:

A simple text field formatted as typeahead without any value lists doesn’t do anything on a simple table with 5 records. The problem seems to be related to MS SQL Server, because now, in the log I get this:

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT DISTINCT is specified. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT DISTINCT is specified.com.servoy.j2db.persistence.RepositoryException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT DISTINCT is specified. [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
at com.servoy.j2db.dataprocessing.SQLEngine.a(Unknown Source)
at com.servoy.j2db.dataprocessing.SQLEngine.performQuery(Unknown Source)
at com.servoy.j2db.dataui.t$b.if(Unknown Source)
at com.servoy.j2db.dataui.t$b.do(Unknown Source)
at com.servoy.j2db.dataui.t.eK(Unknown Source)
at com.servoy.j2db.dataui.t$a.insertUpdate(Unknown Source)
at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source)
at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source)
at javax.swing.text.AbstractDocument$DefaultFilterBypass.replace(Unknown Source)
at javax.swing.text.DefaultFormatter.replace(Unknown Source)
at javax.swing.text.InternationalFormatter.replace(Unknown Source)
at javax.swing.text.DefaultFormatter.replace(Unknown Source)
at javax.swing.text.InternationalFormatter.replace(Unknown Source)
at javax.swing.text.DefaultFormatter$DefaultDocumentFilter.replace(Unknown Source)
at javax.swing.text.AbstractDocument.replace(Unknown Source)
at com.servoy.j2db.util.a8.replace(Unknown Source)
at javax.swing.text.JTextComponent.replaceSelection(Unknown Source)
at javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at com.servoy.j2db.dataui.DataField.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at com.servoy.j2db.dataui.t.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

can you run with -DSTACKTRACE=TRUE for one time to see what the exact sql statement is where MSSQL server is complainig about
Because to me it seems if you have a TYPEAHEAD field without valuelist on a text column then what is in the order by is also in the select distinct!

(select distinct columname from xxx order by columnname)

But somehow it is a bit different.