Trying to display subset of records in nested data item

johnsogj
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;
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;
0
Comments
-
[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!0 -
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
Albert0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions