Expiration Calculation Report

JKoB
Member Posts: 40
Hey Experts!
I created a Report (Item Ledger Entry) which should show me following:
Lot No. – Remaining Qty – Best Before
-> Sum per Lot
---> Works pretty fine until here.
OnPreDataItem
"Item Ledger Entry".SETFILTER("Remaining Quantity",'>1');
In Addition I created a Rec. on the Item Table (ItemRec).
OnAfterGetRecord
ItemRec.SETRANGE("No.","Item No.");
What I want now is a field in my Report which is filled with the “Expiration Calculation”
-> created Field with srcExpr.: ItemRec."Expiration Calculation"
My problem is that this Field stays empty.
Where is my failure?
The next step would be following calculation:
Expiration Date – Expiration Calculation – Today = x Days
How can I calc that?
Greets Jakob
I created a Report (Item Ledger Entry) which should show me following:
Lot No. – Remaining Qty – Best Before
-> Sum per Lot
---> Works pretty fine until here.
OnPreDataItem
"Item Ledger Entry".SETFILTER("Remaining Quantity",'>1');
In Addition I created a Rec. on the Item Table (ItemRec).
OnAfterGetRecord
ItemRec.SETRANGE("No.","Item No.");
What I want now is a field in my Report which is filled with the “Expiration Calculation”
-> created Field with srcExpr.: ItemRec."Expiration Calculation"
My problem is that this Field stays empty.
Where is my failure?
The next step would be following calculation:
Expiration Date – Expiration Calculation – Today = x Days
How can I calc that?
Greets Jakob
0
Comments
-
Any suggestions?0
-
Hi Jakob,
As you only do a SETRANGE the item record is never retrieved.
You should do thisOnAfterGetRecord ItemRec.GET("Item No.");
Hope this helps.
Albert0 -
Thx... That worked better... But the performance of the report was to bad.
I tried it with the table "Lot No. Information" wich was much easier."Lot No. Information".SETFILTER(Inventory,'<>0'); ItemRec.RESET; ItemRec.GET("Item No."); ItemRec.SETRANGE("No.","Item No."); IF ItemRec.FINDFIRST THEN RLZ := ItemRec."Expiration Calculation"; EP.RESET; EP.SETRANGE("Lot No.","Lot No."); IF EP.FINDFIRST THEN MHD := EP."Expiration Date"; DaysToExpiration := (TODAY - MHD)
The correct calculation would be (TODAY - MHD - RLZ)
Prob is that the type of "RLZ" is "DateFormula" how can i subtract it?
Today - MHD is (e.g.) -366.
The variabel RLZ has the value "1M" (1 month) - how can i convert the 1M into the Integer "30" (30Days) ?
My next question would be how i can sort the whole report by those calculated fields. Possible?
Thx in advance, Jakob0 -
Hi Jakob,
You could try thisDaysToExpiration := CALCDATE(-RLZ,TODAY - MHD);
Hope this helps
Albert0
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