cancel
Showing results for 
Search instead for 
Did you mean: 

DBDatasource and Matrix

Former Member
0 Kudos

In 'Purchase Order' Screen, there is a matrix bound to DBdatasource. when each row gets filled up, the next row gets automatically enabled.

How to implement this feature?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Standard document screens in business one add a new row to the matrix when a valid entry is made in a key field on the last current row on the screen.

You can implement something similar for your own matrices by processing the et_VALIDATE event for a key item in your matrix. If your custom validation is successful and the current row = matrix.rowcount, then call matrix.addrow.

Regards,

John.

Former Member
0 Kudos

Hi John

Thx for ur help.It worked out fine.But i still have one more prblm.Each of my matrix field are bound to DBDatasource.

In Edit mode, i populate the matrix with values.

when i add a new row after the last populated row, the new row gets filled with the same values as the row above it. But i want to get an empty new row.

Please help me out.

Former Member
0 Kudos

When you call matrix.addrow, whatever data is in the current offset of your dbDataSource, and the current values of any UserDataSources will be put into the new line.

All the matrices I have used this technique on are based on UserDataSources, simply setting their .value = "" before calling matrix.addrow works nicely.

For a DBDataSource, you will either need to point the offset to a row in the DBDataSource which has blank details in it, or alternatively requery the DBDataSource with conditions that return no records, set the offset to zero, and then call matrix.addrow.

(NB. The enhancements to DBDataSources in the 2004 SDK should make this a lot easier)

Regards,

John.

Former Member
0 Kudos

John, ur suggestion worked well.

I tried populating matrix using both UserDataSources and

DBDataSources

When I used DBDataSource and populated the rows, there seems to be a jerk when the rows get populated. But the same does not happen in the case of UserDataSources.

When I bind the matrix to DBDataSources, I get FieldNames, Datatype and length in the status bar and it automatically checks for Type mismatch also.In the case of UserDataSources, I think we have to handle validations ourselves.

What is the best means of populating a matrix? Most of the forum users suggest UserDataSources.Could you help me out.

Former Member
0 Kudos

I usually find UserDataSources most useful for data entry matrices. I find they give you more flexibility when you want to update them through code. Make sure you use GetLineData/SetLineData to populate them rather than going through the matrix cells. UserDataSources do have DataType & Length properties that will allow them to do basic type validation/display.

One area I do use DBDataSources extensively is when the matrices are mostly read-only lists of existing items in the database (eg. Orders due for delivery). They are very quick and easy to to generate and when used with Conditions objects provide quite good performance particularly on larger data sets. Even these however are often supplemented by UserDataSources for some items.

To prevent jerks when adding lots of lines to a matrix you can freeze the screen before starting to populate the matrix, un-freeze and update afterwards.

As you are experiencing, there doesn't really seem to be one ideal way of doing it at the moment. I think however that the enhancements to DBDataSources in the 2004 version might make a big difference to how we all work with matrices.

Regards,

John.