Separated foundsets in forms

Hi!

I have this doubt, I have one foundset in a form and when I click in one button will opened a lookUp window with the same foundset but wanted them to be separated.

I need do changes in the foundset of this lookUp window but not to make this changes in the first window until I press the save button.

Someone have any idea for do that?

Thanks in advance!

Hi,

Select -seperate- for the namedFoundset property of the form that should get a private foundset.

Hi.

I had thinking the same solution but doesn’t work, the foundsets are still related.

What version of Servoy are you using? Did you set the property at designTime? I just created two forms based on the same table and set one namedFoundset property to -seperate-. Of course they still display the same data but the navigator works independently.

…and btw., you can duplicate the foundset in your lookUp Window by

forms.lookUp.foundset.duplicateFoundSet()

and clear the duplicated foundset e.g. on hide the lookUp window

forms.lookUp.foundset.clear()

Our Servoy version is: 6.0.5 - build 1230

The problem can be that it’s a tab panel and my foundset is a related foundset?

Ok, than you can first unrelate the foundset

forms.lookUp.foundset.unrelate()

Doesn’t work tgs, this is one screenshot, I hope this helps in something

Hi pentamsi,

I don’t understand the sense behind your solution. You would like to edit data of records in a table in a seperate window, but the changes should not be displayed/stored in the main window?
You can display so many foundsets as the RAM and CPU of your machine can manage it, but after a save and/or delete this take effect on the table and will be displayed on next load. You cannot seperate data of columns in a table like versioneering.

Regards,

Hi.

Ok, and a lot of thanks, tgs this is indeed the thing I wanted to know.

I can do it creating a new foundset, the explaination for doing that is that I want the user can change all and do testings without saving and when he is sure that this is the good form save the foundset.

I repeat thanks for your time.

Ah, ok, now I understand. Then you may also want to check out transactions:

http://wiki.servoy.com/display/public/D … nsinServoy

They allow you to start a transaction, let the user make changes and commit or rollback if necessary. Then you don’t have to create an extra foundset.

An other way perhaps you can do that without separate foundsets is holding the records for editing in a transaction. With save you commit the changes or you can cancel it with a rollback.
But be careful in using transactions. A transaction is locking the table and not all SQL databases are fit for using transactions as you like.

Hi another time!

I proved this solutions, but I can’t use that because is one of the most important window and I can see when we are changing records, the first foundset change too, yes when we press cancel button, it do a rollback but if the user changes records and the the light goes out the records are different than the original and we dont do the rollback.

This is a disaster for us.

pentamsi:
but if the user changes records and the the light goes out the records are different than the original and we dont do the rollback.

What does “the light goes out” mean?
Perhaps you should think about a redesign of this function in your solution? If you would like to edit records of a loaded foundset without displaying the changes in the mainwindow, I think you have to do this in separate foundset and possible in a separate form/window.
Do you make a databaseManager.saveData() after the commit of the record changes? If not, perhaps you could hold the changes in memory/on the form and not written to the db.

Regards,

Hello pentamsi!

Ok, to be clear, which one of the two would you want to do?

  1. Be able to add/edit records on the lookup form and have them affect the database directly but not show up on the other form until the user closes that form
    or
  2. Let the user add/edit records on the lookup form but not have them affect the database directly until the user confirms the changes or clics on ‘Save’

Other questions:

  • On lookup form, do you set the “namedFoundset” setting to “separate”?
  • Could you give an example of your code?

tgs,

What does “the light goes out” mean?

means when there is a power outage there is no way of running a rollback. On that note, I believe that if the user started making changes and there is a power outage before there is a database.commitTransaction, the changes made will not be made on the database. Using databaseManager.startTransaction along with commit and rollback should fulfill your requirements in case you are looking to do item 2 above.

Regards,
jd

Hello, we are interested in the second option:

  1. Let the user add/edit records on the lookup form but not have them affect the database directly until the user confirms the changes or clics on ‘Save’

And yes, we try to put the namedFoundset to separate, but all the changes we make in one form, affect in the other, and in the same case in the foundset. We want until the user don’t accept the changes anything send to the database.