Value List result not showing

Servoy Developer
Version 3.1.3-build 407
Java version 1.5.0_06-68 (Mac OS X)

I have a form on a tab panel which is set up to have a valuelist attached
The value list is loaded by a SQL query as follows:

var query = 'select property_value , zzid_property from property where property_category_type = "job_title"';
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query, null, 250);

application.setValueListItems('job_title',dataset);

The query fires onFocusGanied and I am selecting both the property_value AND the primary key.

The format above allows me to view the value and return the primary key into the dataprovider when chosen.

This all seems to work fine when choosing a value.

Upon retruning to the form later or on relaunching the solution the value does not show !

I understand that the value does not show because I have not loaded the value list from the SQL query at that stage.

As soon as I click into the field again and the valuelist is loaded then I can see the values in all records.

So, my question is what is the most efficient way of doing this operation ?

Do I put the loading of the value list into the onLoad or onShow of the form or is there a better way of attacking this ?

Cheers
Harry

Now this is bugging me further.

I’ve tried attaching the method to both the onShow and onLoad of the form but the only thing that seems to trigger displaying the value is by clicking into the field.

Cheers
Harry

Hi Harry,

Do you use a combobox with the edit property disabled or enabled ?
I have had better results with the edit property disabled when using 2 column valuelists.

Hope this helps.

A display/return value valuelist must always be attached to a non-editable combobox…

Hi Robert,

Thanks for the feedback

I actually have it set as a type ahead.

The field properties are as per the screen shot with the SQL query to load the valuelist currently being fired using the onShow of the form

I have the behaviour now using the above setup where I can get to the form and the value will not be showing but if I move forward a record then it will start showing in all records - so in this case I am not clicking into the field just navigating to another record !?

Cheers
Harry

A typeAhead will not work. What should happen in a situation where your value list looks like

value1|1
value2|2

and your users types “val”? What value should Servoy save in the DB now? Make it a non-editable combobox and it will work.

Hi Patrick,

patrick:
A display/return value valuelist must always be attached to a non-editable combobox…

May I ask why ?

This all seems to work as I would expect except for this annoying property of not showing the existing value when I first access the form !

Is my only option to go to a combobox as it just doesn’t fit with the look of the form !?

Cheers
Harry

Hi Patrick,

Apologies I do understand the point that you make about entering partial text values which cannot return the id :(

I will review options here as the valuelist with type ahead gives the requisite functionality but not with the control

Cheers
Harry

The point is not only about partial texts, but also about editable comboxes. What happens if the user in my example types in “value3” if the field is editable?

Perhaps a good point for discussion then :)

Looking at it in my specific case only:

If the column behind the dataprovider is an integer used to store the value ID, then any data ‘typed’ which is not part of the valuelist is ignored and not written to the backend.

The above statement seems to be true in my tests

So the only time in my case when an ID is written to the backend is when the user either:

  1. chooses an approprite item from the value list by double clicking on it
  2. types the actual name of a value in the list

So, what am I missing here ?

Because if this behaviour bears out then it satisfies what I want to achieve and my problem is the display of the value not appearing onShow of the form as per my original post

Cheers [learning all the time]:smiley:
Harry

I currently don’t understand your problem. Just take it as it is: if you want to use a display/return type value list, you can only attach it to a non-editable combobox. Every other setup will lead to strange results if it works at all.

The typeahead/lookup field can handle string/id combinations. It also should handle an id that is currently not in the list (it should just load that one) But it is much better if you do load the valuelist as early as possible (onload) that should avoid those strange results.

Thanks Johan,

I will try to create a simple solution showing the latency in data display for the values and post this.

P.S. Kuyt is still playing great football for Liverpool :)

Cheers
Harry

P.S. Kuyt is still playing great football for Liverpool

Who the f** is Kuyt? Is that the a Servoy developer?

:lol: :lol:

IT2Be:

P.S. Kuyt is still playing great football for Liverpool

Who the f** is Kuyt? Is that the a Servoy developer?

Now, now, Marcel, you sound like a Feyenoord supporter with sour grapes :lol:

Cheers
Harry

Now, now, Marcel, you sound like a Feyenoord supporter with sour grapes

Well, it may sound strange… But I really don’t know who he is, from you mentioning football I guess it is a sportsman but isn’t Developer with or for Servoy major league sports either?

Apart from Kangaroos in North of Holland, there a lot of other amazing discoveries about dutch people, aren’t there Harry? ;-)