Показать сообщение отдельно
Старый 25.05.2010, 09:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
David Ferguson: Creating a report in X++ code and running
Источник: http://blogs.msdn.com/b/davidferguso...d-running.aspx
==============

Here is a small job that demonstrates the main parts of build a report dynamically in X++ and launching it.



X++:
static void MakeReportJob(Args _args)
{
    #AOT
    str reportName = 'aaMakeReport';
    tableid custTableId = tablenum(CustTable);
    TreeNode reportNode = TreeNode::findNode(#ReportsPath);
    Report areport;
    ReportDesign design;
    ReportAutoDesignSpecs specs;
    ReportSection section;
    ReportRun run;
    ;
    
    // Delete the report if it already exists
    areport = reportNode.AOTfindChild(reportName);
    if (areport)
        areport.AOTdelete();
 
    // Build the report
    areport = reportNode.AOTadd(reportName);
    areport.query().addDataSource(custTableId);
    design = areport.addDesign('Design');
    specs = design.autoDesignSpecs();
    section = specs.addSection(ReportBlockType::Body, custTableId);
    section.addControl(custTableId, fieldnum(CustTable, AccountNum));
    section.addControl(custTableId, fieldnum(CustTable, Name));
    
    // Now the report will not prompt for user input
    areport.interactive(false);
    areport.query().interactive(false);
    
    areport.AOTcompile();
    
    run = ClassFactory.reportRunClass(new Args(reportName));
    run.init();
    run.run();
}




Источник: http://blogs.msdn.com/b/davidferguso...d-running.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
За это сообщение автора поблагодарили: AndyPanda (0).