Report Sales Header & Sales Header Archive
Lump86
Member Posts: 4
Hello,
i need to do a report showing all sales orders from table 36 "Sales Header" and table 5107 "Sales Header Archive".
I have these tables as seperate two dataitems in the report.
An order which is created and saved in table 36 and archived in table 5107 at the same time should not be printed twice in the report, so only one time, saying from table 36. How can I realize that in C/AL Code?
I thought of SETRANGE function, but I am not sure. I appreciate any help! Thank you very much.
Regards
Lump86
i need to do a report showing all sales orders from table 36 "Sales Header" and table 5107 "Sales Header Archive".
I have these tables as seperate two dataitems in the report.
An order which is created and saved in table 36 and archived in table 5107 at the same time should not be printed twice in the report, so only one time, saying from table 36. How can I realize that in C/AL Code?
I thought of SETRANGE function, but I am not sure. I appreciate any help! Thank you very much.
Regards
Lump86
0
Comments
-
Hi Lump86,
how are your sorting needs? Do you have to alternate records from one and the other table, or can you just print records from one, then records from the other?
With alternating record source you need a buffer table. You probably be able to single out unwanted records on insert to the buffer table.
If one after the other (both dataitems have the same DataItemIndent), set filters on Sales Header from "Sales Header Archive" and use ISEMPTY like this:[Sales Header Archive - OnPreDataItem()] COPYFILTERS("Sales Header"); // use the same filters FILTERGROUP(10); // avoid conflicts with filters set by the user "Sales Header".FILTERGROUP(10); [Sales Header Archive - OnAfterGetRecord()] "Sales Header".SETRANGE("Document Type","Document Type"); "Sales Header".SETRANGE("Document No.","Document No."); IF NOT "Sales Header".ISEMPTY THEN CurrReport.SKIP; // skip all versions but the newest SETRANGE("Document Type","Document Type"); SETRANGE("Document No.","Document No."); FINDLAST; SETRANGE("Document Type"); SETRANGE("Document No."); [Sales Header Archive - OnPostDataItem()] // clean-up "Sales Header".SETRANGE("Document Type"); "Sales Header".SETRANGE("Document No."); "Sales Header".FILTERGROUP(0); FILTERGROUP(0);0 -
Hi vaprog,
thanks for your help :thumbsup:
Regarding sorting needs: Both of my dataitems share the same intent.
So if a sales order is created and archived at the same time (same record in both tables, i.e. Tables 36 and 5107) only the record from Table 36 should be printed in the report.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
