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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.10.2015, 07:04   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
How to run a report for multiple records from a grid
Источник: http://alexvoy.blogspot.com/2015/10/...e-records.html
==============

Let's say we want to run our report from the previous post not from a Reports menu but directly from the Sales order form. We will use MultiSelectionHelper and its magic method createQueryRanges for this goal.


First of all we need to allow multiple selection for the menu item and place it as a button on the form.




Also we need to slightly change the report controller, so that it could receive the selected records and add an appropriate range to the query before execution.




public static void main(Args _args)
{
ItemSalesPriceAndBarcodeController controller = new ItemSalesPriceAndBarcodeController();

controller.parmReportName(ssrsReportStr(SalesPriceAndBarcodeReport, Report));
controller.parmArgs(_args);
controller.parmShowDialog(true);
// if it comes from the form, do not load the saved value
if (_args && _args.dataset() == (tablenum(SalesTable)))
{
controller.parmLoadFromSysLastValue(false);
}
controller.startOperation();
}

///
/// Executes before the report prompts and calls the method to set the ranges to the query.
///
public void prePromptModifyContract()
{
this.setRanges(this.getFirstQuery());
}

///
/// Sets the report query ranges based on the caller.
///
///
/// The hold the Query object of the report.
///
public void setRanges(Query _query)
{
QueryBuildDataSource qbds;
QueryBuildRange qbr;
SalesTable salesTable;
FormDataSource salesTable_ds;
FormRun caller;
MultiSelectionHelper helper;



if (this.parmArgs() && this.parmArgs().dataset() == (tablenum(salesTable)))
{
salesTable = this.parmArgs().record();
salesTable_ds = salesTable.dataSource();

caller = this.parmArgs().caller();
//This method will help to get only the marked records from the Grid
helper = MultiSelectionHelper::createFromCaller(caller);

qbds = _query.dataSourceTable(tablenum(salesTable));

//Create the Query to filter using itemId
helper.createQueryRanges(qbds, fieldStr(salesTable, SalesId));
}
else
{
qbds = _query.dataSourceTable(tablenum(salesTable));
qbr = qbds.addRange(fieldNum(salesTable, SalesId));
}
}

If user selected certain orders to print from the form, we do not need to restore previously saved parameters.

Feel free to download the full project here.


Источник: http://alexvoy.blogspot.com/2015/10/...e-records.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: How to select all the records from a grid Blog bot DAX Blogs 0 30.06.2015 14:11
emeadaxsupport: How to select all the records from a grid Blog bot DAX Blogs 0 26.02.2015 18:11
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
ax-erp: Walkthrough: Creating a Report Bound to a Report Data Provider Class (X++ Business Logic) [AX 2012] Blog bot DAX Blogs 0 20.09.2012 11:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11

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

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

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