How do I generate a report in Dynamics NAV, with report copies having different names in the header

Rwothoromo
Member Posts: 10
For example
1st Copy named Supplier Copy
2nd Copy named Customer Copy
3rd Copy named Records Copy
1st Copy named Supplier Copy
2nd Copy named Customer Copy
3rd Copy named Records Copy
Best Regards,
We interact for the future of Code.
We interact for the future of Code.
0
Best Answer
-
Can you check with the below code
IF Number = 1 THEN
CopyText := Text003;
IF Number = 2 THEN
CopyText := 'Supplier Copy';
IF Number = 3 THEN
CopyText := 'Customer Copy';
IF Number = 4 THEN
CopyText := 'Book Copy';
Regards
Rajasekhar.Y5
Answers
-
Hi,
I would suggest to have a look on Report 405.
The Copy are created Based on CopyLoop Data Item.
On - OnAfterGetRecords of CopyLoop Data Item Look for Below Code -IF Number > 1 THEN CopyText := Text003;
And Change it To -IF Number = 2 THEN CopyText := 'Supplier Copy'; IF Number = 3 THEN CopyText := 'Customer Copy'; IF Number = 4 THEN CopyText := 'Records Copy';
Where 1 Will be Original Without any copy text.
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page0 -
Thank you, let me retry that though it seemed to have failed earlier. I will get back to you.Best Regards,
We interact for the future of Code.0 -
I have compared Report Object Order 405 in NAV 2016 Object Designer and added the code as follows:
IF Number > 1 THEN
CopyText := Text003;
IF Number > 2 THEN
CopyText := 'Supplier Copy';
IF Number > 3 THEN
CopyText := 'Customer Copy';
IF Number > 4 THEN
CopyText := 'Book Copy';
However, notably, Text003 is 'COPY'
But still does not work.
Was there any patch or work around you included.
Thank you.Best Regards,
We interact for the future of Code.0 -
I have compared Report Object Order 405 in NAV 2016 Object Designer and added the code as follows:
IF Number > 1 THEN
CopyText := Text003;
IF Number > 2 THEN
CopyText := 'Supplier Copy';
IF Number > 3 THEN
CopyText := 'Customer Copy';
IF Number > 4 THEN
CopyText := 'Book Copy';
However, notably, Text003 is 'COPY'
But still does not work.
Was there any patch or work around you included.
Thank you.Best Regards,
We interact for the future of Code.0 -
The report is printed out without copies having their entitled namesBest Regards,
We interact for the future of Code.0 -
Can you check with the below code
IF Number = 1 THEN
CopyText := Text003;
IF Number = 2 THEN
CopyText := 'Supplier Copy';
IF Number = 3 THEN
CopyText := 'Customer Copy';
IF Number = 4 THEN
CopyText := 'Book Copy';
Regards
Rajasekhar.Y5 -
That helped, I just have to figure a work around the default =Code.GetData(18,1) on the Report LayoutBest Regards,
We interact for the future of Code.0 -
Hi Saurav,
By default, the Header name in Report 408 is decided by an expression =Code.GetData(1,3)
But this exact expression does not work for custom reports.
Did you face this and did you make a work around this?
Thank you.Best Regards,
We interact for the future of Code.0 -
Hi Saurav,
By default, the Header name in Report 405 is decided by an expression =Code.GetData(18,1) But this exact expression does not work for custom reports.
Did you face this and did you make a work around this?
Thank you.Best Regards,
We interact for the future of Code.0 -
Hi,
Two Things -
1. I Told you the code asIF Number = 2 THEN CopyText := 'Supplier Copy'; IF Number = 3 THEN CopyText := 'Customer Copy'; IF Number = 4 THEN CopyText := 'Records Copy';
** Why you changed it To > insted of =. Anything >4 will also be greater that 1,2,3,4?
2. Expression =Code.GetData(18,1), where GetData is a function mapped to a TextBox in Body of RDLC Report Named as PurchaseheaderDocumentType.
The Text Box will be small one and will have Red Font.
This Text Box have all fields which we need in Header, and the 18 number is mapped to one of the Names in Report Designer.
The Data Source of the mapped name in Navision Designer will be - STRSUBSTNO(Text004,CopyText)
Have a Look.
Thanks & Regards,
Saurav Dhyani
Do you Know this About NAV?
Connect - Twitter | Facebook | Google + | YouTube
Follow - Blog | Facebook Page | Google + Page0 -
Thank you for the feedback guys.
I solved the GetData problem.
You have to select a TextBox in the Report Layout Body, Goto TextBox Properties, Visibility, Select Show or Hide Expression.
Click on fx, and populate the expression for example:
=Code.SetData(Cstr(Fields!ReportTitleText.Value) + Chr(177) +
Cstr(Fields!BuyFromAddr1.Value) + Chr(177) +
Cstr(Fields!SellToVendor.Value, 1)
Where the 2nd parameter is Group Number and the 1st is the datasets.
Then Goto the Textbox in the header where you want to GetData for example:
=Code.GetData(1,1)
//This Populates with changing value from Fields!ReportTitleText.Value
Do likewise for Other Fields by Incrementing in order for example:
=Code.GetData(2,1) //For Fields!BuyFromAddr1.Value
=Code.GetData(3,1) //For Fields!SellToVendor.Value
#Note that the Group Number 1 was set using SetData
#Note that the Control Code for GetData and SetData is in the Report Layout Properties under the Code Tab. Edit Accordingly
Best Regards,
We interact for the future of Code.0 -
let me add one more trick here: these textboxes where setdata functions are written unger Visibility expression is typically quite tricky to access, since they are small and placed under the main tablix...
so what you might do if you are using Visual Studio is:
open Solution Explorer window (ctrl+alt+l) -> right click on report.rdlc -> open with -> xml (text) editor -> use search and type setdata.
Now you can see the Name of the textbox containing this functions and using this name you can come cack to layout editor (report.rdlc[Design]) and in Properties window find this textbox with the property Hidden containing code you are looking for. And actually it's even possible to make code adjustments in Report.rdlc editor:)1
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