SETFILTER Problem

AliBomber
Member Posts: 13
hI i've got a little problem with the setfilter function:
e.g.
I write the following down and run it:
REPEAT
SETFILTER(Ausprägung,'<>%1',constraint_Rec_Help.Ausprägung);
UNTIL constraint_Rec_Help.NEXT = 0;
Then my problem is, that the last setfilter function overwrites the other results. But I want that all filters which are set in repeat-until-loop will be set.
How can I solve that????
Thank You very much for help.
e.g.
I write the following down and run it:
REPEAT
SETFILTER(Ausprägung,'<>%1',constraint_Rec_Help.Ausprägung);
UNTIL constraint_Rec_Help.NEXT = 0;
Then my problem is, that the last setfilter function overwrites the other results. But I want that all filters which are set in repeat-until-loop will be set.
How can I solve that????
Thank You very much for help.

0
Comments
-
You could build a string first that contains all your filters, and then use 1 SETFILTER with your string, eg.:
txtString := ''; i := 0; REPEAT i := i + 1; IF txtString <> '' then txtString := txtString + "&"; txtString := txtString + '<>%' + FORMAT(i) + constraint_Rec_Help.Ausprägung; UNTIL constraint_Rec_Help.NEXT = 0; SETFILTER(Ausprägung,txtString);
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Very cool idea, I'm gonna try it...
Thank you for the fast response.. :P0 -
I'm having a problem related to SETFILTER, but it is a little different. Let's say I have a field - "No.", type CODE(2). I want to set the following filter on this code field:
SETFILTER("No.", '%1|%2', '01', '75');
Whenever I try to do that setfilter, i get an overflow error. Since the size of the field is 2 characters, is it possible to set a filter larger than 2 characters?[/code]0 -
I tried to regenerate te problem with a new table:
OBJECT Table 50000 Test { OBJECT-PROPERTIES { Date=30/04/03; Time=[ 8:15:17]; Modified=Yes; Version List=; } PROPERTIES { } FIELDS { { 1 ; ;Code ;Code2 } { 2 ; ;Description ;Text30 } } KEYS { { ;Code } } CODE { BEGIN END. } }
and codeunit:OBJECT Codeunit 50000 test { OBJECT-PROPERTIES { Date=30/04/03; Time=[ 8:18:51]; Modified=Yes; Version List=; } PROPERTIES { OnRun=VAR recTest@1000000001 : Record 50000; BEGIN recTest.SETFILTER(Code,'%1|%2', '01','75'); END; } CODE { BEGIN END. } }
I did not get the error at all. May be you can redefine your problem, or give us more details about it?0 -
The original problem was the following:
I tried to run more than one setfilter functions on the same field. But only the last setfilter command was recognized, while the other ones seemed to be unrecognized. I had to put the setfilter in a repeat-until-loop...
I solved the problem by first using the mark function and then I filtered only the marked records.
This works well.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