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:

  • Use the data source API, but this would require the scroll through all the rows In order to find the modified, new and deleted. It also seems to me, that a lot of data copying is going on when using the API – at least from how the tt_row is represented.
  • Use the physical table created by FS. I guess the usage of physical tables would be faster, but I cannot find the API for accessing the datasource “physical table”. How can I get the name of the physical table (not from the IDE)?

How would you approach this?

Best regards,

Blaž

asked 07 Nov '13, 11:12

bepl's gravatar image

bepl
235
accept rate: 0%

Hi Blaz, What is the datasource based on?

(07 Nov '13, 11:25) Yalim Gerger ♦♦

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ž

link

answered 07 Nov '13, 13:18

bepl's gravatar image

bepl
235
accept rate: 0%

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

link

answered 07 Nov '13, 13:33

Michiel%20A's gravatar image

Michiel A
5161648
accept rate: 13%

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
Yalim

link

answered 07 Nov '13, 13:36

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

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ž

link

answered 07 Nov '13, 14:29

bepl's gravatar image

bepl
235
accept rate: 0%

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 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×64
×13

Asked: 07 Nov '13, 11:12

Seen: 1,746 times

Last updated: 07 Nov '13, 14:46


© Copyright Gerger 2017