I am using matrix view to setup up an order form, to enable users to enter quantities on different item variants. Do you know any way can i modify records shown on matrix section of matrix view? When i enter a new value, it brings back old value again, whatever code i put on the validate of the textbox in matrix section.
You need to put the code into the OnValidate trigger. Here you have to determine the row and column of the cell being edited. The current row is simply “Rec”, the column is “CurrForm..MatrixRec”. From this point on, modifying the current value depends on your form and how values are being calculated, e.g. update some item record etc. It may also be necessary to create some form of posting entry with only the difference between old and new value. In this case, use the OnBeforeInput trigger to asign the old value to some global variable of the same type. After that, you need to refresh the matrix form, which again depends on the form. I have successfully implemented an editable matrix form this way, but in the end it turned out that the entire matrix had to be recalculated from scratch, due to the rather complicated form (supplied by our NSC) I had to start out with.
There is another way of doing this. Create a new table that has the following fields: Entry No. - Integer (primary key) The fields from the primary key of the source table. The field that is used on the matrix source table. A field that is the value for matrix table - decimal. Create a flowfield on the source table for the form (y-axis of matrix)you want to update and a fieldfilter for the field on the matrix table source table (x-axis of matrix). The flow field becomes the field in the matrix as you would expect. The flowfield should be the sum of the decimal value in the new table using the flowfield which will be the (y-axis) field. What will happen is every time you edit a field in the matrix a new entry record will be created for the difference between the current value and the new value. The flowfield on the source table will total these to be the current value. I know this all should a bit bizarre but hopefully will make sense. The nice thing about this approach is it gives you a record of all the changes made to the field.
Sertan, have you looked at the way the General Ledger Budgets are managed? This is a good starting point for matrix forms.