Valuelists

Hi,

Is there a way to see, or can someone tell me how Servoy
puts the data in a field after a selection is done in a valuelist.

To find out out by experiment i created a simple valuelist (id,name)
and assigned it to a combobox. (Id is stored, name is shown)

I then put several values in the table on which the valulist is based.
I also put in a duplicate value :

100 Nieuwenhuis
200 Nieuwenhuis

When i activate the valuelist i indeed see the duplicate entry’s.

But : no matter which one i select, Servoy puts the same number (100) in the
combobox field. I would expect that Servoy uses the number of the line i select in the valuelist.
But it seems that some kind of query is done on the name value to retreive an id value.

I am not able to see the query that is used to select the value.
Maybe this is not done by a query, but internal by Servoy.

Regards,

Did you put in the values for the valuelist manually?

Did you separate the id from the name with a | (pipe)?

No, they come from a table.
I’ll try the same test with a manual valuelist.

Regards,

I created a manual valuelist now :

jan|1
kees|2
piet|3
piet|4
klaas|5

I selected each value and looked at the stored value :
This is the result :

jan : 1
kees : 2
piet : 3
piet : 3
klaas : 5

so, the same result. The value 4 can never be selected.
This list makes no sense i now, but as i mentioned, i just want to understand how the value from the list is selected.
It is surely not done by using the id value from the selected line in the valuelist !!

Regards,

Pretty…

On one hand strange but on the other hand it sort of makes sense (although it is an arbitrary/subjective decision) because visible values are equal.

Agree, but why do a query ? Is it a query or another mechanism ?
(in the case of a manual list there is no query, but the effect is the same)

Both values (id,name) are known at the moment you select the entry in the valuelist.
If you simply display the name and use the selected id to return to the field then
in the case of duplicate names, the correct id is still used.

No need to do a query at all !!

Or am i overseeing something ??

Maybe a Servoyan can tell us something …

what happens if you use all three columns of the valuelist

For instance : Display two columns (Lastname, Firstname) to choose from and return the Id to the field.
Will a query be done like : select id from

where lastname=‘?’ and firstname=‘?’ ??

I saw a query that used an OR in that case (select id from

where lastname=‘?’ OR firstname=‘?’)

I only saw it once (not all queries for valuelists are shown as far as i can see)
but to be sure i started this post.

Regards,

Hans,

Servoy keeps 2 lists for the value list, display values and real values.
We use the selected display value, not the selected index and find the real value for the selected display value.

On type-ahead filelds sometimes queries are fired because we have to filter on the characters already entered.

Rob

Hi Rob,

Thanks for ansewering !!

You say :

We use the selected display value, not the selected index and find the real value for the selected display value.

i asume that the find is not done by a query, but by an algoritm in the software ?

Regards,

Yes,

Rob