Item and Bom Component Report Help

boku25boku25 Member Posts: 39
edited 2009-03-11 in Navision Attain
Tables:
Item
Bom Component

Global Variables:
BomCom Record Bom Component
QTY1 Decimal
QTY2 Decimal

I' am trying to create a report using two tables: Item and Bom Component. I am trying to show all Bom Items with a sub items within the Bom Component table.
So far I have everything but now I need to show the actual qty on hand for the sub item in the Bom Components, which is located in item table.

So my question is how I get the actual qty on hand to show for the sub item in the BOM on the report,
Currently I can see what makes up the BOM in correlation with the BOM Item, but I can not get the Qty on hand for the Sub item.

Item side
OnAfterGet Record
I tried this
BomCom.SETRANGE(BomCom."No.", Item."No.");
BomCom.GET(Item.” No.");
Item."No." := BomCom."No.";
QTY1 := Item.Inventory;

I also tried this
IF BomCom.FIND('-') THEN REPEAT
IF (Item."No." = BomCom."No.") And (BomCom."No." <>'') THEN BEGIN
Item.GET(BomCom."No.");
IF BomCom.FIND('-') THEN
QTY2 := Item.Inventory;
END;
UNTIL BomCom.NEXT=0;

Can someone help? ](*,)

Comments

  • DenSterDenSter Member Posts: 8,307
    That field is a flowfield, so you will have to to CALCFIELDS(Inventory) before you can use the value.
  • kinekine Member Posts: 12,562
    And do not use to get this info the variable Item (I assume that this is name of first dataitem). Use some new variable (for example Items :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    That's a good point Kine. Yes, make sure that you are not doing the CALCFIELDS on the parent dataitem, because that is the assembly/BOM. You want the inventory of the component items, you will need to get those items with another variable.

    I would create a new Item variable called ComponentItem, just to make sure you know which one you're working with in your code.
  • tazzy30tazzy30 Member Posts: 52
    Hi

    I am trying to do something similar however I have a report which shows the list of Bill of Materials within a BOM Jnl. I would like to show the components for those items within Bill Of Materials (IF bill of material is true). I have BOM Component as a dataitem twice the first shows the list of bill of materials for the Jnl, I want the second dataitem item to list the components within the parent item of the Bill of material listed from the first dataitem however i'm not sure how to go about it?
Sign In or Register to comment.