Calculations in Dataports

Cannikin
Member Posts: 72
Hey peoples,
I'm trying to export our Available Quantity via a Dataport into a comma-delimited text file. We define Available Quantity as:
Then I tried just outputing Inventory and then it displays the correct value! Unfortunately that's not the one I want.
My variable is declared in C/AL Globals, I'm not getting any errors ... I must be missing one small thing. Anyone have any ideas?
I'm trying to export our Available Quantity via a Dataport into a comma-delimited text file. We define Available Quantity as:
availQuantity := Inventory - "Qty. on Sales Order" - "Qty. on Component Lines";But the availQuantity variable always comes out as 0 (zero). I added a CALCFIELDS but that didn't fix anything. I tried just setting availQuantity := Inventory but that was 0 as well.
Then I tried just outputing Inventory and then it displays the correct value! Unfortunately that's not the one I want.
My variable is declared in C/AL Globals, I'm not getting any errors ... I must be missing one small thing. Anyone have any ideas?

0
Comments
-
which trigger do you use to calculate the value of your available quantity?0
-
Put the CALCFIELDS and calculations in the following trigger
OnBeforeExportRecord()Sunday, Godwin G0 -
That was it! I had my CALCFIELDS in the OnPreDataItem()
Thanks guys!!0 -
Also Make sure that you run the Dataport from The Object Designer.
Not when Designing the Dataport itself.
So, you must save the dataport and exit to the Object Designer.
Then you can run the DataportSunday, Godwin G0 -
ehm ... i never ever had any problems by starting the dataport in the dataport designer :?0
-
You can test below codes written in OnBeforeExportRecord() Trigger:
IF Item.GET(Which Item No.) THEN
BEGIN
Item.CALCFIELDS(Inventory - "Qty. on Sales Order" - "Qty. on Component Lines");
CLEAR(AvailQuantity);
AvailQuantity := Inventory - "Qty. on Sales Order" - "Qty. on Component Lines";
END;0 -
You can test below codes written in OnBeforeExportRecord() Trigger:
IF Item.GET(Which Item No.) THEN
BEGIN
Item.CALCFIELDS(Inventory - "Qty. on Sales Order" - "Qty. on Component Lines");
CLEAR(AvailQuantity);
AvailQuantity := Inventory - "Qty. on Sales Order" - "Qty. on Component Lines";
END;0 -
You can test below codes written in OnBeforeExportRecord() Trigger:
IF Item.GET(Which Item No.) THEN
BEGIN
Item.CALCFIELDS(Inventory - "Qty. on Sales Order" - "Qty. on Component Lines");
CLEAR(AvailQuantity);
AvailQuantity := Item.Inventory - Item."Qty. on Sales Order" - Item."Qty. on Component Lines";
END;0 -
You can test below codes written in OnBeforeExportRecord() Trigger:
Item.RESET;
IF Item.GET(Which Item No.) THEN
BEGIN
Item.CALCFIELDS(Inventory - "Qty. on Sales Order" - "Qty. on Component Lines");
CLEAR(AvailQuantity);
AvailQuantity := Item.Inventory - Item."Qty. on Sales Order" - Item."Qty. on Component Lines";
END;0 -
tafferKakao:
If you run an import dataport from the dataport designer then
the modifications to the database will not be committed.
Exporting is fine.This isn't a signature, I type this at the bottom of every message0
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
- 322 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