Page 1 of 1
Using database view as datasource forform -> PK ERROR
Posted:
Fri Aug 23, 2019 8:52 am
by v.weimer
Hi,
scenario:
- create a view in a database (maxdb)
- bind this view to a form to show data as datasource (filter the view before displayed with find-search)
-> in developer everything is fine, but after deploy I get always a PK error for the view in servoy admin page and a crash on the page - no data is shown.
deploy server is a Tomcat on suse linux SLED 15.1 java 9.
Could anyone suggest a solution and/or explain why.
Thanks in advanced.
Re: Using database view as datasource forform -> PK ERROR
Posted:
Thu Sep 05, 2019 2:48 pm
by v.weimer
Hi together,
I investigated a bit more time and could now give a better summary of what happens.
The form uses a FoundSets of "table A" and I do have 3 Table WebComponetns on that form. Those WebComponetns do use database views (not related to "Table A") as separate FoundSets.
Now I do a find/search on one of the FoundSets based on a database view and used by the Table WebComponetns.
This produces the exception. No pk ...
As long as I use for the Table WebComponetns the FoundSet of the underlying form I can perform a find/search without any error. I guess a real Table would course no issues, too.
Bug or intended?
Workaround is currently to separate the Table WebComponetns in forms and use a tabless panel to show the form/data. The form and Table WebComponetns do have the same datasource (database view) and everything is fine with find/search.
Re: Using database view as datasource forform -> PK ERROR
Posted:
Thu Sep 05, 2019 6:45 pm
by mboegem
Hi v.weimer,
Most likely your view doesn't have a pk, or at least that is not known as pk (or dbident) to Servoy.
That's what causing the error.
Please be aware: since views are updated on database level, Servoy is not aware of any changes in the data and therefor won't update your formdata using dataBroadcasting.
I don't know why you are using views, but there are a few 'Servoy way' options to get your data from the database into Servoy without retrieving all columns of a table (what Servoy will do by default).
1) use datasets and Servoy's power-grid
2) use datasets, turn them into in-memory datasources and use Servoy's ng-grid
3) use the recently introduced view-foundset and again use Servoy's ng-grid
The latter uses the built-in Querybuilder object and you will be able to set whether you expect any updates from databroadcast.
The first 2 options will not support any updates through databroadcasting.
Hope this helps.