SETFILTER parameter problem
                
                    erik_kurniawan                
                
                    Member Posts: 7                
            
                        
            
                    Hi experts,
I have 15 parameter to use in Filtering some data. such as many problem this may not possible to use code SETFILTER(Data,'%1|%2...%15,value1,value2...value15) because theres only 12 maximum parameter. Is there any technique to handle this problem? thanks before...
                I have 15 parameter to use in Filtering some data. such as many problem this may not possible to use code SETFILTER(Data,'%1|%2...%15,value1,value2...value15) because theres only 12 maximum parameter. Is there any technique to handle this problem? thanks before...
0                
            Answers
- 
            Divide it into 15 filters:
"Sales Header".SETFILTER("Document Type", "Sales Header"."Document Type"::Order);.
.
.
.
15th filter0 - 
            txtFilter := 'A|B|C|D'; // and this string you can make in different ways.
A way:txtFilter := ''; recSomeTable.RESET; recSomeTable.SETCURRENTKEY(...) recSomeTable.SETRANGE(...); IF recSomeTable.FINDSET THEN REPEAT txtFilter := txtFilter + '|' + recSomeTable."Some Field"; UNTIL recSomeTable.NEXT = 0; txtFilter := COPYSTR(txtFilter,2);
Now you have your field txtFilter with a filter in it. Use it like this:TheTable.SETFILTER("Some Field",txtFilter);Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 - 
            
:? :? :? :? :?bluerock wrote:Divide it into 15 filters:
"Sales Header".SETFILTER("Document Type", "Sales Header"."Document Type"::Order);.
.
.
.
15th filter
are you crazy?!?!only the last setfilter will be valid...each time you do a setfilter/setrange on a particular field, it overwrites previous filters on the same field (stating that you're working with the same record variable).
EDIT: kriki just remembered me that there's a way: with the help of filtergroups.
http://www.mibuso.com/forum/viewtopic.php?f=32&t=34863&p=169387&e=1693870 - 
            The different filtergroups work like AND between them, so I don't think that in this case it is the correct way.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 - 
            I was pointing out only that is actually possible to set filters on the same field without overwriting the previous one.
The correct solution to the original problem of this thread is the one in the 2nd or 4th post (best is 4th, anyway)0 - 
            Dear all,
sorry i haven't explain before.
here the full story...
Navision have Responsibility Center field.
in this case i want to make multiple resp. center to Filter Customer.
The step is ;
1. I have assigned customer to one resp. center before.
2. I have made one tabel contain role information.
Field ; username, resp. center
The record is like ;
- username A, resp. center A
- username A, resp. Center B
- username A, resp. center C
- username A, resp. center D
- username A, resp. center E
- username A, resp. center F
- username A, resp. center G
- username A, resp. center H
- username A, resp. center I
- username A, resp. center j
- username A, resp. center K
- username A, resp. center L
- username A, resp. center M
- username A, resp. center N
3. When user want to open customer card form and also customer list form, it will check to role table about username role.
so the result is 'username A only can see customer that have resp. center A,B,C,D,E,F,G,H,I,J,K,L,M,N'.
Its not possible to use code SETFILTER because maximum parameter is 12.
My question is how to make the filter is possible?
Thanks all...
Regards,
Erik0 - 
            Look at the post Kriki made
this will make a string with all the responsibility centers for that user.
Let's say username A opens the customer card
then with kriki's method you get a filter like:
setfilter("resp. center","A|B|C|D|E|F|G|H|I|J|K|L|M|N")
so instead of a filter with 15 parameters you get 1 parameter with all the 15 responsibility centers in and the | sign0 - 
            Be aware that a filterstring can only be 250 characters. So if you have 15 customers with numbers that are 20 characters, you are going to run into an error. I'd consider an alternative solution, perhaps one with a temporary record variable.0
 - 
            Ok, I will try kriki's method. I hope it can solve my problem [-o< ...
thanks all.
Regards,
Erik0 - 
            
How to implement and alternative solution using a record variable..Be aware that a filterstring can only be 250 characters. So if you have 15 customers with numbers that are 20 characters, you are going to run into an error. I'd consider an alternative solution, perhaps one with a temporary record variable.
As my key is exceeding maximum character length..
Please someone help on this context.. Its urgent. ](*,)0 - 
            1. Create a temp record variable. (Just set its "Temporary" property to "Yes".
2. Filter the customers once for each responsibility center that the user belongs to and copy the records you get to the temporary table.0 - 
            
I think it is by design. No need to do modification.erik_kurniawan wrote:3. When user want to open customer card form and also customer list form, it will check to role table about username role.
so the result is 'username A only can see customer that have resp. center A,B,C,D,E,F,G,H,I,J,K,L,M,N'Regards,
Andwian0 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.7K 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
 - 323 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
 

