Record filtration in OnOpenPage trigger

mohana_cse06
Member Posts: 5,506
I want to show projects which have some specific permissions to the user which opening Projects list page.
I have written below code to calculate the permissions and store records in tempJob table.
what is the best way to apply those jobs from temporory variable to rec variable?
JobTMP.DELETEALL;
Job.RESET;
Job.SETFILTER(Blocked,'%1|%2',Job.Blocked::" ",Job.Blocked::Posting);
IF Job.FINDSET THEN
REPEAT
IF (Job."Person Responsible" = UserSetupRec."Resource Code") OR (Job."Project Manager" = UserSetupRec."Resource Code") THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END ELSE BEGIN
IF LimitProjectsandTasksLookup(UserSetupRec."Resource Code",Job."No.",'') THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END;
END;
UNTIL Job.NEXT = 0;
I have written below code to calculate the permissions and store records in tempJob table.
what is the best way to apply those jobs from temporory variable to rec variable?
JobTMP.DELETEALL;
Job.RESET;
Job.SETFILTER(Blocked,'%1|%2',Job.Blocked::" ",Job.Blocked::Posting);
IF Job.FINDSET THEN
REPEAT
IF (Job."Person Responsible" = UserSetupRec."Resource Code") OR (Job."Project Manager" = UserSetupRec."Resource Code") THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END ELSE BEGIN
IF LimitProjectsandTasksLookup(UserSetupRec."Resource Code",Job."No.",'') THEN BEGIN
JobTMP := Job;
IF JobTMP.INSERT THEN
JobTMP.MODIFY;
END;
END;
UNTIL Job.NEXT = 0;
0
Best Answer
-
Hi Mohana,
I am not sure this is the answwer you are looking for, but i would suggest, as an alternative, to apply the required permissions by modifying the OnFindRecord and OnNextRecord triggers on the page.
This is IMHO the more flexible way to apply more complex filters
See Page 7347 - Locations with Warehouse List as an example.
5
Answers
-
Hi Mohana,
I am not sure this is the answwer you are looking for, but i would suggest, as an alternative, to apply the required permissions by modifying the OnFindRecord and OnNextRecord triggers on the page.
This is IMHO the more flexible way to apply more complex filters
See Page 7347 - Locations with Warehouse List as an example.
5 -
I will apply this in my scenario.
do you have any idea whether it works if users are working simultaneously without any error?0 -
I got no problems when using this technique (which is already in use in standard NAV).
I should admit that in my own scenarios the records involved are lower than 100 but I don't see why a higher number of records or a multiple simultaneous access should be a source of problems as we are just checking for each record whether it should be displayed or skipped when loading the page.
Hope this helps.0 -
Thank you and didn't notice any issue in initial testing.0
-
-
Hi nabil.bamoh@hotmail.com
if it's slow then this is probably because you have to skip over many records in OnNextRecord. Implement some logic to circumvent this.
First set a filter as good as possible in Rec.
Then, if filter function (WMSMgt.LocationIsAllowed in the Page 7347 mentioned above) returns false, check if you can skip stretches of records, that will get rejected. E.g. you might want to use a second record with an different filter (same sort order though) and step through them alternatingly. You might even need a rec for a different Table for this.0 -
Now, the lookup or dropdown page is filtred correctly but user can enter data which is not present in list.
How can we solve it?0 -
Security filter in permissions?
I somewhere read uzing security filters cause lot of problems?0 -
any other solution that validates data from list we have filtered?0
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