[AX]AX2012 SSRS报表Drill through action

SSRS报表显示的字段可以添加两种Drill through action,一是Report Drill Through Action,这要用到两个报表,一个顶级报表的某个字段添加drill through操作,另一个报表在top report中点击drill through的时候呈现出来以显示一下额外的信息。

上图显示的是在顶级报表的Name字段下新建了一个report dirll through action,通过子报表的参数SelectedAssertId传递所选择纪录的信息。

上图则是子报表,在子报表中根据传入的参数SelectedAssertId对数据做了过滤,总体上讲这种Drill through还是比较简单的。

另外一种Drill through称为URL Drill Through Action,其实现方法是在drill action中返回一个表达式指向的URL,要动态的实现URL,可以使用report data method,比如系统自带的HcmAbsenceSetup报表:

DrillWorkder是一个report data method,是这样定义的:

    [DataMethod(), PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
    public static string DrillWorker(string reportContext, string personnelNumber)
    {
        return DrillThroughCommonHelper.ToHcmWorker(reportContext, personnelNumber);
    }

这里用到了DrillThroughCommonHelper帮助类,由它生成相关动作的链接,包含在SRSDrillThroughCommon工程中,内部用到了DrillthroughHelper类,在命名空间Microsoft.Dynamics.AX.Application.Reports下,这个类提供方法来生成到AX MenuItem的链接,比如这样用:

[DataMethod(), PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
    public static string DrillThroughLinkToRoom(string reportContext, object fieldValue)
    {
        string tableName = "FCMRooms";
        Dictionary<string, object> fields = new Dictionary<string, object>();
        fields.Add("RecId", fieldValue);

        if (RuntimeReportContext.IsClientContext(reportContext))
        {
            // The report is being run from the Microsoft Dynamics AX client.
            return DrillthroughHelper.GenerateLinkToAXMenuItem(reportContext, "FCMRoomsForm", MenuItemType.Display, tableName, fields);
        }
        else
        {
            // The report is being run from Enterprise Portal.
            return DrillthroughHelper.GenerateLinkToAXMenuItem(reportContext, "RoomDetails", MenuItemType.WebMenuItemTypeUrl, tableName, fields);
        }

更多内容详见http://msdn.microsoft.com/EN-US/library/hh533446

 

原文地址:https://www.cnblogs.com/duanshuiliu/p/2654029.html