Problem with a report - help needed..

Imaspal
Member Posts: 68
Hi Experts!
I have a report, where commissions of sales are showed by salesperson like that:
Code--Name--Quantity--Amount
01
Jesse--10
2000
05
James-15
2500
etc.
I have made a DataItemLink using Salesperson Code between tables
- Salesperson/Purchaser,
- Sales Header and
- Sales Line.
These tables are also indented like this:
-Salesperson/Purchaser
--Sales Header
---Sales Line
Now client wants to see also those lines on this report, where field Salesperson Code is empty (''). How can I do this easily, without modifying the table Salesperson/Purchaser? Suggestions and code examples are very awaited.
Yours,
Imaspal
I have a report, where commissions of sales are showed by salesperson like that:
Code--Name--Quantity--Amount
01
Jesse--10
2000
05
James-15
2500
etc.
I have made a DataItemLink using Salesperson Code between tables
- Salesperson/Purchaser,
- Sales Header and
- Sales Line.
These tables are also indented like this:
-Salesperson/Purchaser
--Sales Header
---Sales Line
Now client wants to see also those lines on this report, where field Salesperson Code is empty (''). How can I do this easily, without modifying the table Salesperson/Purchaser? Suggestions and code examples are very awaited.
Yours,
Imaspal
0
Comments
-
Hmm, I think you should re-structure you report a little, so that you have dataItem Sales Header first, I don't thik you should Salesperson as data-item. You could create a variable for that in order to Pickup the Name.
You could fill a temp-table on every change of Salesperson code of Sale Header you fill another Line with the data you need. (or add on existing Line)...
Or wait for more solutions on this form...0 -
do you need all three dataitems or it is possible only work with sales lines and use goupsDo you make it right, it works too!0
-
Maybe this will work (no temp tables, but more sections). if you have a lot of code behind sections / dataitems this might be a pain.
Dataitems:
-Salesperson/Purchaser
--Sales Header
---Sales Line
-Sales Header //this sales header dataitem has the filter 'Salesperson Code = '')
--Sales Line
You end up having duplicate sections, and you will may have to handle the totalling yourself. I would do it with temporary tables myself.
With temporary tables it would look like this:
temporary variable, tmpSP, salesperson table
1-Salesperson / Purchaser
2-Integer
3--Sales Header
4---Sales Line
Dataitem 1 - (no sections)
Set the DataItemTableView to use the Number key (so the section doesn't show up to the user)
OnAfterGetRecord:
tmpSP = Salesperson / Purchaser;
tmpSP.INSERT;
OnPostDataItem
tmpSP.INIT;
IF tmpSP.INSERT THEN; //in case a blank salesperson exists in the db
Then treat the Integer as your salesperson dataitem.
Dataitem 2
OnPreDataItem
tmpSP.RESET;
SETRANGE(Number,1,tmpSP.COUNT);
bFirst := TRUE; //new boolean global variable
OnAfterGetRecord
IF bFirst THEN BEGIN
bFirst := FALSE;
tmpSP.FINDSET; //or FIND('-'), depending on the version
END ELSE
tmpSP.NEXT;
SalesHeader.SETRANGE("Salesperson Code",tmpSP.Code); //need this to simulate the link between this section and #3
That is it - you will need to do whatever code you have in there now for the totalling, just remember you are dealing with the tmpSP record, not the Salesperson / purchaser dataitem.
-a0 -
Thank you for your advice awarn. I finally succeed with this one, your help was important.
Yours,
Imaspal0
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