Problem With Matrix Form While using With Date Table

rakesh-ranjanrakesh-ranjan Member Posts: 7
edited 2010-02-13 in Navision Attain
Hello Every Body..
I have problem with matrix form , i am using matrix record as date record for defining months and base record is customer record. it is running well , while i make a lookup on any field is show correct data but when i leave the control . all record is matrix window is clear. again when i pass the year it doesn't work .



Code in onaftergetrec

Date1.RESET;
Date1.SETRANGE("Period Type",Date1."Period Type"::Year);
Date1.SETFILTER("Period Name",'%1',FORMAT(year));
IF Date1.FINDFIRST THEN
BEGIN
CurrForm.MatrixWindow.MatrixRec.SETRANGE("Period Type",CurrForm.MatrixWindow.MatrixRec."Period Type"::month);
CurrForm.MatrixWindow.MatrixRec.SETFILTER(CurrForm.MatrixWindow.MatrixRec."Period Start",'%1..%2',Date1."Period Start",
Date1."Period End");


Matrixheader := {FORMAT(CurrForm.MatrixWindow.MatrixRec."Period Start") + ' To '+
FORMAT(CurrForm.MatrixWindow.MatrixRec."Period End")}
CurrForm.MatrixWindow.MatrixRec."Period Name";


//FOR i := 2 TO 10 DO
PeriodLength := '1M';

PeriodStartDate := CurrForm.MatrixWindow.MatrixRec."Period Start";
PeriodENDtDate := CALCDATE(PeriodLength,CurrForm.MatrixWindow.MatrixRec."Period Start" );


END;
// Exp1:=0;
DtldCustLedgEntry.RESET;
DtldCustLedgEntry.SETCURRENTKEY("Entry Type","Source Code","Posting Date","Customer No.");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Entry Type",DtldCustLedgEntry."Entry Type"::"Initial Entry");
DtldCustLedgEntry.SETRANGE(DtldCustLedgEntry."Source Code",'sales');
DtldCustLedgEntry.SETFILTER("Posting Date",'%1..%2',PeriodStartDate,PeriodENDtDate-1);
DtldCustLedgEntry.SETRANGE("Customer No.","No.");
DtldCustLedgEntry.CALCSUMS(Amount);
Exp1 := DtldCustLedgEntry.Amount;

//CurrForm.UPDATECONTROLS;


Code on LookUp rec

Date4.RESET;
Date4.SETRANGE(Date4."Period Type",Date4."Period Type"::Year);
Date4.SETFILTER(Date4."Period Name",'%1',FORMAT(Year));
IF Date4.FINDFIRST THEN
BEGIN
CurrForm.MatrixWindow.MatrixRec.SETRANGE("Period Type",CurrForm.MatrixWindow.MatrixRec."Period Type"::"2");
CurrForm.MatrixWindow.MatrixRec.SETFILTER(CurrForm.MatrixWindow.MatrixRec."Period Start",'%1..%2',Date4."Period Start",
Date4."Period End");
CurrForm.MatrixWindow.MatrixRec.SETFILTER(CurrForm.MatrixWindow.MatrixRec."Period Name",Matrixheader);


PeriodLength := '1M';

PeriodStartDate := CurrForm.MatrixWindow.MatrixRec."Period Start";
PeriodENDtDate := CALCDATE(PeriodLength,CurrForm.MatrixWindow.MatrixRec."Period Start" );


END;
// Exp1:=0;
DtldCustLedgEntry1.RESET;
DtldCustLedgEntry1.SETCURRENTKEY("Entry Type","Source Code","Posting Date","Customer No.");
DtldCustLedgEntry1.SETRANGE(DtldCustLedgEntry1."Entry Type",DtldCustLedgEntry1."Entry Type"::"Initial Entry");
DtldCustLedgEntry1.SETRANGE(DtldCustLedgEntry1."Source Code",'sales');
DtldCustLedgEntry1.SETFILTER("Posting Date",'%1..%2',PeriodStartDate,PeriodENDtDate-1);
DtldCustLedgEntry1.SETRANGE("Customer No.","No.");
FORM.RUNMODAL(0,DtldCustLedgEntry1);


Please help me

Comments

Sign In or Register to comment.