Hi everyone,
I am trying to transform a Matrix Form into two forms: a main form with a subform control and a subform with a tab box control to replace the matrix...
The original matrix form has in its header 4 text fields that represent the four filters controlling the data displayed in the matrix...
For each of these fields, the following function
EditFilters() is called on the OnAfterValidate trigger of the control:
RESET;
IF Filtre1<>'' THEN
BEGIN
IF TypeA=0 THEN SETRANGE("A",Filtre1)
ELSE BEGIN
Nvl.RESET;
Nvl.SETRANGE("Cnl",Filtre1);
Nvl.FIND('-');
SETFILTER(NumLi,'%1..%2',Nvl.NumL,(Nvl.NumL+POWER(100,Nvl."Type")-1));
SETFILTER("A",'<>%1','');
END;
END;
IF Filtre2<>'' THEN SETRANGE("E.Code",Filtre2);
IF Filtre3<>0
THEN
SETRANGE("R",Filtre3-1);
IF Filtre4<>'' THEN SETRANGE("M.",Filtre4);
CurrForm.UPDATE(FALSE);
I tried to examine the code of some standard forms that did the same transformation as the one I am trying to do...
I wrote the following function,
UpdateMatrixSubform() update the subform:
CurrForm.MatrixForm.FORM.Load(Filtre1,Filtre2
,Filtre3,Filtre4,MatrixColumnCaptions,MatrixRecords,CurrSetLength);
Here is the code of the
Load() Function:
Filtre1 := Filtre1_1;
Filtre2 := Filtre2_1;
Filtre3 := Filtre3_1;
Filtre4 := Filtre4_1;
COPYARRAY(MATRIX_ColumnCaption,MatrixColumns1,1);
FOR i := 1 TO ARRAYLEN (MatrixRecords) DO
MatrixRecords[i].COPY(MatrixRecords1[i]);
MATRIX_NoOfMatrixColumns := NoOfMatrixColumns1;
I am calling the function
UpdateMatrixSubform() in the trigger OnAfterValidate, after the call of the function
EditFilters().
The problem is that the subform does not update, it does not respond when I modify the filters, the data remains the same...
What should I do???
Comments
When I defined it, I assigned Filtre1_1, Filtre2_1, Filtre3_1 and Filtre4_1 as parameters...
I tried to debug my code, I noticed that Filtre1_1, Filtre2_1, Filtre3_1 and Filtre4_1 are updated when I change the values of the filters in the form but not Filtre1, Filtre2, Filtre3 and Filtre4...
In other words, the parameters from the form are not correctly transmitted to the subform...
Why is that??? and how can I correct it???