Consider a scenario where we are going to print a list of customers and their invoiced sales order counts.
This
tutorial will guide you in developing Report Data Provider (RDP) based SSRS
reports in MS Dynamics D365.
Pre-requisites
Pre-requisites
- Microsoft Dynamics D365
- Visual studio 2015
- SQL Server Reporting Services (SSRS) must be configured
- Reporting services extensions must be installed in D365.
Important
Concepts
1.
Report Data Provider (RDP) Class
Report Data Provider Class is an X++ class that is used to
access and process data for a SSRS report. The RDP class processes the business
logic based on a specified parameter and/or query and returns a dataset to the
reporting services. In order to create a RDP class in AX, you have to extend
that class with SRSReportDataProviderBase.
This tells AX that this class will be used by reporting services to process the
data.
Two important attributes are used in RDP classes:
- SRSReportQueryAttribute: specifies which AOT query will be used in this report. If the RDP class uses an AOT query to process data, define this attribute at the beginning of the class.
- SRSReportParameterAttribute: defines the data contract class that will be used by this report to prompt for parameter values. If the RDP class contains any parameters this define this attribute at the beginning of the class.
Both the attributes are
optional. If the report does not use any query or does not want any parameter
to filter report data, these attributes do not need to be used.
·
Data Contract Class
A data contract class is an X++ class which contains parm methods with the DataMemberAttribute defined
at the beginning of the method. This class is used to define one or more
parameters that will be used in a SSRS report.
·
Table
An AX table is used as the dataset to store data for the report.
The RDP class processes the data and stores it in the table which is then used
by a SSRS report to render data.
A table can be a temporary table (InMemory or TempDB) or a regular table,
but it is Microsoft best practice to use a temporary table.
The type of temporary table is based upon the performance
considerations. InMemorytemporary
table is used when the data set is small, while TempDB is
normally used for larger datasets to improve performance.
Create Model
Before we start how to create a new model in Dynamics 365 for
Operations (AX7), it is important to understand what a model is. A model can be
defined as a collection of elements that represent a distributed software
solution.
To create a new model, in Visual Studio – from the menu, click on
the Dynamics AX >> Model Management >> Create model.This will open the
model wizard.
From the model wizard, you can specify the Model name, Model
Publisher, Layer, Version, Model description, and Model display name.
After clicking Next, you will need to determine if you want to
Create new package, or Select existing package.
Next I am prompted to give a name for the new project being
created associated with my new model.
After hitting Ok, my new project (associated with my model) can be
seen in the Solution Explorer window. From picture below, you may identify Project name, layer, and the Model name.
Now Create table and name it “dev_CustReportRDPDemoTmp”. To create table right
click on Solution explorer tab and over select option and select New item.
To add Fields in the table right click on the Fields node and
select data type which data type fields you want to add in the table. If you
want to add relation with another table, then you have to add that table
extension in the current project. If you want to add edit, then select the EDT
fields from the selected fields property. It will might take time to add EDT in
the selected fields.
Expand the dev_CustReportRDPDemoTmp table node and add the following
fields in the table:
No.
|
Field name
|
Extended Data Type
|
Label
|
1
|
CustAccount
|
CustAccount
|
|
2
|
Name
|
Name
|
|
3
|
SalesOrderInvoiceCount
|
Integer
|
Sales order invoiced
|
Now next step is for report parameters. For this purpose, we
use Data contract class. In current report we required parameters base on
Extended Data Type CustAccount, FromDate
and ToDate. At simplest our data contract class will be look like as follow.
To Add Contract Class in the project right click on Solution
explorer tab and over select option and select New item. On the Code table
select class and name it “dev_ CustReportRDPDemoContract”.
Now create code for parameter like below.
[DataMemberAttribute]
class dev_CustReportRDPDemoContract
{
CustAccount objCustAccount;
TransDate FromDate, ToDate;
[DataMemberAttribute('From date')]
public TransDate ParmFromDate(FromDate _FromDate=FromDate)
{
FromDate = _FromDate;
return FromDate;
}
[DataMemberAttribute('To date')]
public TransDate ParmToDate(ToDate _ToDate=ToDate)
{
ToDate = _ToDate;
return ToDate;
}
[DataMemberAttribute('Customer Account No.')]
public CustAccount ParmCustAccount(CustAccount _CustAccount=objCustAccount)
{
objCustAccount = _CustAccount;
return objCustAccount;
}
}
Now we required to write some logic which you above mention
class as its data contract and populate the custom temp table we build in
pervious step. Now
create a RDP class. Go to Classes and create a new class called “dev_CustReportRDPDemoDP" by right
click on Solution explorer tab and over select option and select New item and selecting New Class.
It is a best practice to suffix the RDP class name with DP.
Create
a method and your logic like below.
[SrsReportParameterAttribute(classstr(dev_CustReportRDPDemoContract))]
class dev_CustReportRDPDemoDP extends SRSReportDataProviderBase
{
dev_CustReportRDPDemoTmp objdev_CustReportRDPDemoTmp;
dev_CustReportRDPDemoContract Contract;
TransDate _FromDate,_ToDate;
CustAccount objCustAccount;
CustTable objcustTable;
SalesTable objsalesTable;
[SrsReportDataSetAttribute('dev_CustReportRDPDemoTmp')]
public dev_CustReportRDPDemoTmp GetData()
{
select objdev_CustReportRDPDemoTmp;
return objdev_CustReportRDPDemoTmp;
}
public void processReport()
{
Contract = this.parmDataContract();
_FromDate = Contract.ParmFromDate();
_ToDate = Contract.ParmToDate();
objCustAccount=Contract.ParmCustAccount();
super();
delete_from objdev_CustReportRDPDemoTmp;
objdev_CustReportRDPDemoTmp.clear();
while select * from objsalesTable where objsalesTable.SalesStatus == SalesStatus::Invoiced
&& (!_FromDate ||
objsalesTable.ShippingDateRequested >= _FromDate)
&& (!_ToDate ||
objsalesTable.ShippingDateRequested <= _ToDate)
join * from objcustTable where objcustTable.AccountNum==objsalesTable.CustAccount
&& (!objCustAccount ||
objcustTable.AccountNum==objCustAccount)
{
objdev_CustReportRDPDemoTmp.CustAccount = objcustTable.AccountNum;
objdev_CustReportRDPDemoTmp.Name =
objcustTable.name();
objdev_CustReportRDPDemoTmp.SalesOrderInvoiceCount=any2Int(objsalesTable.RecId);
objdev_CustReportRDPDemoTmp.insert();
}
}
}
At this step build the solution, never forget to check the
project Synchronized database on build set to true. Right click Solution
explorer and select property.
Now add new report in project. Right click on Solution
explorer tab and over select option and select New item. On that select Reports
Node and Select report and name it “dev_CustReportRDPDemoReport”.
Double click on Report in solution and open in designer
screen. And right click on dataset and create new Data Set.
Now double click the
report to open it. The
description of the individual node is given below:
Datasets: Datasets retrieve data from RDP class. It acts as a
bridge between D365 and the SSRS report. Only the fields added in the datasets
can be used in a report.
Designs: It defines the layout of the report.
Images: It contains the images that you want to
display in the SSRS report.
Data Methods: It contains the business logic which can then
be used in the report.
Parameters: It is used to apply filtering to the data in a
report. All the parameters defined in the data contract class are automatically
added here when the RDP class is defined in the datasets.
- Now you will want to create a new Dataset by right clicking
Datasets add dataset. Name it DsMain.
- Now select the DsMain dataset
and open the properties window. Set the Data Source Type to Report
Data Provider. Then select the Query field. An ellipse
button appears. Click it to open a dialog box.
- This dialog box lists all the RDP classes
present in the AOT. Select dev_CustReportRDPDemoDPand
press Next.
Select the fields to be
displayed in the report and press OK. Only the fields selected in
this dialog box can be shown in the report.
There are two types of
designs that can be created in a SSRS report:
1.
Auto design
2. Precision Design
In
this demo we will use Precision Design
Now
right click the Designs node Add >> Precision Design. A new design is added. Rename it Design. It is recommended that you set the name of the Design to
either ‘Design
‘or ‘Report‘.
Then select report print layout. Our target is A4 page. so
set it from report properties. For that go to Report >> Report Properties.
After
that right click on report in solution explorer and click on deploy.
Now add Display menu item like below.
After the add new display menu Item update the its following properties.
Here there is one advancement, in AX 2012 there were a difficult
to debug report. But in Dynamics 365 for operation its very simple. Just put
break point and set report as starting object and run the project.
23 comments
Write commentsfollwed same step report unable to pull data
ReplyGood
ReplyShould the attribute on the contract class header be [DataContractAttribute] instead of [DataMemberAttribute]
ReplyReally thanks.It helped me alot
ReplyHey..But the data is not coming...Can you please help me out?
Reply@Sloka,thanks for your comments.
ReplyTry to synchronize your VS project with the database and then restart SQL Server Reporting Services (MSSQLSERVER) and check.
When I am trying to get new RDP as dataset, it is not appearing. Nothing shows when clicked on query. Can you help here?
ReplyThank you for sharing this article,it is will be helpful and very Unique..
ReplyKeep updating...
MSBI Online Training India
Great Article! Are there any resources(books/trainings) that you could recommend for further training into report building?
ReplyThanks for your comment, According to me our experience is the best books for us. Keep visiting updated post on blog.
Replydata not coming
ReplyAn awesome blog for the freshers. Thanks for posting this information.
ReplyMsbi Online Training in India
Msbi Training
Gst Registration in Noida - The main documents for GST registration include a PAN card, proof of business registration, identity, photographs and address proof of persons in charge, the business' address proof, and bank account statements.
ReplySSRS Interview Questions Answers
Replythanks for clear explain & code , can you plz tell how to remove date , i'm only need account number to print data
ReplyWow!!! That was extremely Helpful....
Reply" ""Sohoghana Bar & Restaurant: A Culinary Haven of Delight""
ReplyDescription:
Indulge in an unforgettable dining experience at Sohoghana Bar & Restaurant, where culinary excellence meets warm hospitality in an inviting ambiance. Nestled in the heart of the city, our establishment is renowned for its fusion of traditional flavors with innovative twists, ensuring every dish tells a story of craftsmanship and passion.
Step into our elegant dining space, adorned with contemporary décor and subtle lighting, creating an atmosphere that exudes sophistication and charm. Whether you're seeking an intimate dinner for two, a celebratory gathering with friends, or a corporate event, Sohoghana offers the perfect setting for any occasion.
Our culinary team, led by esteemed chefs with a penchant for creativity, sources the freshest, locally-sourced ingredients to craft a menu that tantalizes the taste buds and satisfies the soul. From tantalizing appetizers to sumptuous main courses and decadent desserts, each dish is meticulously prepared to showcase the rich tapestry of flavors from around the world.
Pair your meal with a selection from our extensive wine list, featuring both Old World classics and New World favorites, expertly curated to complement the diverse flavors of our cuisine. For those who prefer a cocktail, our skilled mixologists are on hand to craft signature creations that are as visually stunning as they are delicious.
At Sohoghana Bar & Restaurant, we believe that dining is more than just a meal – it's an experience to be savored and shared. Whether you're a culinary connoisseur or simply seeking a memorable night out, join us and embark on a gastronomic journey that delights the senses and leaves a lasting impression.
VISIT US FOR MORE INFORMATION : https://sohoghana.com/
"""Sohoghana Bar & Restaurant: A Culinary Oasis in the Heart of the City""
ReplyDescription:
Indulge in a symphony of flavors at Sohoghana Bar & Restaurant, where every dish tells a story and every sip is a journey. Nestled in the vibrant heart of the city, our establishment invites you to embark on an unforgettable culinary adventure.
Step inside and be greeted by an ambiance that effortlessly blends modern sophistication with warm, inviting hospitality. Whether you're seeking a cozy spot for an intimate dinner, a lively atmosphere for drinks with friends, or a venue for special celebrations, Sohoghana offers the perfect setting for every occasion.
Our menu is a celebration of culinary excellence, meticulously crafted by our team of talented chefs who draw inspiration from both local traditions and global influences. From mouthwatering appetizers to sumptuous mains and decadent desserts, each dish is a masterpiece designed to tantalize your taste buds and leave you craving for more.
Complementing our exquisite cuisine is an extensive selection of handcrafted cocktails, fine wines, and premium spirits. Let our skilled bartenders concoct the perfect drink to accompany your meal or simply unwind with a signature cocktail at our stylish bar area.
At Sohoghana, we believe that dining is not just about nourishing the body but also feeding the soul. That's why every aspect of your experience is carefully curated to ensure that every visit is nothing short of extraordinary.
Join us at Sohoghana Bar & Restaurant and discover a culinary oasis where passion meets perfection, and every moment is savored to the fullest."
VISIT US FOR MORE INFORMATION : https://sohoghana.com/events.html
"Discover Luxury and Comfort at Best Western Plus Accra
ReplyDescription:
Nestled in the heart of Accra, Best Western Plus Accra invites you to experience unparalleled luxury and comfort during your stay in Ghana's vibrant capital city. As a premier hotel destination, we pride ourselves on offering top-notch amenities, impeccable service, and a warm, welcoming atmosphere to ensure that every guest enjoys a memorable stay.
From the moment you step into our elegantly appointed lobby, you'll be greeted by our friendly staff who are dedicated to catering to your every need. Whether you're visiting for business or pleasure, our well-appointed rooms and suites provide the perfect sanctuary to relax and unwind after a day of exploration or meetings.
Indulge in a culinary journey at our onsite restaurant, where our talented chefs craft delectable dishes using the freshest ingredients and innovative techniques. Afterward, sip on handcrafted cocktails or unwind with a glass of wine at our stylish bar, the ideal setting for socializing with fellow travelers or colleagues.
For those seeking relaxation and rejuvenation, our hotel offers a range of amenities including a refreshing outdoor pool, a fully equipped fitness center, and a tranquil spa where you can pamper yourself with a variety of treatments.
Conveniently located near major attractions, businesses, and transportation hubs, Best Western Plus Accra is the perfect choice for discerning travelers seeking the ultimate blend of luxury, comfort, and convenience during their visit to Accra. Book your stay with us today and discover why we're the preferred destination for travelers seeking excellence in hospitality."
VISIT US FOR MORE INFORMATION : https://www.bestwesternplusaccra.com/
"Discover Unparalleled Comfort and Luxury at the Best Western Plus Accra
ReplyDescription:
Welcome to the epitome of luxury and comfort in Accra – the Best Western Plus Accra. Nestled in the heart of the vibrant city, our hotel stands as a beacon of hospitality, offering unrivaled services and amenities to discerning travelers like you.
Indulge in a world of opulence from the moment you step into our elegant lobby. Our meticulously designed rooms and suites are adorned with modern furnishings and equipped with state-of-the-art amenities to ensure your utmost comfort throughout your stay.
Experience culinary delights that tantalize your taste buds at our exquisite restaurants, where our talented chefs craft mouthwatering dishes using only the finest ingredients. Whether you're craving local Ghanaian cuisine or international flavors, we have something to satisfy every palate.
Unwind and rejuvenate your senses at our world-class spa and wellness center, where expert therapists pamper you with a range of soothing treatments and massages. Take a refreshing dip in our sparkling swimming pool or work up a sweat in our fully equipped fitness center.
For those traveling on business, our hotel offers versatile meeting and event spaces equipped with cutting-edge technology, perfect for hosting successful conferences, seminars, and social gatherings.
Conveniently located near Accra's top attractions, including shopping malls, cultural landmarks, and business districts, our hotel serves as the ideal base for exploring the vibrant city.
At Best Western Plus Accra, your satisfaction is our top priority. Our dedicated staff is committed to providing personalized service and ensuring that your every need is met with utmost care and attention to detail.
Experience the height of luxury and hospitality during your stay in Accra at the Best Western Plus Accra – where every moment is crafted to exceed your expectations.
Book your unforgettable stay with us today and embark on a journey of unparalleled comfort and indulgence.
VISIT US FOR MORE INFORMATION : https://www.bestwesternplusaccra.com/class/3740/1.html
"Savoring Accra: Unveiling the Culinary Charms of SohoGhana Restaurant
ReplyDescription:
Embark on a gastronomic journey through the heart of Accra with SohoGhana Restaurant, a culinary haven that promises an exquisite fusion of flavors and a vibrant dining experience. Nestled amidst the bustling streets of Accra, SohoGhana stands out as a beacon of culinary excellence, offering a tantalizing array of dishes that showcase the rich tapestry of Ghanaian cuisine infused with international influences.
At SohoGhana, every dish is a celebration of local ingredients, expertly curated by seasoned chefs who blend traditional techniques with contemporary flair. From sumptuous seafood platters to savory street food-inspired delights, each bite tells a story of passion and innovation. Whether you're craving the bold flavors of jollof rice or the comforting warmth of banku and tilapia, SohoGhana takes you on a culinary odyssey that captivates the senses.
But it's not just about the food at SohoGhana; it's about the entire experience. Step into the restaurant's inviting ambiance, where modern elegance meets African charm, and feel yourself enveloped in an atmosphere of warmth and hospitality. Whether you're dining with friends, family, or colleagues, SohoGhana offers the perfect setting for every occasion, from intimate dinners to lively gatherings.
Moreover, SohoGhana is not just a place to eat; it's a cultural hub where food, music, and art converge. Immerse yourself in the vibrant rhythms of live music performances as you savor each mouthwatering dish, or admire the stunning works of local artists adorning the walls. Here, every visit is an opportunity to connect with the soul of Accra and experience its rich cultural heritage.
So, if you're looking for more than just a meal in Accra, look no further than SohoGhana Restaurant. Indulge your senses, ignite your palate, and embark on a culinary voyage that will leave you longing for more. Welcome to SohoGhana, where every bite is a taste of Africa's vibrant spirit.
VISIT US FOR MORE INFORMATION : https://sohoghana.com/events.html
Embrace Luxury and Scenic Serenity: Best Western Beachfront and Best Western Plus Accra.
ReplyDescription:
Indulge in the epitome of coastal elegance and unparalleled comfort with Best Western Beachfront and Best Western Plus Accra. Nestled amidst the breathtaking vistas of pristine beaches and azure waters, our accommodations redefine the essence of a tranquil seaside retreat. Immerse yourself in a world where luxury meets convenience, and every moment is adorned with splendor.
Best Western Beachfront offers a gateway to paradise, where each sunrise paints the sky with hues of warmth, and each sunset sets the scene for moments of pure bliss. Whether you seek leisurely strolls along the sandy shores or thrilling water adventures, our beachfront location ensures a myriad of activities to suit every preference.
Meanwhile, at Best Western Plus Accra, discover a haven of sophistication and modernity in the vibrant heart of Accra. Boasting contemporary design and upscale amenities, our hotel seamlessly combines comfort with convenience. From spacious rooms adorned with plush furnishings to state-of-the-art facilities, every aspect of your stay is meticulously crafted to exceed expectations.
Indulge your palate with tantalizing culinary delights at our on-site restaurants, offering a delectable fusion of local flavors and international cuisines. Unwind by the poolside with a refreshing cocktail in hand, or rejuvenate your senses with a pampering spa treatment.
Whether you're traveling for business or pleasure, our dedicated team is committed to ensuring a seamless experience, catering to your every need with genuine hospitality and personalized service.
Escape the ordinary and embark on a journey of unparalleled luxury and relaxation with Best Western Beachfront and Best Western Plus Accra. Your unforgettable seaside getaway awaits.
VISIT US FOR MORE INFORMATION : https://www.bestwesternplusaccra.com/
Embrace Luxury and Scenic Serenity: Best Western Beachfront and Best Western Plus Accra
ReplyDescription:
Indulge in the epitome of coastal elegance and unparalleled comfort with Best Western Beachfront and Best Western Plus Accra. Nestled amidst the breathtaking vistas of pristine beaches and azure waters, our accommodations redefine the essence of a tranquil seaside retreat. Immerse yourself in a world where luxury meets convenience, and every moment is adorned with splendor.
Best Western Beachfront offers a gateway to paradise, where each sunrise paints the sky with hues of warmth, and each sunset sets the scene for moments of pure bliss. Whether you seek leisurely strolls along the sandy shores or thrilling water adventures, our beachfront location ensures a myriad of activities to suit every preference.
Meanwhile, at Best Western Plus Accra, discover a haven of sophistication and modernity in the vibrant heart of Accra. Boasting contemporary design and upscale amenities, our hotel seamlessly combines comfort with convenience. From spacious rooms adorned with plush furnishings to state-of-the-art facilities, every aspect of your stay is meticulously crafted to exceed expectations.
Indulge your palate with tantalizing culinary delights at our on-site restaurants, offering a delectable fusion of local flavors and international cuisines. Unwind by the poolside with a refreshing cocktail in hand, or rejuvenate your senses with a pampering spa treatment.
Whether you're traveling for business or pleasure, our dedicated team is committed to ensuring a seamless experience, catering to your every need with genuine hospitality and personalized service.
Escape the ordinary and embark on a journey of unparalleled luxury and relaxation with Best Western Beachfront and Best Western Plus Accra. Your unforgettable seaside getaway awaits.
VISIT US FOR MORE INFORMATION : https://www.bestwesternplusaccra.com/
EmoticonEmoticon