How to count record at second level of a report??

pedroccda
Member Posts: 90
How is possible to count record at second level?
If I have this structure in a report (12174-"Issued Cust Bills Report"):
- DataItem1 ("Issued Customer Bill Header")
- DataItem2 ("Issued Customer Bill Line")
How can I count DataItem2 items linked to DataItem1 before processing them ??
I thinked to use COUNT on DataItem2 in the trigger "OnAfterGetRecord" of DataItem1: firts I set the filter on dataitem2 using the link field between the dataitems ("Customer Bill No." = "No.") and then call FIND, but it gives an error (probably becouse I specify only 1 key of the 2 of DataItem2: I use only "Customer Bill No." but no "Line No."). But I can't know the second key ("Line No.") at prior.
Any idea??
If I have this structure in a report (12174-"Issued Cust Bills Report"):
- DataItem1 ("Issued Customer Bill Header")
- DataItem2 ("Issued Customer Bill Line")
How can I count DataItem2 items linked to DataItem1 before processing them ??
I thinked to use COUNT on DataItem2 in the trigger "OnAfterGetRecord" of DataItem1: firts I set the filter on dataitem2 using the link field between the dataitems ("Customer Bill No." = "No.") and then call FIND, but it gives an error (probably becouse I specify only 1 key of the 2 of DataItem2: I use only "Customer Bill No." but no "Line No."). But I can't know the second key ("Line No.") at prior.
Any idea??
Kiki
0
Comments
-
Isn't a COUNT OnPreDataItem of the second DataItem helping you?
doing it your way should be fine as well ... appying the SETRANGE yourself. You don't need to call "FIND" though ... a count after the SETRANGE should be enough.
I tested it in a codeunit:OnRun() recItem.SETRANGE("No.", '1000'); MESSAGE('%1',recItem.COUNT);
gave me a message:
10
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