Options

Freezing the filters that had been applied through code!!!!!

southindiansouthindian Member Posts: 247
edited 2011-08-31 in NAV Three Tier
Dear all,

I had query. In Purchase order form there are about 2 years of data . where ever User go to list form it is displaying 2 years of data. But they expect only last one years data to be listed in list form.According to this requirement, In List form i had written code to display data for 1 years based on Work date. It is working fine. But if user is applying any othe filters other than the datafilters that i have applied .Data gets reset when they press "Show All" and again the list form shows last 2 years data.

The code written in list form is


gvdate:=CALCDATE('-CM',WORKDATE);
Recaccperiod.RESET;
Recaccperiod.SETFILTER(Recaccperiod."Starting Date",'<%1',gvdate);
Recaccperiod.SETRANGE(Recaccperiod."New Fiscal Year",TRUE);
IF Recaccperiod.FIND('+') THEN BEGIN
RecPH.RESET;
RecPH.SETCURRENTKEY("Document Type","No. Series","No.","Document Date");//004
RecPH.SETRANGE(RecPH."Document Type","Document Type");
RecPH.SETFILTER(RecPH."Document Date",'%1..%2',
CALCDATE('+1D',CALCDATE('-2Y',CALCDATE('-1D',Recaccperiod."Starting
Date"))),WORKDATE);
RecPH.SETRANGE(RecPH."Import Document","Import Document");
IF "Document Type"="Document Type"::Order THEN BEGIN
RecPH.SETRANGE(RecPH.Subcontracting,FALSE);
END;
IF "Document Type"="Document Type"::"Credit Memo" THEN BEGIN
RecPH.SETRANGE(RecPH.Credit,Credit);
END;
RecPH.ASCENDING(FALSE);
RecPH.FIND('-');
Rec.COPYFILTERS(RecPH);
END;


My query is is there any syntax to freeze the Filters i had applied .


Ever if the User is manually applying any filters , it should not affect my Already applied filters. again when they are clicking "Show All" it is showing last 2 years data, which should be 1 year.

Is there is any syntax for freezing my own set of filters.

With Regards,

Vijay

Comments

Sign In or Register to comment.