Effect of Filtergroups

afrancisafrancis Member Posts: 43
Hi,

While opening the job card, only the project manager of that job should be able to view the job records. Considering that the logged in user is the project manager (the check for which is made at the OnOpenForm), only the relevant job records for that project manager are filtered. But the user can override this by 'Show all'.

Following is the code at the OnOpenForm:

FILTERGROUP(2);
JobAdministrator.SETRANGE("Administrator ID",USERID);
IF JobAdministrator.FIND('-') THEN BEGIN
REPEAT
GET(JobAdministrator."Job No.");
MARK(TRUE);
UNTIL JobAdministrator.NEXT = 0;
MARKEDONLY(TRUE);
END;
FILTERGROUP(0);

The JobAdministrator table captures the User IDs of the persons responsible for the job(like the project manager etc). It contains the job no. & the administrator User ID.

The records are filtered correctly when the job card is opened. But if the user clicks 'Show all', then the effect is gone.

How can we disable the effect of 'show all' in this
situation?

Regards,
Anse

Answers

  • ClausHamannClausHamann Member Posts: 80
    Hi Anse

    FILTERGROUP’s doesn’t work with the mark function, they only works with filters applied using SETRANGE, SETFILTER or SETRECFILTER (filters applied to fields). I am afraid you will have to find another way of solving your problem.

    You could use the OnFindRecord and OnNextRecord trigger to hide the records. I believe there are posts in this forum describing how this can be achieved.

    Regards

    Claus
  • krikikriki Member, Moderator Posts: 9,118
    And don't use FILTERGROUPS 1..5 because they are reserved by Navision.
    So better use FILTERGROUPS 6 and up.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • afrancisafrancis Member Posts: 43
    Hi Claus,

    How can OnFindRecord / OnNextRecord trigger be used in this case?

    Regards,
    Anse
  • afrancisafrancis Member Posts: 43
    Hi Claus,

    I am not able to access these topics; access is restricted. I tried registering also, but they are not taking in new members.

    Would appreciate if you could send the info. if possible.

    Thanks & Regards,
    Anse
  • afrancisafrancis Member Posts: 43
    Hi Claus,

    I am unable to access these topics; access is restricted. I tried registering also, but they are not accepting new users.

    Would appreciate if you could send in the info.

    Thanks & Regards,
    Anse
  • EugeneEugene Member Posts: 309
    Best thing in your case is to use OnNextRecords and OnFindRecord indeed.

    Basically you need to put code in the OnNextRecords, and OnFindRecord triggers of the form.

    OnNext basically says what to do when you do a next (Up/Down) on the form, in your case if the next record does not meet your requirements, then do another next.

    OnFind is when you do a find on a form,. that could be Ctrl F, or Page Down etc. In this case, you tell the form the record was not found unless it fits your criteria.
  • ClausHamannClausHamann Member Posts: 80
    Hi Afrancis

    I thought the forums on mbsonline.org were accessible. I have just asked one of the old mbsonline.org moderators if they can open the closed forums. I will get back to you later.

    Regards

    Claus
  • bestianhowbestianhow Member Posts: 120
    Hi Anse,

    Please try coding below, maybe can help you to solve the problems.
    Form - OnAfterGetCurrRecord()
    MARKEDONLY(TRUE);
    

    Good luck!

    Thank you,
    Kok Keong
  • afrancisafrancis Member Posts: 43
    Hi Keong,

    Excellent! That worked.

    Claus, I would still like to get the info. on OnNextRecord & OnFindRecord if possible.

    Thanks a lot for all your inputs.

    Regards,
    Anse
  • afrancisafrancis Member Posts: 43
    Hi Claus,

    I got your message with the info.

    Thanks & Regards,
    Anse
  • ClausHamannClausHamann Member Posts: 80
    Hi Afrancis

    Access to the forums and thereby the two posts should be public now.

    Regards

    Claus
Sign In or Register to comment.