Calculations in Dataports

CannikinCannikin 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:
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

  • OliverTOliverT Member Posts: 37
    which trigger do you use to calculate the value of your available quantity?
  • sggsgg Member Posts: 109
    Put the CALCFIELDS and calculations in the following trigger
    OnBeforeExportRecord()
    Sunday, Godwin G
  • CannikinCannikin Member Posts: 72
    That was it! I had my CALCFIELDS in the OnPreDataItem()

    Thanks guys!!
  • sggsgg Member Posts: 109
    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 Dataport
    Sunday, Godwin G
  • OliverTOliverT Member Posts: 37
    ehm ... i never ever had any problems by starting the dataport in the dataport designer :?
  • SeanLinSeanLin Member Posts: 8
    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;
  • SeanLinSeanLin Member Posts: 8
    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;
  • SeanLinSeanLin Member Posts: 8
    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;
  • SeanLinSeanLin Member Posts: 8
    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;
  • SteveOSteveO Member Posts: 164
    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 message
Sign In or Register to comment.