Hello, I am wondering what is the best way to update a data source that is not based on table. From what I could see there are at least two options:
How would you approach this? Best regards, Blaž |
Hi Yalim, well a view or a query. I want to do my own save of the datasource changes. I want to do a program that would convert our application windows created in PowerBuilder to FormSpider. Converting just the basic functionalities of a few window types would give us a huge jump start and from what I have seen on the FormSpider this should not be such a big problem. Best regards, Blaž |
Hi Blaz, In my experience, the easiest solution would be to use views with 'instead of' triggers. That way you can use the Formspider datasource API to manipulate the data, and use the instead of trigger on the view to capture the insers/updates/deletes on that view, and process the records any way you want. Let Formspider figure out which rows are new or modified. In my opinion using views with instead of triggers is the most flexible way to build Formspider applications. In my application, all updatable datasources are based on views with instead of triggers. Best regards, Michiel A |
Hi Blaz, For any non-table based data source definition that you want to update, I'd create a View. Next, I'd create instead of update, delete and insert triggers for the View and handle any DML coming to the View from these triggers. In these instead of triggers, I'd call API's I'd write for every DML operation in a package called something [MyView]_API. Finally, in Formspider, I'd create a data source definition based on this View and let Formspider issue regular DML statements to the View. Actually, I'd do the exact same thing event for table based data source definitions. :-) Hope this helps. KInd Regards Hi Yalim, I guess we agree :) Best, Michiel
(07 Nov '13, 14:19)
Michiel A
Yes Michiel. Word for word. :-)
(07 Nov '13, 14:21)
Yalim Gerger ♦♦
|
Hi Yalim, Michiel oh, I thought that updating a view is not possible, since DML possibilites get disabled if you select a view in a data source dialogue. I could really make use of the datasource data (buffer) and from what I see they are beautifully saved in the »physical table« with all the extra info needed. I was also thinking of creating my own filtering since it seems that all that you have to do is set the filtered flag. I think that direct access to the buffers has lots of potentials. I know that the buffers can be accessed via the API, but I cannot help my self seeing all the uneccessary code dooing it via the API, when all is at hand. Thank you for you answers. Best regards, Blaž HI Blaz, After you select a View for your Datasource Definition, pick a primary key. This will enable DML for the Datasource Definition. And yes, the instead of triggers are super cool. The need to access to the rows in the datasource should be extremely rare.
(07 Nov '13, 14:46)
Yalim Gerger ♦♦
|
Hi Blaz, What is the datasource based on?