Welcome at schweda.net | EN | DE
 
 
 
 
 
This post is machine-translated. The original post in german language can be found here.

A common requirement is that a report / report should be printed automatically at a certain point in time.

It is usually important to be able to give certain parameters to the report to be printed, and depending on how the report is structured on the development side this can be more or less complicated.

The following code calls a relatively simple Dataprovider-based report:

TutorialMyReportDataContract dataContract;
SrsReportDataContract srsReportDataContract;

controller = new SrsReportRunController();
controller.parmReportName(ssrsReportStr(TutorialMyReport, MyDesign)); 
controller.parmShowDialog(false);    
controller.parmLoadFromSysLastValue(false);  

srsReportDataContract =
controller.parmReportContract();

dataContract = srsReportDataContract.parmRdpContract();

dataContract.parmSalesId("S1000"); 

The next example calls the standard report Transactions (Customer Accounts > Reports > Transactions > Customer). The special feature of this report is that it uses a query within the data provider. To access these was the challenge:

CustTransListContract dataContract;
SrsReportDataContract srsReportDataContract;
Map map;
MapEnumerator me;
SysOperationQueryDataContractInfo SysOperationQueryDataContractInfo;
QueryBuildRange queryBuildRange;
QueryBuildDataSource queryBuildDataSource;    
Object dataContractInfoObject;

controller = new SrsReportRunController();
controller.parmReportName(ssrsReportStr(CustTransList, Report)); 
controller.parmShowDialog(false);
controller.parmLoadFromSysLastValue(false);  

srsReportDataContract =
controller.parmReportContract();

dataContract = srsReportDataContract.parmRdpContract();

// Modify parameters
dataContract.parmOnlyOpen(true);  

// Modify query
map = controller.getDataContractInfoObjects();
me = map.getEnumerator();

while(me.moveNext())
{
    dataContractInfoObject = me.currentValue();
     
    if(dataContractInfoObject is SysOperationQueryDataContractInfo)
    {
        SysOperationQueryDataContractInfo = dataContractInfoObject; 

        // Add range
        queryBuildDataSource =
SysQuery::findOrCreateDataSource(SysOperationQueryDataContractInfo.parmQuery(), tableNum(CustTable));

        queryBuildRange = SysQuery::findOrCreateRange(queryBuildDataSource, fieldNum(CustTable, AccountNum));

        queryBuildRange.value("1001");            
    }
}
These post applies to following versions:
Dynamics AX 2012

Add comment

 

 
Feeds
RSS RSS feed
RSS RSS feed (Comments)
RSS RSS feed (Category)
 
 
posts of the actual month
November 2017
MoDiMiDoFrSaSo
 12345
6789101112
13141516171819
20212223242526
27282930 
 
 
© 2006-2016 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.