Hi,

What is the Formspider way to revert changes before they are committed to the database?

In Oracle Forms users could press the "Clear Record" or "Clear Block" key or just press "Run Query" again (with the question if the user wanted to commit the changes).

In Formspider the panels are stateless, so i think that "just" a re-query would be perfect to revert the changes. Is that correct?

Or would it be better to implement something like the "Clear Record" function? For example: when a user is working on an existing record, the function could requery that record. And when he is working on a new record, the function could "delete" that record. I think that re-query would be more safe/secure, because a "Clear Record" would only rollback the current record, while the user could have been working on other records as well.

Or is there a function somewhere that i have not yet discovered?

Kind regards,

Jan Willem

asked 07 Sep '15, 05:41

Jan%20Willem%20Vermeer's gravatar image

Jan Willem V...
1231330
accept rate: 0%


Hi Jan,

You can certainly use api_datasource.executeQuery to cancel the updates in a datasource and retrieve the rows from the database. This method is actually used quite often.

If only a single row is modified, you can use api_datasource.refreshRow API to only requery this particular row from the database. We prefer to use this over a full datasource re-query whenever it is possible.

For more complicated use cases where you don't really want to re-query from the database, you can use the api_datasource.takeSnapshot and api_datasource.loadSnapshot API's. As the name suggests, takeSnapshot makes a copy of the current state of the datasource. Later, you can call loadSnapshot to bring the datasource to this previous state you captured.

Kind Regards,
Yalim

link

answered 08 Sep '15, 08:49

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

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:

×12
×9

Asked: 07 Sep '15, 05:41

Seen: 662 times

Last updated: 08 Sep '15, 08:49


© Copyright Gerger 2017