Hey peoples,
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?
Comments
OnBeforeExportRecord()
Thanks guys!!
Not when Designing the Dataport itself.
So, you must save the dataport and exit to the Object Designer.
Then you can run the Dataport
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;
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;
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;
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;
If you run an import dataport from the dataport designer then
the modifications to the database will not be committed.
Exporting is fine.