I am putting together a table to hold job names that the user will choose from when filling out a work order. I have decided to make it a combobox so the user can’t mess with the name. I have a problem how do you get a combo box to display the entire contents of a table if the row count is more than 200?
Ola, in this “final” answer I’m interested as well!
What I currently do is: I have a form called XXXValueLists. This form loads all value lists which size is to big to define with Servoys value list dialog. Or which are defined by additional parameters. The onLoad method looks like
var query= "SELECT <attr1> FROM <tab1> WHERE ...";
var dataset = databaseManager.getDataSetByQuery(..., query, null, 1000);
application.setValueListItems("myJobNames", dataset.getColumnAsArray(1));
My problem is that I don’t know how to trigger the onLoad method, since the value list has to be filled before it is accessed. In your solution you might put the above code directly to the form where the combobox is displayed.
What I also don’t know: Doesn’t Servoy hold a specific number of forms in memory? And if more than this number of forms are used by the application, the least used form will be unloaded? Is this transparent for us as developer? Will the form be stored with its’ current “state”? What is executed when the form comes back into memory? Is onLoad executed again? Is it possible to define forms which cannot be unloaded?
By the way: Isn’t 500 rows the maximum number of rows loaded for a value list instead of 200?
I am putting together a table to hold job names that the user will choose from when filling out a work order. I have decided to make it a combobox so the user can’t mess with the name. I have a problem how do you get a combo box to display the entire contents of a table if the row count is more than 200?
Check out the way Birgit it does. Works fine!
My problem is that I don’t know how to trigger the onLoad method, since the value list has to be filled before it is accessed. In your solution you might put the above code directly to the form where the combobox is displayed.
I don’t think so. It needs to be set before the form is shown. So, you can add this method to onload and that way it should show up as expected…
Doesn’t Servoy hold a specific number of forms in memory?
Yep, in the early days it was limited to 200. If I am correct it is now related to assigned (client) memory.
And if more than this number of forms are used by the application, the least used form will be unloaded?
Correct!
Is this transparent for us as developer?
No, because we don’t know how a user uses the solution.
What is executed when the form comes back into memory? Is onLoad executed again?
Yes it is.
Is it possible to define forms which cannot be unloaded?
Not that I know of but this would be a nice feature request. Beware though, defining too many such forms means you will swap/reload the other forms more often…
By the way: Isn’t 500 rows the maximum number of rows loaded for a value list instead of 200?
Have not checked the docs but I believe you are right.
I have a form called XXXValueLists. This form loads all value lists which size is to big to define with Servoy’s value list dialog. Or which are defined by additional parameters. The onLoad method looks like
Is this form connected to the table the valuelist should pull from?
How do I get the results of the query into the valuelist portion of the field that I want it to affect?
I assumes that it is done through the dialog box where valuelists are assigned to fields. But this can’t be done since it is not a real field.
I then started to look at adding it as a method. I can’t see where valuelists can be assigned to fields via a method using the elements section. I see that it is possible to get the valuelist the field uses, but not to set one.
Personally I do not think my users would appreciate a combobox with more than 100 items on it. I would rather allow the selection of the desired values from a tabpanel / form in dialog / portal with the help of some find / filter / index.
Is this form connected to the table the valuelist should pull from?
No, it is not.
How do I get the results of the query into the valuelist portion of the field that I want it to affect?
I assumes that it is done through the dialog box where valuelists are assigned to fields. But this can’t be done since it is not a real field.
Yes, the (custom value) value list is assigned to the field by editing the property “valuelist” in the designer. Do I understand you right, the selected value is not a database field? Then, as far as I know, you only have the chance to define a global variable to store the selected value (calculation does only make sense to display a calculated value).
I then started to look at adding it as a method. I can’t see where valuelists can be assigned to fields via a method using the elements section. I see that it is possible to get the valuelist the field uses, but not to set one.
I thought your prpblem is how to display a value of the value list and how to select a value. Do you also have a problem to attach a value list to a field? Here is all I did:
define your value list (a custom value) in the value list editor. You only define a name.
in the designer, select the field you want to use as a combo box.
define the display type as combo box.
define the data provider to be a global variable.
define the valuelist property to be the above defined valuelist.
in the onLoad method you load all your values. And you give the valuelist all these values (display values and maybe stored values).
you then can access the global variable in any method (read and write).