SETFILTER returning unwanted results

oetijr02
Member Posts: 4
Hello,
I am receiving unwanted results when filtering on the 'Gen. Journal Batch' table (232) in Nav 2013
The code will produce a list of all of the journal batches being used by the user but I can't figure out how to filter it correctly.
Currently I have the code below which should return 2 rows, 1 row for 'DEFAULT' and 'GENERAL' and another for 'CINDY' and 'CASH RECEI'.
But unfortunately it is returning 3 because 'CASH RECEI' also has a journal with the name 'DEFAULT'.
I understand why the results are returning the way they are but I am stumped on how to fix it without renaming journals.
//Current code to filter
GenJnlBatch.SETFILTER(Name,'DEFAULT|CINDY');
GenJnlBatch.SETFILTER("Journal Template Name",'GENERAL|CASH RECEI');
GenJnlBatch.FILTERGROUP(0);
Thank you for the help,
Jake
I am receiving unwanted results when filtering on the 'Gen. Journal Batch' table (232) in Nav 2013
The code will produce a list of all of the journal batches being used by the user but I can't figure out how to filter it correctly.
Currently I have the code below which should return 2 rows, 1 row for 'DEFAULT' and 'GENERAL' and another for 'CINDY' and 'CASH RECEI'.
But unfortunately it is returning 3 because 'CASH RECEI' also has a journal with the name 'DEFAULT'.
I understand why the results are returning the way they are but I am stumped on how to fix it without renaming journals.
//Current code to filter
GenJnlBatch.SETFILTER(Name,'DEFAULT|CINDY');
GenJnlBatch.SETFILTER("Journal Template Name",'GENERAL|CASH RECEI');
GenJnlBatch.FILTERGROUP(0);
Thank you for the help,
Jake
0
Comments
-
check if there are additional fields you can use to filter your list, e.g. recurring, template type, ...best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/1 -
Yes that is correct Jake, you'll receive 3 lines as 'CASH RECEI' and journal 'DEFAULT' is within your two required filter sets?Big D signing off!0
-
Hi Oetijr01
Oh I understand now - thought you was querying a bug in the Setfilters.
Marking required records is a good tool too for picking and choosing select records also, i.e., for selecting Customer Sales
CustSales.SETFILTER(Open,'Yes');
CustSales.SETRANGE("Document Type","Document Type"::Invoice);
IF CustSales.FIND('-') THEN REPEAT
IF CustRec.GET(CustSales."Customer No.") THEN
CustRec.MARK(True);
UNTIL CustSales.NEXT=0;
To find marked records:
CustRec.MARKEDONLY(True);
IF CustRec.FIND('-') THEN REPEAT
CustRec.MARK(False);
UNTIL CustRec.NEXT=0;
Hope helpsBig D signing off!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