In FMP, value lists from a field automatically show only one instance of a value, even though it may recur many times in a table.
In Servoy, choosing “All Values From” a field shows every instance, including empty fields. Is it possible in Servoy to show only unique values and to exclude the blank records?
Secondary question: is it possible to preset a default value for the field?
Servoy has a very powerful feature that allows you, for example, to display a value in a value list but “deliver” the ID of that value in the field. In such an occasion it would be terrible if values were omitted just because the name is empty or whatever. So the answer to question one, I guess, is no. You should take care that value lists show what you want.
Another extremely powerful feature is the ability to set value lists “on the fly” (a dream for all FM developers). You have a method setValueListItems in the application node, that allows you to set value lists with whatever you want at runtime. In combination with a query that you can define yourself you can make sure that you have no empty values (“… where column is not null”) or whatever you want.
See the sample of application.setValueListItems for details.
And additionally: If you do this setValuelist with data retrieved by an SQL statement, you can include a “group by” in the SQL, thereby filtering out duplicates.
I have a field which is populated with group names. Lots and lots of duplications along with some blanks. I want to extract a value list made up of only the UNIQUE entries and not include any blanks.
That’s what FMP does by default. However Servoy simply duplicates every entry in the column. Definitely NOT what I want.
I’m delighted I can have a popup with names of groups that will use the group id when the user makes a selection. I’m also pleased I can sort the value list any which way. And generate value lists on the fly.
The issue right now is UNIQUE entries only and no blanks. Likely the index for the column, but not sure how to do that.
or if your select returns several columns you can do a “select group_id, group_name from groups GROUP BY group_id, group_name”. That gives you every unique combination of group_id, group_name.
You need to study the basics of SQL . These questions are actually not Servoy questions…