Open Form With Filtered Data and prevent clearing the filter

doddwell
Member Posts: 65
Hello
I have a list form with a menu button. The user selects a record on the "first form" and then clicks the menu button to open a "second form" displaying records filtered to show records associated with the record selected on the "first form".
I know that I can achieve this if I set the PushAction property to "PushAction", the RunObject property to "Form second form", and set the RunFormLink Property. This doesn't give me what I need though because I want "second form" to be filtered and I don't want the user to be able to remove the filter.
I think I can prevent removing the filter on "second form" by using FilterGroup but I don't know how to pass the filter from "first form" to "second form".
Many Thanks for your help.
I have a list form with a menu button. The user selects a record on the "first form" and then clicks the menu button to open a "second form" displaying records filtered to show records associated with the record selected on the "first form".
I know that I can achieve this if I set the PushAction property to "PushAction", the RunObject property to "Form second form", and set the RunFormLink Property. This doesn't give me what I need though because I want "second form" to be filtered and I don't want the user to be able to remove the filter.
I think I can prevent removing the filter on "second form" by using FilterGroup but I don't know how to pass the filter from "first form" to "second form".
Many Thanks for your help.
0
Comments
-
Hi doddwel,
You should create one function in the second form like SetDataFilter with the parms you want to filter.
Create some global variables to match your parms and store them there. Then in the onopenform use the fitergroup to filter your required data.
From your first form, rather than using properties on the button you should use some code
CLEAR(theform);
theform.SetDatFilter(YourParms);
IF theform.RUNMODAL = ACTION::"The action you want to perform" THEN BEGIN
//some other actions here
END;0 -
Let me offer up one other solution.
The "SubFormLink" uses one of the FILTERGROUPS. I forget which one - if I remember correctly it changes in some of the versions.
Anyways, let's say it uses the normal filtergroup "zero"
on the second form... onOpenForm:filterString := GETFILTERS; FILTERGROUP(25); SETFILTERS(filterString); FILTERGROUP(0);
this has one advantage that no matter where the form is opened from, the filters are "locked"
For example we use this on the change log, because you shouldn't be able to go and look at HR changes, for example, when opening the change log from an item.
- Reinhard0 -
Hello RCerrato - Your solution does the trick - Thanks
Hello Reinhard - I'm trying to test your solution but I'm not sure how to implement it. What code do I need to put onto the first form? You mention in your post about the "SubFormLink" property but my second form is not a subform - is your suggestion still relevant? Thanks0 -
Hi Doddwell,
Oh, sorry for the confusion.
You do not need to put any code at all in the first form.
You mention the user clicks a menu button. Is there code in that button? If yes, maybe post it in the thread. More details + more info = better suggestions.
Cheers!
- Reinhard0
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