Any way to filter lookup in report?

Emerik
Member Posts: 50
Hi Mibuso,
If I am making a report on a dataitem, let's say Purchase Header. When the user runs the report, he can set filters on the Purchase Headers, and make a lookup to the Purchase Header lookup table.
But is there a way, I can filter the records from properties or code, if e.g. I only want to let the user select Purchase Headers with Document Type=Credit Memo?
Thanks for any reply!
If I am making a report on a dataitem, let's say Purchase Header. When the user runs the report, he can set filters on the Purchase Headers, and make a lookup to the Purchase Header lookup table.
But is there a way, I can filter the records from properties or code, if e.g. I only want to let the user select Purchase Headers with Document Type=Credit Memo?
Thanks for any reply!
0
Comments
-
Hi Emerick, take a look at the DataItemTableView property for the Purchase Header DataItem. If you drill down to Table Filter, you should be able to accomplish what you looking for.0
-
jspopp wrote:Hi Emerick, take a look at the DataItemTableView property for the Purchase Header DataItem. If you drill down to Table Filter, you should be able to accomplish what you looking for.
Hi jspopp,
Thanks for your reply. Unfortunately, it doesn't work. Even though I add a table filter, I am still able to select records, that do not respect the filter.
I have also tried to add a filter by code. I have tried the following triggers, but nothing seems to work: OnInitReport, OnPreReport, OnPreDataItem
BR Emerik0 -
As jspopp suggested, set the DateItemTableView filter as desired and on the OnPreDataItem trigger put this code:
FILTERGROUP(4);
This shud do the trick.
Chn0 -
Are there any other customized codes somewhere else, which may be resetting the dataitem? I ask this because it works for me, and see what C/SIDE ref guide has to say about filtergroup:
"If, for example, a filter has been set on customer numbers 1000 to 2000 in group 4, the user can set a filter that delimits this selection further, but cannot widen it to include customer numbers outside the range 1000 to 2000."
I think this is what you wanted.. right?
Chn0 -
I would make a Field on the RequestForm and add this code to the OnLookUp Property.
<Control1100004000> - OnLookup(VAR Text : Text[1024];) : Boolean PurchHeader.FILTERGROUP(4); PurchHeader.SETRANGE("Document Type", PurchHeader."Document Type"::Credit); PurchHeader.FILTERGROUP(0); IF FORM.RUNMODAL(0,PurchHeader) = Action::LookUpOk THEN BEGIN Text := PurchHeader."No."; EXIT(TRUE); END; EXIT(FALSE); <Control1100004000> - OnDrillDown()
You then can Copy the Filters into the DataItem (Purchase Header).
Greetings from Austria0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions