Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Constructing field contents to update a row
Sun, Aug 18 2013 4:39 PMPermanent Link

Tim Frost

I seem to have got past my earlier problems (in another thread) about updating a database, apart from one issue.

I have a simple table and a form with a data-bound, read-only grid at the top, and data-bound fields which allow editing below.  I can select a row at the top, edit the fields below (which starts a transaction in Dataset.BeforeUpdate), and then click a button to commit.  Everything works.  However I also have a panel in the bottom half where the user can click various things to construct a new string value for one of the fields.  As soon as the user clicks anything, I start a transaction if there was not one started already.

On each change in the panel, the onchange events get me a new string to assign which I want to save in the database.  I have tried saving it into the cell (where it appears), or into the field (where it appears) or into the dataset column (which causes it to appear in both the grid and the edit field).  But on pressing commit, the database is not updated.  Keying the same value manually in the edit field commits correctly.

Eventually I want to remove the edit field for this column and use only clicking to construct the value.  What do I have to do to make this stick?  The outcome is the same whether I use the IDE or the EWB web server and the database is ODBC.
Sun, Aug 18 2013 8:30 PMPermanent Link

Tim Frost

... and in the same way if I cancel the transaction having constructed and assigned a string to the bound field the new content remains visible, even though the transaction has been cancelled.  It seems the Start Transaction / Commit / Rollback mechanism only works if you physically type characters into the field!  I urgently need a workaround for this issue.
Mon, Aug 19 2013 2:37 AMPermanent Link

Matthew Jones

Tim,

The source to the grid is in the framework, so you should be able to see
how that is making the change, and thus replicate it yourself. You say you
start a transaction, but I presume you put the record into edit mode too?

--
Matthew Jones
Mon, Aug 19 2013 1:32 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tim,

<< On each change in the panel, the onchange events get me a new string to
assign which I want to save in the database.  I have tried saving it into
the cell (where it appears), or into the field (where it appears) or into
the dataset column (which causes it to appear in both the grid and the edit
field).  But on pressing commit, the database is not updated.  Keying the
same value manually in the edit field commits correctly. >>

My question would be the same as Matthew's - are you calling the dataset's
Update method before trying to edit the column manually ?  I think I need to
add an exception for this.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Aug 19 2013 2:15 PMPermanent Link

Tim Frost

"Tim Young [Elevate Software]" wrote:

 My question would be the same as Matthew's - are you calling the dataset's
 Update method before trying to edit the column manually ?  I think I need to
 add an exception for this.

Thanks both.  I was not, but since late last night I now am calling it!  I might have called it a lot sooner had there been even one occurrence of the word 'update' among all the EWB examples, so anything you can do in this area to help the new EWB user would be of great help!

It is not quite straightforward however, because this still requires action from me to handle rollback.  I have to make a copy of the original field when the transaction is first started, then restore it myself (still under the influence of the 'update' statement) if the user presses cancel.  This is only obvious after working out that it is needed, not before.
Fri, Aug 23 2013 9:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Tim,

<< Thanks both.  I was not, but since late last night I now am calling it!
I might have called it a lot sooner had there been even one occurrence of
the word 'update' among all the EWB examples, so anything you can do in this
area to help the new EWB user would be of great help! >>

I'm not sure what you're referring to - it's mentioned quite clearly here:

http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Updating_DataSets

<< It is not quite straightforward however, because this still requires
action from me to handle rollback.  I have to make a copy of the original
field when the transaction is first started, then restore it myself (still
under the influence of the 'update' statement) if the user presses cancel.
This is only obvious after working out that it is needed, not before. >>

That is not correct - a Cancel will restore the previous version of any row
being updated.  And, any rollback operation will automatically put any
dataset into "Browse" (read) mode before undoing the operations involved in
the transaction.

Tim Young
Elevate Software
www.elevatesoft.com


Image