After a creating a dataset with getDatabyQuery with more than 1 rows, I need a table selection form to select the row from which I have to copy a couple of columns (dataproviders). How can I resolve this?
I have not found any example for this in the reference book or this forum.
It is needed to select the correct adress from an adress table and to put in an application form.
best regards,
Jan Willem
I created a table & form (list), to display the query result in a pop up dialog. On this form are checkboxes, to select ( in my case ) the rows & columns of interest
the user then clicks a “Continue” button, to trigger a method, and the selected items are copied to a “permanent” table, the dialog records are deleted, and the dialog closes
a bit of a “kluge”, but it works
greg
Hi jan Willem,
As greg pointed out you need to create a GUI for it.
You could use a DataGrid bean (new in 3.1) which can be loaded with a DataSet.
Or you setup a list/table view on the table you are querying and use controller.loadRecords(DataSet) to let it load the records. Make sure you select only the PK column, use a table prefix and have an ORDER BY clause.
Using this approach it will load only the first 1000 records of the dataset though.
Depending on the SQL you could use controller.loadRecords(SQL) to let it load more then 1000 records.
So depending on your needs there are several ways to do things.
Hope this helps.
Thanks gents for your replies, but I do not see a datagrid bean in my Servoy Developer version 3.1.2|editor.
Also I query a view, not a table. And in this version Servoy does not support views apperently.
So I do not quite understand the last suggestion. It’s a pity you can not make a list view based on an array, similar tot omnis studio with lists.
So I’m stuck for tonight.
Regards,
jan willem
The datagrid is a bean. You find it in the bean folder in the servoy folder.
if you don’t see it then do a clean install with the Servoy Installer.
To place it on a form you go to the Elements menu and select Place Bean.
Here you select InMemDataGrid and press the OK button.
You can fill it with the following code. Change the names of the objects accordingly.
var sQuery = "SELECT * FROM test_view;",
sServername = controller.getServerName(),
ds = databaseManager.getDataSetByQuery(sServername, sQuery, null, -1);
elements.objGrid.setModel(ds.getAsTableModel());
It does work with views, I just tested it with this code.
Hope this helps.
Hello Robert,
After writing my reply, I looked further on the forum and downloaded the test_datagrid example. From that I succeeded to implement a working prototype datagrid.
Now I am looking to customize the columns width to get a more cosmetic ‘sexy’ look and also to downsize the size of the form with the datagrid: it fills the whole screen despite the given size in the prpoerty section of the form.
So thanks for your support to help going on after the Chanpion League on the tele. ![Smile :-)]()
Regards,
jan willem
Hi Jan Willem,
You can let the bean resize (or not) with the form by using anchors. But with beans you can only set them by right-clicking on them in design mode. So don’t go looking for anchor properties in the properties pane for beans ![Smile :)]()
As for setting column widths via a method. This is not possible.
It would be a nice feature request though.
Hope this helps.