码迷,mamicode.com
首页 > 其他好文 > 详细

用X++动态创建(生成)报表完整Job演示

时间:2015-10-07 12:07:12      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

static void DynamicsReportX(Args _args)

{
    #AOT
    str reportName = ‘tmp_DynamicxReport_‘+curUserID();
    tableid custTableId = tablenum(CustTable);
    TreeNode reportNode = TreeNode::findNode(#ReportsPath);
    Report areport;
    ReportDesign design;
    ReportAutoDesignSpecs specs;
    ReportSection section;
    ReportRun run;
    ;
    // 若存在则先删除,为了避免多用户冲突,报表名后加用户ID
    areport = reportNode.AOTfindChild(reportName);
    if (areport)
        areport.AOTdelete();
    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));
    section.addControl(custTableId, fieldnum(CustTable, phone));
    areport.interactive(false);
    areport.query().interactive(false);
    areport.AOTcompile();
    run = ClassFactory.reportRunClass(new Args(reportName));
    run.init();
    run.run();
}

 

用X++动态创建(生成)报表完整Job演示

标签:

原文地址:http://www.cnblogs.com/AllenFeng/p/4858432.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!