Problem assigning purchase amount to decimal variable

Clydo
Member Posts: 3
Hi,
I was asked to write a Nav report showing the last purchase amount for each item no. and variant for a particular location.
To do this I have created a report on the Item Variant table.
I have two Global variables:
The C/AL code is:
The problem I'm having is LastDirectCost is always returns 0 when the report is run.
whilst debuging i notice that If I use the LastDirectCost to return entry no. i.e. LastDirectCost := ile."Entry No." the report will display the entry no. of the ILE record I'm interested in and if I check that entry no. in the ILE table there is a Purchase Amount (actual) with a proper (non zero) value. So there is no problem with my SETFILTERs.
The decimal places property for the textbox that displays LastPurchaseAmount in the section designer is <2:2>.
What am I missing here?
Cheers.
I was asked to write a Nav report showing the last purchase amount for each item no. and variant for a particular location.
To do this I have created a report on the Item Variant table.
I have two Global variables:
-
ile - Record - Item Ledger Entry
LastPurchaseAmount - Decimal
The C/AL code is:
Item Variant - OnAfterGetRecord() ile.SETCURRENTKEY("Entry No.") ; ile.SETFILTER("Item No.", "Item No."); ile.SETFILTER("Variant Code", Code); ile.SETFILTER("Location Code", 'stock'); ile.SETFILTER("Entry Type", 'Purchase'); IF ile.FINDLAST THEN LastDirectCost := ile."Purchase Amount (Actual)"
The problem I'm having is LastDirectCost is always returns 0 when the report is run.
whilst debuging i notice that If I use the LastDirectCost to return entry no. i.e. LastDirectCost := ile."Entry No." the report will display the entry no. of the ILE record I'm interested in and if I check that entry no. in the ILE table there is a Purchase Amount (actual) with a proper (non zero) value. So there is no problem with my SETFILTERs.
The decimal places property for the textbox that displays LastPurchaseAmount in the section designer is <2:2>.
What am I missing here?
Cheers.
0
Answers
-
Calc the flowfield.There are no bugs - only undocumented features.0
-
Try
IF ile.FINDLAST THEN BEGIN ile.CALCFIELDS("Purchase Amount (Actual)" ); LastDirectCost := ile."Purchase Amount (Actual)" END;
<EDIT> late #-o0 -
mohana_cse06 wrote:Try
IF ile.FINDLAST THEN BEGIN ile.CALCFIELDS("Purchase Amount (Actual)" ); LastDirectCost := ile."Purchase Amount (Actual)" END;
<EDIT> late #-o
Thank you.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