Navision 3.7 Help-Dataport

I have following code written for some customized report. Currently these code is pulling QtyOnHand from Item Card. I have item divided into sub item using variants. I need to pull the QtyOnHand of variants instead, how can I do that??

Thanks for help.


Hdr.SETFILTER(“Posting Date”,’%1…%2’,StartingDate,EndingDate);

Hdr.SETRANGE(“No.”,“Document No.”);

IF NOT Hdr.FIND(’-’) THEN

CurrDataport.SKIP;

InvDate := Hdr.“Posting Date”;

CustName := Hdr.“Sell-to Customer Name”;

FullAdd := Hdr.“Sell-to Address” + ’ ’ + Hdr.“Sell-to Address 2”;

City := Hdr.“Sell-to City”;

State := Hdr.“Sell-to County”;

Zip := Hdr.“Sell-to Post Code”;

Unit := “Unit of Measure Code”;

PROMO:= FALSE;

CLASS:= Hdr.“Customer Posting Group”;

//Cigarette//

IF ItemRec.GET(“No.”) THEN BEGIN

ItemNo := “No.” + “Variant Code”;

ItemRec.CALCFIELDS(Inventory);

QtyOnHand := ItemRec.Inventory;

IF ItemRec.Brand = ‘MSA’ THEN

MSA := TRUE;

IF ItemVar.GET(“No.”,“Variant Code”) THEN

UPC := ItemVar.UPC;

IF ItemRec.Brand = ‘MSA’ THEN

MSACAT := ‘CIGS’;

IF ItemRec.Brand = ‘MSA’ THEN

ItemCount := ‘200’;

There is a FlowFilter on the Item table called Variant Filter. Just set that and do a CALCFIELDS on the Inventory field.

Thanks Matt. but can you be more specific, I’m completely no-brainer when it comes to coding…

ItemRec.SETFILTER(“Variant Filter”, someVariantCode);

ItemRec.CALCFIELDS(Inventory);

I highly suggest reading some documentation if you are not familiar with NAV programming.

Thanks Matt

Really appreciated your help.