Report.
NAV 2009 Classic.
I need to be able to filter the customer records when the user looks up the No. field from the dataitem Customer.
I have tried:
Report - OnInitReport()
Customer.FILTERGROUP(2);
Customer.SETRANGE("Rebate Customer Type", 2); //Customer."Rebate Customer Type"::Rebate);
Customer.FILTERGROUP(0);
The above is not working although suggested by someone on another forum.
The user should not be restricted elsewhere, just for this report.
The report has a filter anyway so there is nothing going to happen if the user selects the wrong record but I am hoping there is a way of pre-filtering the list?
](*,)
Experience is what you get when you hoped to get money
0
Comments
<Control1000000000> - OnLookup(VAR Text : Text[1024];) : Boolean
Cust.FILTERGROUP(2);
Cust.SETRANGE("Rebate Customer Type", 2); //Customer."Rebate Customer Type"::Rebate);
Cust.FILTERGROUP(0);
IF FORM.RUNMODAL(0,Cust) = ACTION::LookupOK THEN
Customer."No." := Cust."No.";
That at least filters the records but is not what I was hoping for as I need to be able to select a range.
:-k ........
You'll want to declare your form as a variable and use that method to set the filter (it returns a text variable).
SETFILTER("No.", CustomerListForm.GetSelectionFilter);
My Blog - nav.education
There are two approaches you can take:
- Use the DataItemTableView property
- Use SETTABLEVIEW before you run the report. You may use the default filtergroup so the filter is visible in the request form, or you can use a different filtergroup on the rec you use as a parameter for SETTABLEVIEW to hide the filter from the user
In any of these cases the filter is effective on lookup and during the report.