• Using The 'Report Data Provider' As The Data Source For AX 2012 SSRS Report


    In this case, we will build a simple vendor report including the fields 'Vendor group', 'Vendor account' and the 'Vendor name'.

    1、At first, we should define a temp table that it will be used as a returning data set for the report.

    2、Create a query for the report.

     3、Define a new 'DataContract' class to add the additional query ranges for the report, this kind of query range dosen't include in the base query.

    [DataContractAttribute]
    public class VendTableDetailContract
    {
        VendName    vendName;
    }
    
    [DataMemberAttribute("Vendor name")]
    public VendName parmVendName(VendName _vendName = vendName)
    {
        vendName = _vendName;
        
        return vendName;
    }
    

    4、Define a new 'SRSReportDataProviderBase' class as the data source for the report.

    [
        SRSReportQueryAttribute(queryStr(VendTableDetaill)),
        SRSReportParameterAttribute(classStr(VendTableDetailContract))
    ]
    public class VendTableDetailDP extends SRSReportDataProviderBase
    {
        VendTableTmp    vendTableTmp;
    }
    
    [SysEntryPointAttribute]
    public void processReport()
    {
        QueryRun                    QR;
        VendTableDetailContract     contract;
        VendTable                   vendTable;
        VendName                    vendName;
    
        contract = this.parmDataContract() as VendTableDetailContract;
        vendName = contract.parmVendName();
    
        QR = new QueryRun(this.parmQuery());
        while (QR.next())
        {
            vendTable = QR.get(tableNum(VendTable));
            
            if (vendTable.name() like strFmt("*%1*", vendName))
            {
                vendTableTmp.clear();
                vendTableTmp.VendGroup  = vendTable.VendGroup;
                vendTableTmp.AccountNum = vendTable.AccountNum;
                vendTableTmp.VendName   = vendTable.name();
                vendTableTmp.doInsert();
            }
        }
    }
    
    [SRSReportDataSetAttribute("VendTableTmp")]
    public VendTableTmp getVendTableTmp()
    {
        select vendTableTmp;
    
        return vendTableTmp;
    }
    

    5、Use the new data source for the report.

  • 相关阅读:
    linux 磁盘管理学习笔记
    Apache的Order Allow Deny心得
    NodeJs 笔记
    JavaScript 笔记
    MySQL 学习笔记
    HTML 转义符
    UTF-8 BOM(EF BB BF)
    [ Python
    [ Python
    [ Python
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/5355387.html
Copyright © 2020-2023  润新知