Filter 2 fields
Kapoue
Member Posts: 37
Hello,
I must filter a table with this filter:
But my 2 types are differents "Periodic Disc. Type" is an option type and "Periodic Disc. Group" is an Integer.
How can I do?
Thanks in advance
Ben
I must filter a table with this filter:
Transact_line.SETFILTER("Periodic Disc. Type", '<> ''Mix&Match''' OR Transact_line."Periodic Disc. Group" <> 1);
But my 2 types are differents "Periodic Disc. Type" is an option type and "Periodic Disc. Group" is an Integer.
How can I do?
Thanks in advance
Ben
0
Comments
-
You can't use the SETFILTER shape this way. It isn't possible combine two fields in one SETFILTER function.
Try to use one of your filter (most sensitive) and filter fetched records by REPEAT ... UNTIL loop with IF command.0 -
It isn't very optimized and not very practical0
-
You can create new field in Transact_line table and in OnInsert or OnModify trigger set value combined from desired fields and then you can filter your requirement together in one step.0
-
OnAfterGet Record Trigger:
if (("Periodic Disc. Type"="Periodic Disc. Type"::Mix&Match)OR
(Transact_line."Periodic Disc. Group"=1)) then
Message('%1','C/Al is a Piece Of Cake'); =P~Regards,
GD0 -
Use 2 SETFILTER commands
Transact_line.SETFILTER("Periodic Disc. Type",'<>%1', Transact_line."Periodic Disc. Type"::"Mix&Match"); Transact_line.SETFILTER("Periodic Disc. Group",'<>1');
Of course it helps if there is a SETCURRENTKEY before the filters
Hope this helps0 -
Albertvh, your code produces AND.0
-
Oops read it too quickly :oops:
Then maybe the suggestion of using C/AL is the way.
Albert0 -
The trigger is ok but I'll use this only for a report.
And if I add this trigger all my codes'll be a little slower, if I add a field with combined values the db will be a little bigger.
So I prefer have only one report a little slower and do all this in my C/AL code.
Thank tou0
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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 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