zoukankan      html  css  js  c++  java
  • 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.

  • 相关阅读:
    使用C#直接修改表结构(添加列,删除列)【MS SQL SEVER】
    Nuget-ConsoleExtClass给控制台添加颜色
    Thread线程Join()的使用
    C#将List集合类转换成DataTable-帮助类
    C#动态拼接Linq
    C#使用AutoMapper
    go GOPROXY=http://goproxy.io 设置
    mysql5.6切到5.7(阿里云RDS换到自建库)
    vue学习之----如何在谷歌浏览器中使用vue调试工具
    vue学习之----兄弟组件之间通信方式
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/5355387.html
Copyright © 2011-2022 走看看