Use of SETFILTER in Report to calculate Purchase Qty

neellotus
Member Posts: 18
Hi Navision Experts!
I have a report that contains following filter, according to user report is displaying wrong data so i want to understand this filter.
ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate);
My whole code of report to calculate PurchaesQty
ILE1.RESET;
ILE1.SETCURRENTKEY("Item No.","Posting Date","Location Code","Remaining Quantity");
ILE1.SETRANGE(ILE1."Item No.","No.");
ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate);
IF LocationFilter <>'' THEN
ILE1.SETFILTER(ILE1."Location Code",LocationFilter);
ILE1.SETFILTER(ILE1."Remaining Quantity",'>%1',0);
IF ILE1.FIND('-') THEN
REPEAT
PurchaseQty+=ILE1.Quantity;
ILE1.CALCFIELDS("Cost Amount (Actual)");
PurchaseValue+=ILE1."Cost Amount (Actual)";
UNTIL recILE1.NEXT = 0;
Kindly suggest me how purchase qty is calculating.
Thanx.
I have a report that contains following filter, according to user report is displaying wrong data so i want to understand this filter.
ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate);
My whole code of report to calculate PurchaesQty
ILE1.RESET;
ILE1.SETCURRENTKEY("Item No.","Posting Date","Location Code","Remaining Quantity");
ILE1.SETRANGE(ILE1."Item No.","No.");
ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate);
IF LocationFilter <>'' THEN
ILE1.SETFILTER(ILE1."Location Code",LocationFilter);
ILE1.SETFILTER(ILE1."Remaining Quantity",'>%1',0);
IF ILE1.FIND('-') THEN
REPEAT
PurchaseQty+=ILE1.Quantity;
ILE1.CALCFIELDS("Cost Amount (Actual)");
PurchaseValue+=ILE1."Cost Amount (Actual)";
UNTIL recILE1.NEXT = 0;
Kindly suggest me how purchase qty is calculating.
Thanx.
0
Comments
-
There are many minor errors in that code, so without some idea of what error you are looking for it would be pure guess work. Start the debugger and trace through to see where it is going wrong. But don't start untill you know what the results are supposed to be and where the results should come from. Copy paste the ILE and Value entries to excel and compare them to your actual and expected results.David Singleton0
-
ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate);
This is applying filter on "Posting Date" field whatever the enddate value.
if enddate value is 20-07-2012(DD-MM-YYYY) thenILE1.SETFILTER(ILE1."Posting Date",'%1..%2',20-06-2012,20-07-2012);
Hope it's clear now....!!!0 -
You can run the form with filters to know what entries are you getting
ILE1.RESET; ILE1.SETCURRENTKEY("Item No.","Posting Date","Location Code","Remaining Quantity"); ILE1.SETRANGE(ILE1."Item No.","No."); ILE1.SETFILTER(ILE1."Posting Date",'%1..%2',CALCDATE('-1M',EndDate),EndDate); IF LocationFilter <>'' THEN ILE1.SETFILTER(ILE1."Location Code",LocationFilter); ILE1.SETFILTER(ILE1."Remaining Quantity",'>%1',0); FORM.RUN(FORM::"Item Ledger Entries",ILE1);
0 -
Hi Vijay Gupta,
Firstly thanx for your reply,
As per your example what will be the range of posting date to select data.
Thanx0
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