27.09.2014, 14:15 | #1 |
Участник
|
goshoom: Printing dynamic parameters (AX 2012 / SSRS)
Источник: http://dev.goshoom.net/en/2014/09/sh...ic-parameters/
============== In addition to parameters specified in data contracts, reports can also use queries. It’s very handy, because users can specify filters and sorting in exactly the same way as they’re used to from other places in Dynamics AX, they can use query expressions and so on. A relative common request is printing parameter values on the report itself. It’s easy with parameters defined in data contracts – an expression like =Parameters!UsersToInclude.Value will do the job. But the same approach doesn’t work with dynamic parameters (that’s how query parameters get represented in SSRS). I recommend the following approach. Use a report data provider class – very often, it’s already in place. Add a new data table to hold information about query ranges and expose it to the report. I’m using an existing table, TmpSysQuery, so we don’t have to discuss the design of the table. In processReport(), we extract ranges from the current query and save them to our temporary table. class LedgerJournalPostControlDP extends SRSReportDataProviderBase{ … TmpSysQuery tmpSysQuery;} [SRSReportDataSetAttribute(tablestr(TmpSysQuery))]public TmpSysQuery getTmpSysQuery(){ select tmpSysQuery; return tmpSysQuery;} public void processReport(){ … tmpSysQuery = MyQueryUtils::rangesToTable(this.query());} Because the logic for extracting ranges from a Query object may be needed from other places as well, I’ve put it into a separate class. This is the content of the method: <div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="xpp">public static TmpSysQuery rangesToTable(Query _query){ QueryBuildDataSource qbds; QueryBuildRange queryBuildRange; TmpSysQuery tmpSysQuery; LabelType tableLabel; int occurrence; int dataSourceNo; int i; if (!_query) { return tmpSysQuery; } for (dataSourceNo = 1; dataSourceNo <span class="sy0">
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|