How can I create a filter condition?
xina_man
Member Posts: 116
Hi there!
I wan to set a filter in a form that shows only records based on a filter of 2 fields.
I know I can filter records field by field, but I want to create a filter of 2 fiels at the same time.
Basically I want to create a condition to set a filter.
How can I do it?
I wan to set a filter in a form that shows only records based on a filter of 2 fields.
I know I can filter records field by field, but I want to create a filter of 2 fiels at the same time.
Basically I want to create a condition to set a filter.
How can I do it?
0
Answers
-
setfilter(Field1,Condition);
setfilter(field2,Condition2);
or do you mean a OR / XOR condition (FIELD 1 OR FIELD2 / FIELD1 XOR FIELD 2)?Do you make it right, it works too!0 -
garak wrote:or do you mean a OR / XOR condition (FIELD 1 OR FIELD2 / FIELD1 XOR FIELD 2)?
setfilter(Field1,Condition);
setfilter(field2,Condition2);
or do you mean a OR / XOR condition (FIELD 1 OR FIELD2 / FIELD1 XOR FIELD 2)?
I mean something like this:
SETFILTER (Field1, Condition AND Fiel2, Conditon2);
I need to filter records only if the 2 conditions are TRUE at the same time.0 -
setfilter(Field1,Condition); setfilter(field2,Condition2);
is what you need. It is making AND between these conditions on two fields - it means both must be True... 8)0 -
xina_man wrote:garak wrote:or do you mean a OR / XOR condition (FIELD 1 OR FIELD2 / FIELD1 XOR FIELD 2)?
setfilter(Field1,Condition);
setfilter(field2,Condition2);
or do you mean a OR / XOR condition (FIELD 1 OR FIELD2 / FIELD1 XOR FIELD 2)?
I mean something like this:
SETFILTER (Field1, Condition AND Fiel2, Conditon2);
I need to filter records only if the 2 conditions are TRUE at the same time.
Take a look at the first and second line.
Don't forget the 2nd parameter of setfilter is a TEXT Condition (Read also the C/AL Online help).
If you only need Field1 = Value 1 then you can also use:
setrange(Field1,ConditionValue);
setrange(field2,Condition2Value);
If you need a Condition for field 1 like 'Bla' Or 'Blup' or 'BlupBlup' Then u use setfilter like
SETFILTER (Field1,'%1|%2|%3','BLA','BLUP','BLUPBLUP'); //<-- in this example, Field 1 is a codefield
Or do you need the records where the value in Field 1 is the value of field 2??
RegardsDo you make it right, it works too!0 -
Hi there,
Thanks for the answers but none of the solutions provided solved my problem.
I've been looking in the Help Menu for functions that can solve my issue, and i think the MARK Function can, but I need some help to put this working!!!
What I realy need to do is to MARK a record and then show only the Marked Records.
My problem now is, I can mark the records, but the MARKEDONLY Function is not working properly.
I'm using the MARK function on the OnAfterGetRecord Trigger and it seems to be working OK because the correct records are selected, but no mater where I put the MARKEDONLY Function, it shows me all the records or none records...
In wich trigger should I put the code? Are there other functions to do the create the desired output?MARK(NOT(("Dimension Value Type" = "Dimension Value Type"::Standard) AND (Blocked = TRUE))); MARKEDONLY(TRUE);
Thanks0 -
put this code on the OnOpenForm trigger:
FINDSET;
REPEAT
MARK(NOT(("Dimension Value Type" = "Dimension Value Type"::Standard) AND (Blocked = TRUE)));
UNTIL
NEXT = 0;
MARKEDONLY(TRUE);0 -
canadian_bacon wrote:put this code on the OnOpenForm trigger:
FINDSET; REPEAT MARK(NOT(("Dimension Value Type" = "Dimension Value Type"::Standard) AND (Blocked = TRUE))); UNTIL NEXT = 0; MARKEDONLY(TRUE);
Problem Solved!!!!
Tank you very much!0 -
No problem. Glad to help.
You can also just do this as well (on the same trigger):
SETFILTER("Dimension Value Type", '<> %1', "Dimension Value Type"::Standard);
SETRANGE(Blocked, FALSE);
The benefit of this method would be that you wouldn't have to iterate through each record and so, it may be faster.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
