cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting matrix row data -> what method do you use?

Former Member
0 Kudos

There appears to be no way using the matrix methods to determine whether or not a given row has been deleted.

Since there is no way to flag a record in the DBDataSource as being deleted matrix.FlushToDataSource() is no help here.

Do I just need to save the key(s) of deleted rows for later use, delete the records from the database immediately, or do something else?

I'd like to hear how others are updating the database with matrix rows which have been deleted.

Thanks!

Bill Faulk

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bill,

you right, if you use Flushtodatasource, you won't know if rows has been deleted.

What I do is that I catch the menu event Delete Row, and I add, in a collection, the keys values of the row deleted.

when I save the data to the database, I first check if the collection is empty, if not I delete the data using the key added in the collection, and then I add/update the data from the datasource.

Sebastien

Former Member
0 Kudos

Thanks for the reply Sébastien, that's precisely what I did. I appreciate the reply since I have only seen my own addon thus far. It's good to know I'm doing things the "right" way.

Since I have row selection disabled I save the row # when the user clicks (or right-clicks) on a cell and when remove is selected I save the key of the current row in an ArrayList, delete the matrix row, and set the form mode to fm_UPDATE_MODE. When update is pressed I tell the user how many rows are to be deleted and ask for confirmation. After this I update normally in case the user edited the remaining rows.

I was concerned that the db data source would still have the old records but after the first GetLineData statement the DBDataSource only contains the remaining records. Oddly enough, after the FlushToDataSource and BEFORE the first GetLineData the DBDataSource still has the deleted rows in it.

Answers (0)