how to make a filtergroup

haritza10
Member Posts: 28
Hello everybody,
nobody know how to make a filtergroup withe a setrange but making or in the setrange?
example:
filtergroup(2);
setrange(..); //i have to do a setrange with 3 fields but no making AND, i have to making OR. i have to look if in field1 or field2 or field3.
filtergroup(0);
Thanks.
nobody know how to make a filtergroup withe a setrange but making or in the setrange?
example:
filtergroup(2);
setrange(..); //i have to do a setrange with 3 fields but no making AND, i have to making OR. i have to look if in field1 or field2 or field3.
filtergroup(0);
Thanks.
0
Comments
-
If you search this forum, you can see that OR between more fields filter you cannot use through setrange or setfilter but with more loops... (first fikter for first column, than for second etc.)0
-
i know that it is impossible to make a setrange through OR but another way to make that i need?
Thanks0 -
kine wrote:If you search this forum, [...]
http://www.mibuso.com/forum/viewtopic.php?p=8399#8399Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
I know this post, but i need this one making a filtergroup, so the end-users can't clear filters the records i make it.
Thanks0 -
I had a simular problem once. My customer wanted to filter the payroll data according to a rules entered into a separate table.
The managers are allowed to accept time stamps for emplyees in certain department but not for all (i.e. themself).
I managed to solve it like this (from the Employee card):FILTERGROUP(2); SetRights.SetRights(EmplFilter,DimFilter); SETFILTER("No.",EmplFilter); SETFILTER("Global Dimension 1 Code",DimFilter); FILTERGROUP(0);
The function SetRightsIF NOT Manager.GET(USERID) THEN ERROR(Text001); ManagerRights.SETRANGE("Manager No.",USERID); IF ManagerRights.FIND('-') THEN BEGIN IF ManagerRights."Accept all Employees" THEN BEGIN CLEAR(EmployeeFilter); CLEAR(DimensionFilter); END ELSE BEGIN IF (ManagerRights."Permission to Accept") AND (ManagerRights."Global Dimension 1 Code" = '') THEN BEGIN ManagerRights.SETRANGE("Permission to Accept",TRUE); ManagerRights.SETFILTER("Employee No.",'<>%1',''); IF ManagerRights.FIND('-') THEN REPEAT IF EmployeeFilter <> '' THEN EmployeeFilter := EmployeeFilter + '|' + ManagerRights."Employee No." ELSE EmployeeFilter := ManagerRights."Employee No."; UNTIL ManagerRights.NEXT = 0; Found := TRUE; END ELSE BEGIN IF NOT Found THEN ManagerRights.SETRANGE("Permission to Accept",TRUE); ManagerRights.SETFILTER("Global Dimension 1 Code",'<>%1',''); IF ManagerRights.FIND('-') THEN REPEAT IF DimensionFilter <> '' THEN DimensionFilter := DimensionFilter + '|' + ManagerRights."Global Dimension 1 Code" ELSE DimensionFilter := ManagerRights."Global Dimension 1 Code"; UNTIL ManagerRights.NEXT = 0; ManagerRights.SETRANGE("Global Dimension 1 Code"); ManagerRights.SETRANGE("Permission to Accept"); ManagerRights.SETRANGE("Not permission to accept empl.",TRUE); ManagerRights.SETFILTER("Employee No.",'<>%1',''); IF ManagerRights.FIND('-') THEN REPEAT IF EmployeeFilter <> '' THEN EmployeeFilter := EmployeeFilter + '&<>' + ManagerRights."Employee No." ELSE EmployeeFilter := '<>' + ManagerRights."Employee No."; UNTIL ManagerRights.NEXT = 0; END; END; END ELSE ERROR(Text001);
Hopefully you can get some ideas from this.
Regards
Torben0 -
It is not possible to use Filter Groups and the Marked Only filtering simultaneously. It won't work, sorry.Nelson Alberto0
-
Try to simulate marked only with additional field "Special Filter". instead of setting marks you can modify this field setting it's value to userid.
at the end you just use:
setfilter("Special Filter",USERID);
you should also consider multiuser environment. (concatenating "Special Filter" and filtering as *USERID*)
If possible you should use tmp rec and insert records you find into tmp rec. It will be faster and won't itnerfere with other users.®obi
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯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