Showing results for 
Search instead for 
Did you mean: 

Unable to get matrix changes to commit

Former Member
0 Kudos

This should be a really simple example. I added a user table with only edit fields and no combo boxes, check boxes, etc. This form can only edit values and can not add or delete rows. There is only one data source on the form.

I am using LoadFromDataSource to populate a matrix and that works without any problems. If I change a value on one of the rows the form changes to edit mode. If I update nothing happens and the form stays in update mode. I use FlushToDataSource and for large result sets I get an hour glass. Using SQL profiler I see each row being queried one at a time but nothing is ever actually updated.

If I requery after FlushToDataSource by using oMatrix.Clear() and oMatrix.LoadFromDataSource() the changes are lost. This occurs even if I actually requery the data source before using LoadFromDataSource(). If I try to force the form to "ok mode" then edit mode is cancelled and the changes are lost.

So, what am I missing? This should be really simple. I don't want to iterate through the matrix to get and update each line to the database.

Reading looks like this and works fine:


SAPbouiCOM.Conditions oConditions = new SAPbouiCOM.ConditionsClass();
SAPbouiCOM.Condition oCondition;
oCondition = oConditions.Add();
oCondition.BracketOpenNum = 1;
oCondition.Alias = "U_BatchId";
oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
oCondition.CondVal = intBatch.ToString();
oCondition.BracketCloseNum = 1;

SAPbouiCOM.DBDataSource ds =




Update looks like this but does nothing:

//oMatrix.Clear();    (this causes the changes to be lost)

Am I supposed to be required to iterate through the dataset after the flush and define a UserTable for my table and manually update each changed record one at a time? I thought FlushToDataSource() was supposed to do that.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

By maintaining a ArrayList of changed matrix rows I cut down on the database activity as much as possible.

After the FlushToDataSource I update the table manually for each changed row and it works. However, I still have to force the form into OK mode afterwards.

Former Member
0 Kudos

I definately have to iterate through the datasource for the matrix and manually get and update record one at a time.

That said, if FlushToDataSource executes a query for every record in the datasource then why doesn't it do something? Why not put a "dirty" flag on the record or produce an arraylist of matrix rows that have been changed so that the entire result set doesn't need to be queried?

As it is I will maintain an arraylist of integers for updated rows on the matrix and only update those rows. I already have an arraylist of deleted rows to delete them when the update is processed after prompting the user. I was always under the impression that FlushToDataSource was supposed to do more than it does.