Trying to display subset of records in nested data item

johnsogjjohnsogj Member Posts: 103
Hello, I'm trying to create a report that will display the following:

For all items for a given customer in the item cross reference, display detail for all posted purchase orders (for that item) where the Vendor Order No. in the Purch. Inv. Header is equal to "TTB".

My first data item is "Item Cross Reference", my nested data item is "Purch. Inv. Line". I'm able to display detail lines for ALL posted purchase orders- however, I cannot figure out how to limit those detail lines to only those where the associated Purch. Inv. Header record has "TTB" in the "vendor order no." field. Please help!

should "Purch Inv. Header" be another nested data item and filter somehow on Vendor Order No? Or should I do it through variables and code? I tried the following code but it doesnt seem to work:


PurchInvHeaderTable.SETCURRENTKEY("Vendor Order No.", "No.");
PurchInvHeaderTable.SETRANGE("No.", PurchInvLineTable."Document No.");
PurchInvHeaderTable.SETRANGE("Vendor Order No.", 'TTB');
IF PurchInvHeaderTable.FINDFIRST THEN
RecQty := PurchInvLineTable.Quantity
ELSE BEGIN
RecQty := 0;
END;

Comments

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from Upcoming version NAV forum to Navision forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • AlbertvhAlbertvh Member Posts: 516
    In the AfterGetRecord of the Purch. Inv. Line add this code
    IF PurchInvHdr.get("Purch. Inv. Line"."Document No.") AND
       (STRPOS(UPPERCASE(PurchInvHdr."Vendor No."),'TTB') = 0) THEN
      CurrReport.SKIP;
    

    You define PurchInvHdr as a Variable of DataType Record Purch. Inv. Header
    You could also define your search string as a variable to make it more flexible i.e instead of hardcoding TTB use MyString which could be filled in on the Options tab of the report


    Hope this helps

    Albert
Sign In or Register to comment.