Filter Group Question

jtlanejr
Member Posts: 8
Cross-Posted from Navision.net
Hello,
Note: I am using US Version 2.01.
In the Employee Card (form 5200), I am trying to restrict the user from being able to show all records in the Employee Rate list (form 10064). I have added a field in the User Setup table named "Department Filter" which allows the customer to restrict certain users to a given Department Code range.
In the Employee Card, OnOpenForm trigger I have placed the following code:
UserSetup.GET(USERID);
IF (UserSetup."Department Filter" <> '') THEN BEGIN
FILTERGROUP := 2;
SETRANGE("Department Code",UserSetup."Department Filter");
FILTERGROUP := 0;
END;
This filter group successfully filters the department code for me.
A further requirement is when the user selects Rates from the Payroll sub-menu on the Employee Card, the RunFormLink only shows Rates for the current Employee. In the Employee Rate (form 10064), I do not want the user to be able to clear the filter and show all Employee Rates. I tried to accomplish this with the following code in the OnOpenForm trigger of the Employee Rate form:
FILTERGROUP := 7; // Outside of Internal Navision FilterGroups
SETRANGE("Employee No.");
FILTERGROUP := 0;
This code is run on the form, then the OnAfterGetRecord trigger (including code SETRANGE("No.") <img border="0" title="" alt="" src="images/smiles/icon_wink.gif" /> of the Employee Card is run, then my Employee Rate form is displayed. The filter on Employee No. is then able to be cleared.
Can anyone suggest a good way of accomplishing this?
Thanks,
Jack
Hello,
Note: I am using US Version 2.01.
In the Employee Card (form 5200), I am trying to restrict the user from being able to show all records in the Employee Rate list (form 10064). I have added a field in the User Setup table named "Department Filter" which allows the customer to restrict certain users to a given Department Code range.
In the Employee Card, OnOpenForm trigger I have placed the following code:
UserSetup.GET(USERID);
IF (UserSetup."Department Filter" <> '') THEN BEGIN
FILTERGROUP := 2;
SETRANGE("Department Code",UserSetup."Department Filter");
FILTERGROUP := 0;
END;
This filter group successfully filters the department code for me.
A further requirement is when the user selects Rates from the Payroll sub-menu on the Employee Card, the RunFormLink only shows Rates for the current Employee. In the Employee Rate (form 10064), I do not want the user to be able to clear the filter and show all Employee Rates. I tried to accomplish this with the following code in the OnOpenForm trigger of the Employee Rate form:
FILTERGROUP := 7; // Outside of Internal Navision FilterGroups
SETRANGE("Employee No.");
FILTERGROUP := 0;
This code is run on the form, then the OnAfterGetRecord trigger (including code SETRANGE("No.") <img border="0" title="" alt="" src="images/smiles/icon_wink.gif" /> of the Employee Card is run, then my Employee Rate form is displayed. The filter on Employee No. is then able to be cleared.
Can anyone suggest a good way of accomplishing this?
Thanks,
Jack
0
Comments
-
My question might be stupid but why do you have to use FILTERGROUP at all?
I mean, as both forms "Employee" and "Employee Rate" have the same primary key (Employee-No) you could simply use the RunFormLink property to establish a fixed connection. The trick with the FILTERGROUP is usually only necessary if you have filter-criteria which are not part of BOTH tables. Such as the "Department Code".
Marcus
Marcus Fabian
m.fabian@thenet.ch
+41 79 439 78 72With best regards from Switzerland
Marcus Fabian0 -
This page does not contain subpage.
So now I'm not able to remove filter!
no one knows how to help me?
I can not remove the filters
SORRY, WRONG POST0
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