FILTERS

Can someone looks at these codes and tell me why my filters ar not working at all.ONLY FILTERS

Cust. Ledger Entry - OnAfterGetRecord()
“Cust. Ledger Entry”.SETRANGE (“Posting Date”,
Customer.GETRANGEMIN(“Date Filter”),
Customer.GETRANGEMAX(“Date Filter”));
“Cust. Ledger Entry”.SETRANGE (“Cust. Ledger Entry”.“Document Type”,“Cust. Ledger Entry”.“Document Type”::“Payment” );
“Total Payment” += “Cust. Ledger Entry”.Amount;

“Cust. Ledger Entry”.RESET;
“Cust. Ledger Entry”.SETRANGE (“Posting Date”,
Customer.GETRANGEMIN(“Date Filter”),
Customer.GETRANGEMAX(“Date Filter”));
“Cust. Ledger Entry”.SETRANGE (“Cust. Ledger Entry”.“Document Type”,“Cust. Ledger Entry”.“Document Type”::" " );
“Total Settlement” += “Cust. Ledger Entry”.Amount;

I would think it is because you set the filters in the wrong trigger…

Shouldn’t it be set in the OnPreDataitem-trigger?

Ok. have put it on trigger OnPreDataitem-trigger but still didnt work.

then i had to do it this way. clear the filters from the code and set it on the cust ledger entry table

DataItemLink = Customer No.=FIELD(No.),Posting Date=FIELD(Date Filter)

so the Qs is why is it that this cant work.

Cust. Ledger Entry - OnPreDataItem()
“Cust. Ledger Entry”.SETRANGE (“Posting Date”,
Customer.GETRANGEMIN(“Date Filter”),
Customer.GETRANGEMAX(“Date Filter”));

Isitn;t one and the same thing?

The second version works fine.

A reason that the first version does’nt work could be the “Cust. Ledger Entry”.RESET, which effectly removes all filters.

Maybe there still is a reset?

//Pelle

You will need to use the CALCFIELDS statement

Albert