0% found this document useful (0 votes)
40 views

RDP As Data Source in Data Set

Uploaded by

Muhammad Farooq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
40 views

RDP As Data Source in Data Set

Uploaded by

Muhammad Farooq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
7128123, 3:22PM Report Data provider [ROP] as data source type in data set ~ SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - 0965 FO T. Sreenath Reddy G — D365 FO Technical Blog Report Data provider [RDP] as data source type in data set — SSRS reports [Dynamics ax 2012] September 6, 2011 — Sreenath Reddy Friends, Tam excited to share this new source of data[RDP] for the dataset..We all know in the older version, for a dataset we had only Query and Business logic as a dataset source in SSRS reports. Now in the current version, we have actually 4 options : Query, Business Logic, Report data provider and AX Enum provider. Today, I will be covering the Report data provider. An RDP class is an X+ class that is used to access and process data for a Reporting Services report. An RDP class is an appropriate data source type when the following conditions are met. hmmmm.. confused..let me explain with an example. It will be all clear soon ® First things first: The following elements are required to set RDP as your data source type. step 1: Query step 2: Temporary table - RDP class fills a temporary table with data that will be used by Reporting, Services to display the report. [msdn help] step 3:Data contract class - To define the parameters in the report. step 4:Report data provider class — processes business logic based on parameters and a query, and then returns the tables as a dataset for the report. [msdn help] Let me explain all the steps mentioned above with an example For step 1: Create a new query by name SR_CustTable and add the dataasource as CustTable as shown below hitpsdymamicsaxgyan.wordpress.com/20*1/08/06teportdata-provider-tdp-as-lata-source-type-In-dato-st-srs-reports-dynamies-a%-2012/ amt 12973, 322PM Repu ata provier ROP] as datasource pen dataset -SSRS repos [Oyamies a 2012 tena Reddy G -0265 FO 5R_CustTable(usr) = oP Wethods 5 BB Date sources SS Feds ES ranges Bis Data Sources [BI croup by 8484 onder By 31 Bp Dependent Objects 8 Composite Query Next step 2: Let us create a new temporory table by name TmpSR_CustTable and add 4 new fields as. shown below. Ensure that you set the Table type propert as TempDB or InMemory Use an InMemory temporary table if the dataset is small, for reports that will display fewer than 1000 records. Use a TempDB temporary table for large datasets to improve performance. In the below Table: [ have set the Table type property to TempDB to improve the performance.Also, I have dragged dropped 4 fields AccountNum, Blocked, priceGroup, Currency as shown below. Step 3: Now we need to Data Contract class ~ which will help to define parameters in the report. Create a new class by name "SRSRDPCustTableContractClass” and add a AccountNum global variable as shown below class SRSRDPCustTableContractClass { AccountNum accountNum; t Add one more parm method to it as shown below [DataMemberAttribute("AccountNum")] public AccountNum parmAccountNum(AccountNum _accountNum { accountNum = _accountNum; return accountNum; t ccountNum) Don ‘ets move to Step 4 hitps:dynamicsaxgyan.weordpress.com/20*1/08/06teport-data-provider-tdp-as-ata-source-type-In-data-st-srs-reports-dyramies-a%-2012/ ait 7128'23,5:22PM Report Data provider [RDP] as datasource type in dataset - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO. Step 4: Now we need to create Report Data provider class Create a new class by name "SR_CustTableRDP" that should extend SRSReportDataProviderBase class. Attach the SRSReportQuery Attribute attribute to specify the query to use to get the data for the report. For this example, set the attribute to the SR_CustTable query. Attach the SRSReportParameterA ttribute attribute to specify the data contract class that defines the report parameters for the report. For this example, set the attribute to the SRSRDPCustTableContractClass. [ SRSReportQueryAttribute (querystr(SR_CustTable)), SRSReportParameterA ttribute(classstr(SrsRDPCustTableContractClass)) 1 class SR_CustTableRDP extends SRSReportDataProviderBase { TmpSR_CustTable tmpSR_CustTable; ) Now we need 3 more methods to be added Mh /|/ Processes the report business logic. Mb Mt /I] Provides the ability to write the report business logic. This method will be called by /I| SSRS at runtime. The method should compute data and populate the data tables that will be /I| returned to SSRS. Mt [SysEntryPointAttribute(false)] public void processReport() { QueryRun queryRun; Query query; CustTable custTable; SRSRDPCustTableContractClass srsRDPCustTableContractClass; AccountNum accountNum; QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; query = this.parmQuery(); srsRDPCustTableContractClass = this.parmDataContract() as SRSRDPCustTableContractClass; accountNum = srsRDPCustTableContractClass.parmAccountNum(); hitps:dymamicsaxgyan.wordpress.com/20*1/08/06teport-data-provider-tdp-as-lata-source-type-In-data-st-srs-reports-dyramies-aX-2012/ sit 112823,3:22PM Report Data provider [RDP] as data source ype n dataset ~ SSRS repos [Dynamics ax 2012 | Sreenath Reddy G -0985 FO T. 1] Add parameters to the query. queryBuildDataSource = query.dataSourceTable(tablenum(CustTable)); iffaccountNum) { queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum)); if (queryBuildRange) ( queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum)); } //1f an account number has not been set, then use the parameter value to set it. if(t{queryBuildRange.value()) queryBuildRange.value(accountNum); } queryRun = new QueryRun(query); while(queryRun.next()) { custTable = queryRun.get(tableNum(CustTable)); this.insertTmpTable(CustTable); } } il /Ii This method inserts data into the temporary table. Ml Mt Ii Table buffer of CustTable table. il private void insertTmpTable(CustTable _custTable) { tmpSR_CustTable.AccountNum = _custTable.AccountNum; tmpSR_CustTable.Blocked = _custTable.Blocked; tmpSR_CustTablePriceGroup =_custTable.PriceGroup; tmpSR_CustTable.Currency = _custTable.Currency; tmpSR_CustTable.insert(; } [SRSReportDataSetAttribute("Tmp_SRCustTabl. public tmpSR_CustTable getTmpSR_CustTable() { select * from tmpSR_CustTable; return tmpSR_CustTable; hitps:dynamicsaxgyan.wordpress.com/20*1/08/06teport-data-provider-tdp-as-ata-source-type-In-data-st-srs-repots-dyramies-aX-2012/ ant 7128123, 322PM Report Data provider [RDP] as data source type in data set - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO T. } wow...we are done with all the steps mentioned above and I am excited to help you guys understand how to use the RDP class as a datasource for the dataset. For this we need to create a new report in the visual studio . Follow me friends...[I am assuming that all the visual tools have been installed and you have report model template available to created the reports] Open visual studio. Click on File >> New project and follow the below process. 7 Rename the report io SR CustTableRDPReport as shown below by going to the properties of the report emer BS ataeconase -ntps:ldynamicsaxgyan wordpress. comy2011109/05Ireport-data-provider-rdp-as-data-source-ype-n-data-so-ssrs-reporis-dynamics-@%-2012/ sit 7128123, 322PM Report Data provider [RDP] as data source type in data set - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO T. Now the next thing what we have to do [the most awaited... is to create a dataset for this report. Right click on the DataSet and add new dataset as shown below. Rename it to CustomerDataSet as shown below oxi * pateimert= | tlmedon | Fe & 91 AL| Mee = id SR cutrelerRapat x =z 1 Dong|_ Aa Daewet Goal, : Pan 2 i Go to its properties and rename it to "CustomerDataSet” Dtasetl rity Fra es Nl ps nae Solr a bat ne te 8 DataSource Dyes a or ‘ur Now the real trick, we have a datasource type property on the dataset properties. Select report data provider as the datasource type as show below. oa A F500 rover Select the query property and Click on the ellipsis (...) button to selct the RDP class which you have created in the step 4 as shown below al Stasoucs ise epot Oa Povier — -ntps:ldynamicsaxgyan wordpress. comy2011109/05Ireport-data-provider-rdp-as-data-source-ype-n-data-sot-ssrs-roports-dynamics-@%-2012/ et 7128123, 322PM Report Data provider [RDP] as data source type in data set - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO T. This will come up with all the RDP classes available in AX. Select SR_CustTableRDP Class and click on. next button to select the fields from the tmpTable to shown it on the report. fi eT wonderful..we are done with dataset. Only few steps now..Now we need to create design. Drag and drop this CustomerDataSet to Designs node. It will automatically create the Autodesigni as shown below = Bs caratenommet Bose 1S i cr 2 rele ar Drag.andten te, 3 Gapfiretes signs 2 Soca 3 i castmepatetabe Deore 2 sorting pecs = Bowe 25 contin = wed recon (Btn Yost Matos 8 a) Paranters Few more properties for good look and feel of reports : Right click on the Autodesign! and set the LayOutTemplate as ReportLayoutStyleTemplate as shown below -ntps:ldynamicsaxgyan wordpress. comy2011109/05Ireport-data-provider-rdp-as-data-source-ype-n-data-sot-ssrs-roports-dynamics-@%-2012/ mm 7128123, 322PM Report Data provider [RDP] as data source type in data set - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO T. Also, since I dont have data in default DAT Company, I would like to use company parameter as well. so 1am unhiding the company parameter to select the company parameter along with the Account number [step 3 parameter] ‘To do this, follow me and change the hidden property to visible as shown below for company parameter ‘Thats it. Now let us run this report. Right click on the Autodesign] and select option Preview and select the parameters as shown below sty soot) rot seth mn FE a sexton Fo gee Samm mate ace Select the report Tab to view the report. It will take some time to render data. [a cisTabesDrRep. totes Preven) —— Aicompawreme [FEU acoutmmbe [101.1291 (que SR custo: Soke -ntps:ildynamicsaxgyan wordpress. comy2011109/05Ireport-data-provider-rdp-as-data-source-ype-n-data-so-ssrs-reports-dynamics-@%-2012/ ant 112823,3:22PM Report Data provider [RDP] as data source ype n dataset ~ SSRS repos [Dynamics ax 2012 | Sreenath Reddy G -0985 FO T. Here comes the final data on the report - from the RDP class by inserting in to temporary table and showing the same on to report. hmmmm.. | am done..Hope you understood how RDP classes will help to render the data on to report by using the temporary table concept and Data contract classes. In my last post I have explained how to add this report to the AX menu item.. Follow the same process and check the report by opening from within AX.That's it for now. Happy Daxéng, Sreenath Posted in Uncategorized. 11 Comments » 11 Responses to “Report Data provider [RDP] as data source type in data set — SSRS reports [Dynamics ax 2012]” cabinet provider Says: December 14, 2011 at 11:43 am Yes, today, Wednesday, I entered this blog and I was amazingly surprised of information on tables provider as I was looking for something related to Report Data provider [RDP] as data source type in data set ..., though my real name is not cabinet provider I hope my comment would be welcome ® Reply John Says: February 20, 2012 at 2:37 pm awesome ! thanks a lot! Reply Datahjelp Says: June 8, 2012 at 4:50 pm Hi my friend! I wish to say that this post is amazing, great written and include approximately all important infos. I'd like to peer extra posts like this . Reply Sigve J Says: August 13, 2012 at 6:04 pm This was a great recipe. But when I try to expand the report with a new field I end up with the following error: “An exception has occurred in data set ‘NRMHirelnvoiceControlDS’. Details: System. ArgumentException: Could not execute the query. The field(s) NRMHireInvoiceControlTmp.1.OrderedQty do not e in the report provider table hitps:dymamicsaxgyan.wordpress.com/20*1/08/06teport-data-provider-tdp-as-lata-source-type-In-data-st-srs-reports-dyramies-aX-2012/ ont 112823,3:22PM Report Data provider [RDP] as data source ype n dataset ~ SSRS repos [Dynamics ax 2012 | Sreenath Reddy G -0985 FO T. NRMHirelnvoiceControlTmp.” Any good ide what could be wrong? I have added the field OrderedQty to the tmp-table, but for some reason it is missing when the report is executed. Any googd ide? regards Sigve J Reply adithya Says: January 8, 2013 at 4:32 pm Istarted from scratch to build rdp using the above tutorial and am done!!!!! excellent explanations at its best, Thank you very much sreenath @ Reply SD Says: January 18, 2013 at 12:27 am Well written article.. Cleared my questions about RDP..Thanks Reply Raj Boopathy Says: February 6, 2013 at 12:35 am Awesome Nath Thanks Reply Ebbes Norderi (Ebbes Nerdery) » Blog Archive » AX 2012 Creating report with report Data provider [RDP] as data source Says: March 15, 2013 at 5:28 pm [...] This text vas found here. [...] Reply Report Data provider [RDP] as data source type in data set - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G — Dynamics AX Consultant's Blog Says: March 15, 2013 at 5:53 pm [...] Report Data provider [RDP] as data source type in data set - S Sre... [-..] RS reports [Dynamics ax 2012] | Reply AMT Says: June 21, 2013 at 7:14 pm that very nice blog to read ... could you plz tell me one more step: how to make it available at EP with parameter...” Thanks In Adv...:) Reply Sudheer Says: July 12, 2013 at 6:00 pm Super Yaar. Wonderful Post hitps:dymamicsaxgyan.wordpress.com/20*1/08/06teportdata-provider-tdp-as-lata-source-type-In-data-st-srs-reports-dyramies-a%-2012/ sont 7128'23,5:22PM Report Data provider [RDP] as datasource type in dataset - SSRS reports [Dynamics ax 2012] | Sreenath Reddy G - D385 FO. Reply « Create Quick first SSRS report in Dynamics AX 2012 Quarantine Orders Start, Report as finished, End using X++ Code [Dynamics AX] » Proudly powered by WordPress hitps:dynamicsaxgyan.weordpress.com/20*1/08/06teport-data-provider-tdp-as-ata-source-type-In-data-st-srs-reports-dyramies-a%-2012/ am

You might also like