Filter Group Question

jtlanejrjtlanejr Member Posts: 8
edited 2013-05-08 in Navision Financials
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

Comments

  • mfabianmfabian Member Posts: 187
    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 72
    With best regards from Switzerland

    Marcus Fabian
  • tulliotullio Member Posts: 39
    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 POST
Sign In or Register to comment.