Permanent Filters On a Page in Nav 2016

omyvadiya
Member Posts: 124
Hi,
I am trying to filter a Lookup of a Page via writing code on OnLookup trigger of the Field, its working fine, i.e; when the page is opened, it opens with the filtered data, but here the problem is user can clear filters.
Is there any way to have permanent filters whenever the page is opened.
For Eg: I want to open Item Ledger Entry Page with filter of
1. ILERec.SETRANGE("Item No.","No.");
2. IF UserSetupRec.GET(USERID) THEN;
ILERec.SETRANGE("Location Code",UserSetupRec."Location Code");
A workaround i think is that, i have to somehow remove the clear filter option from the Page.
Thanks in Advance.
I am trying to filter a Lookup of a Page via writing code on OnLookup trigger of the Field, its working fine, i.e; when the page is opened, it opens with the filtered data, but here the problem is user can clear filters.
Is there any way to have permanent filters whenever the page is opened.
For Eg: I want to open Item Ledger Entry Page with filter of
1. ILERec.SETRANGE("Item No.","No.");
2. IF UserSetupRec.GET(USERID) THEN;
ILERec.SETRANGE("Location Code",UserSetupRec."Location Code");
A workaround i think is that, i have to somehow remove the clear filter option from the Page.
Thanks in Advance.
0
Best Answer
-
Try adding following line, Presuming the Rec = Item table:
ILERec.FILTERGROUP(2); ILERec.SETRANGE("Item No.","No."); IF UserSetupRec.GET(USERID) THEN; ILERec.SETRANGE("Location Code",UserSetupRec."Location Code"); SETRANGE("Location Filter",UserSetupRec."Location Code"); //<<< ILERec.FILTERGROUP(0);
Better would be to add it in OnOpenPage or something like that. But this works also after OnLookup.5
Answers
-
ILERec.FILTERGROUP(2); ILERec.SETRANGE("Item No.","No."); IF UserSetupRec.GET(USERID) THEN; ILERec.SETRANGE("Location Code",UserSetupRec."Location Code"); ILERec.FILTERGROUP(0);
1 -
.0
-
Hi @Duikmeester ,
Thanks its working
But, i have a problem, that the lookup is showing the value as 0, if it has some value too. PFA.
I know, it has to somehow work with Flowfield, any suggestions, how can i achieve it.
Requirement- If there is any inventory at the location defined in Usersetup.Location code, then the count of the that inventory must show and on lookup the list of the same must show.
Thanks in Advance
0 -
Try adding following line, Presuming the Rec = Item table:
ILERec.FILTERGROUP(2); ILERec.SETRANGE("Item No.","No."); IF UserSetupRec.GET(USERID) THEN; ILERec.SETRANGE("Location Code",UserSetupRec."Location Code"); SETRANGE("Location Filter",UserSetupRec."Location Code"); //<<< ILERec.FILTERGROUP(0);
Better would be to add it in OnOpenPage or something like that. But this works also after OnLookup.5 -
Hi @Duikmeester ,
The count of inventory is still 0, on lookup it is opening with correct location filter although.
Any idea about flowfilters?0
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