newRecord in FormInDialog with DB transactions issue

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

newRecord in FormInDialog with DB transactions issue

Postby pbakker » Thu Mar 24, 2005 9:39 pm

Hi,

Got the following setup:
- button on a form
- when button is clicked:
- A DataBase transaction is started
- A new record is created
- The new record is shown in a formindialog (the form is in record view)
- on the form in dialog is a cancel button
- when the cancel button is clicked, the following happens
- the formindialog has to be closed
- the transaction needs to be rolled back

Now the issue is the following:
whether or not I roll back the transaction first and then close the formindialog or do it vise versa, Servoy tries to save the new record. This causes an error, since some of the columns of the table of the new record are defined as not nullable and no value has been filled yet for it.

This in no issue prior to RC3 as Servoy would fill 0 or '' into the columns, but since RC3 this doesn't happen anymore.

How should I solve this?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby ROCLASI » Thu Mar 24, 2005 11:10 pm

Hmm...quick fix/workaround?
Set default values in Servoy's column definitions.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Postby pbakker » Fri Mar 25, 2005 9:39 am

Hmmm... thought of that, don't like it :?

Question is: Am I doing something wrong, or is this a bug. Or is this something that comes with the fact that Servoy doesn't fill 0 or '' anymore into those not nullable field and is the only way to get rid of the errormessage is your suggestion?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Mon Mar 28, 2005 1:38 pm

you could try to disable auto save (see application) and then when you press cancel you delete the current "new" record else you do save youre self.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8841
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Postby pbakker » Mon Mar 28, 2005 9:17 pm

Allready had AutoSave disabled, that didn;t solve the problem.

Added the deleteRecord to my Cancel method and now it works.

So, is this the way to go, or is there an issue with application.closeFormDialog();, that does a save to the DB, eventhough the autosave is disabled?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Postby jcompagner » Thu Mar 31, 2005 11:49 am

yes it will save. the autosave disabled only is for focus lost auto save. When going to another form or when going to another record (and edit that one) wil save the record.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8841
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests

cron