AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.09.2012, 20:15   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
sumitsaxfactor: Building a simple report – Using Report Data Provider
Источник: http://sumitsaxfactor.wordpress.com/...data-provider/
==============

In my previous post, I explained how we can build a simple report using just the AOT queries. Now what if we have some logic that needs to be implemented and cannot be achieved using AOT queries?

This is where Report Data Providers plays a significant roles. Let us take the same example of displaying the Customer Id, Name and Balance that was used in post “Build and Deploy Simple Report–Queries”.

We can have this report using Report Data Providers as well. For this, we will keep the query and create three more artifacts, RDP, Report and a new Output menu item.

First we create a Report Data Provider class named “SKL_SampleReportDP”. Do the following:

To create an RDP for a report, we also need a temporary table (if it is Base Provider) or a permanent table (if it is pre process provider).

For this sample, we will use CustTmpAccountSum table that is present in base product.

Here are the class methods

///

/// The SKL_SampleReportDP class is the report data provider class for the

/// SKL_SampleSimpleReportQuery report.

///

///

/// This is a sample class. Author: Sumit Loya

///

[ SRSReportQueryAttribute (querystr(SKL_SampleCustomer))]

class SKL_SampleReportDP extends SRSReportDataProviderBase

{

CustTmpAccountSum tmpAccountSum;

}



The class declaration contains one attribute “SRSReportQueryAttribute”. This attribute specifies the query that will be used for this report. In case no query is required, this attribute can be removed.

There is one other attribute that can be specified on the RDP class and that is SRSReportParameterAttribute. This attribute defines the contract class that will be used to display report parameters.

processReport method

The processReport method is the entry point for calculating the report data for dataset. Here is the method for our sample class

[SysEntryPointAttribute(false)]

publicvoid processReport()

{

this.insertTmpAccountSum();

}



insertTmpAccountSum method

This is a private method that uses the report query to insert data into the temporary table

///

/// This method processes the report query and inserts data into the CustTmpAccountSum temporary table

///

privatevoid insertTmpAccountSum()

{

QueryRun queryRun = new QueryRun(this.parmQuery());

CustTable custTable;



while (queryRun.next())

{

custTable = queryRun.get(tableNum(custTable));



tmpAccountSum.AccountNum = custTable.AccountNum;

tmpAccountSum.Txt = custTable.name();

tmpAccountSum.Balance01 = custTable.openBalanceMST();

tmpAccountSum.insert();

}

}



getCustTmpAccountSum method

This method is mandatory as it returns the table buffer that contains the processed report data. The Dataset uses this buffer to bind the table to the dataset.

///

/// This method returns the table buffer that contains processed data

///

[SRSReportDataSetAttribute(tableStr(CustTmpAccountSum))]

public CustTmpAccountSum getCustTmpAccountSum()

{

select * from tmpAccountSum;



return tmpAccountSum;

}



After creating the class, go ahead and add a new report the existing report model.
  • Open the previously created Report Model

  • Right click on report model, select Add –> Report. Name the report SKL_SampleReportDP
  • Now in the report, go to the Datasets section and create new Dataset using the name CustomerDP
  • The parameters for the new Dataset should be as shown below. The Data Source Type is “Report Data Provider”

  • In the query property, click the button
  • This opens a box to select a data provider class
  • Select the class we created before, SKL_SampleReportDP and click “Next”

  • In the next tab, Deselect all fields and just select “AccountNum, Balance01 and Txt” fields
  • Click Ok

  • This is how the data set looks like

  • Now create a new Auto Design as before and name it as CustDP, Select a Layout Template for the report design in Parameters window
  • Now right click on newly created design select “Add” and “Table”
    • Set following properties
      • Name – CustDP
      • Dataset – CustomerDP
      • Style Template – TableStyleAlternatingRowsTemplate
  • You will also notice that the fields are included automatically from Dataset to the “Data” node of the table

  • Now right click on the report model and select option “Add SKL_SampleReportProject to AOT”
  • Once the report is created back to AOT, go to AX, find the report in AOT –> SSRS Reports –> Reports, right click and deploy using “Deploy Element” option
  • Once the deployment is successful, create an output type menu item for the report
  • Go to AOT –> Menu Items –> Output, Right click and select “New Menu Item”. Set following properties


Now using menu item open and run report. You will notice the same dialog



The report looks like as shown below:






Источник: http://sumitsaxfactor.wordpress.com/...data-provider/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 10.09.2012, 10:13   #2  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Простые туторы это кончено здорово в определенном смысле для начала изучения, а вот как быть с печатными формами в ssrs, что-то блогерры в этом случае молчат
__________________
Axapta book for developer
Старый 10.09.2012, 12:08   #3  
greench is offline
greench
Участник
Oracle
 
425 / 74 (3) ++++
Регистрация: 12.07.2007
Адрес: Киев
А что не так с печатными формами? Делаются так же как и обычные репорты, диалог с параметрами можно скрыть.
Старый 10.09.2012, 12:23   #4  
MikeR is offline
MikeR
MCT
Аватар для MikeR
MCBMSS
Лучший по профессии 2015
Лучший по профессии 2014
 
1,628 / 627 (24) +++++++
Регистрация: 28.11.2005
Адрес: просто землянин
Ну например та же ТОРГ 12 это либо куча вложенных subreport или логика вынесенная в библиотеку, выделение определенным шрифтом и конкатенация строк.
__________________
Axapta book for developer
Старый 10.09.2012, 13:37   #5  
trud is offline
trud
Участник
Лучший по профессии 2017
 
1,038 / 1629 (57) ++++++++
Регистрация: 07.06.2003
Записей в блоге: 1
subreport кстати аксаптовской библиотекой не поддерживаются.
При добавлении их в отчет он просто начинает валиться.
По поводу ТОРГ12. В том виде, в каком она была прежде в Reporting Service ее не сделаешь. Т..е. это ограничение самого движка Reporting Service. в нем никак не получится реализовать такие необходимые вещи как печать итогов-подитогов по странице с раздвижкой строк, требование что на каждой странице должна быть хотя бы одна строка данных и т.д. Для этого надо управлять выводом отчета(то что раньше делалось на ExecuteSection отчета SalesInvoice), а Reporting Service позволяет только задать фиксированную разметку отчета.
Думаю те люди которые принимали решение о переводе всего на Reporting Service были просто не в курсе наших ТОРГ12
Старый 10.09.2012, 14:00   #6  
gl00mie is offline
gl00mie
Участник
MCBMSS
Most Valuable Professional
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
3,684 / 5788 (200) ++++++++++
Регистрация: 28.11.2005
Адрес: Москва
Записей в блоге: 3
См. также сравнение SSRS и стандартных аксаптовских отчетов:
Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports (Part I)
What’s no longer possible in AX-reports (Part II)
What’s no longer possible in AX-reports (Part III)
За это сообщение автора поблагодарили: trud (2), MikeR (3).
Старый 10.09.2012, 18:35   #7  
greench is offline
greench
Участник
Oracle
 
425 / 74 (3) ++++
Регистрация: 12.07.2007
Адрес: Киев
Я не в курсе что такое ТОРГ12, думаю разработчики SSRS тоже.
1.Печать итогов, подитогов по странице - без проблем, нужно правильно создать группы и печатать итоги по этим группам.
2. На каждой странице хоть одна строка? Как наполните темповую таблицу, которая будет дасорсом для репорта, так и выведется. Что мешает добивать "фейковые" записи?
3. Управлять выводом? Можно скрывать/показывать какие-то части репорта в зависимости от условий(т.е. управлять видимостью элементов не только через visible = true/false, а использовать условия).
Ну и т.д.

Последний раз редактировалось greench; 10.09.2012 в 18:40.
Старый 10.09.2012, 19:08   #8  
Ivanhoe is offline
Ivanhoe
Участник
Аватар для Ivanhoe
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
 
4,143 / 2155 (80) +++++++++
Регистрация: 29.09.2005
Адрес: Санкт-Петербург
Помнится, локальный MS предварительно говорил, что не все печатные формы для русской локализации получится сделать в SSRS. Официально локализация еще не выпущена, но вполне возможно, что часть форм останется (появится) только в виде шаблонных форм MS Office.
__________________
Ivanhoe as is..
Старый 10.09.2012, 20:03   #9  
trud is offline
trud
Участник
Лучший по профессии 2017
 
1,038 / 1629 (57) ++++++++
Регистрация: 07.06.2003
Записей в блоге: 1
Цитата:
Сообщение от greench Посмотреть сообщение
Я не в курсе что такое ТОРГ12, думаю разработчики SSRS тоже.
1.Печать итогов, подитогов по странице - без проблем, нужно правильно создать группы и печатать итоги по этим группам.
...
Ну и т.д.
Для понимания проблемы советую попробовать напечатать стандартный SalesInvoice. В последней версии CU3 FP он печатается на 3 страницах на экране, а при печати этого же отчета сразу на принтер выходит 7.
Группы тут не особо помогут
Хотя да, в каком то ограниченном виде, например жестко зафиксировав число строк на странице и отключив возможность авто увеличения высоты строк можно и группами сделать. Просто раньше то можно было сделать без таких ограничений

Последний раз редактировалось trud; 10.09.2012 в 20:24.
Старый 11.09.2012, 10:17   #10  
greench is offline
greench
Участник
Oracle
 
425 / 74 (3) ++++
Регистрация: 12.07.2007
Адрес: Киев
В базовых репортах в 2012 хватает мелких багов. Если есть разница между тем сколько страниц на экране и на принтере/в pdf, то скорее всего разработчики забыли указать размер страницы. Это очень распространенная ошибка.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
sumitsaxfactor: Report Design and Controls Blog bot DAX Blogs 0 05.09.2012 22:11
ax-erp: Report Data provider [RDP] as data source type in data set – SSRS reports [Dynamics ax 2012] Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
dax-lessons: Report Data provider [RDP] as data source type in data set – SSRS reports [Dynamics ax 2012] Blog bot DAX Blogs 0 06.09.2011 00:12
saveenr: Dynamics AX 2012: An Introduction to Report Data Providers Blog bot DAX Blogs 0 07.03.2011 12:11

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 00:35.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.