Problem with setting a (simple) filter to Item List

Nagi
Member Posts: 151
Hi,
I'm fairly new to Navision, and I have a customer (using Navision 3.7a) that wants an automatic filter placed on the Item List form when accessed from the Item Card form (by pressing F5 or clicking the appropriate Menu Item link). The filter should exclude any item that is currently blocked.
Setting this filter isn't very difficult. I've found several properties that I can manipulate (such as RunFormView). The following CAL code also seems to do the job (when inserted into Menu Item -> Item List):
Itemrec.RESET;
Itemrec.FILTERGROUP(2);
Itemrec.SETRANGE(Blocked, FALSE);
Itemrec.FILTERGROUP(0);
IF Itemrec.FIND('-') THEN
;
CLEAR(ItemListform);
ItemListform.SETTABLEVIEW(Itemrec);
ItemListform.SETRECORD(Itemrec);
ItemListform.RUN;
My problem is that the filter also needs to be dynamically changed if the user wants to see all items (and not just the ones that aren't blocked). Any filter I've managed to apply to the form can't be turned off at run-time. The filter is applied to the form, and any subsequent filters that are used appear to be subordinate to my Blocked = FALSE filter.
I would appreciate any help on this.
I'm fairly new to Navision, and I have a customer (using Navision 3.7a) that wants an automatic filter placed on the Item List form when accessed from the Item Card form (by pressing F5 or clicking the appropriate Menu Item link). The filter should exclude any item that is currently blocked.
Setting this filter isn't very difficult. I've found several properties that I can manipulate (such as RunFormView). The following CAL code also seems to do the job (when inserted into Menu Item -> Item List):
Itemrec.RESET;
Itemrec.FILTERGROUP(2);
Itemrec.SETRANGE(Blocked, FALSE);
Itemrec.FILTERGROUP(0);
IF Itemrec.FIND('-') THEN
;
CLEAR(ItemListform);
ItemListform.SETTABLEVIEW(Itemrec);
ItemListform.SETRECORD(Itemrec);
ItemListform.RUN;
My problem is that the filter also needs to be dynamically changed if the user wants to see all items (and not just the ones that aren't blocked). Any filter I've managed to apply to the form can't be turned off at run-time. The filter is applied to the form, and any subsequent filters that are used appear to be subordinate to my Blocked = FALSE filter.
I would appreciate any help on this.
0
Answers
-
Try this:
Put code on Form:31Form - OnOpenForm() filtergroup(2) ; setrangE(blocked,false) ; filtergroup(0) ;
...
Button to show all items:<Control1000000017> - OnPush() filtergroup(2) ; setrange(blocked) ; filtergroup(0) ;
0 -
Hi,
Thanks for the help!
Although I would have liked to be able to remove the filter using standard Navision short cuts (shift+ctrl+F7), I guess it has to be done with a button control.0 -
Nagi wrote:Hi,
Thanks for the help!
Although I would have liked to be able to remove the filter using standard Navision short cuts (shift+ctrl+F7), I guess it has to be done with a button control.
Filtergroups are used to make sure the users don't remove the filters. So if you want the users to be able to remove filters using default navision, don't use the filtergroup commandsDon't just take my word for it, test it yourself0
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