0

我需要知道如何在 SSRS 报告中使用显示方法。我有一个问题。我为现有表创建了扩展类。在那个类下我写了我的显示方法。

[SysClientCacheDataMethodAttribute(true)]
public display CustAccount CustAccount(ProdTable _prodTable)
{
   CustAccount custAccount;

   if (_prodTable.InventRefType == InventRefType::Sales)
   {
       custAccount = SalesTable::find(_prodTable.InventRefId).CustAccount;
   }

    return CustAccount; 
}

我的报告是基于查询的报告。我能够在报表中看到显示方法,并且我已将该字段放入报表设计中。但这份报告没有任何价值。

请尽管指导我。

4

1 回答 1

0

如果您将display方法添加到表中,则您的方法没有正确的签名。

如果你想使用ExtensionOf属性,你的代码应该是:

[ExtensionOf(tableStr(ProdTable))]
public final class ProdTable_Extension
{
    [SysClientCacheDataMethodAttribute(true)]
    public display CustAccount custAccount()
    {
       CustAccount custAccount;

       if (this.InventRefType == InventRefType::Sales)
       {
           custAccount = SalesTable::find(this.InventRefId).CustAccount;
       }

        return CustAccount; 
    }
}

或者,您可以使用静态显示方法- 通常用于绑定在表单中的显示方法 - 您的代码应该是:

public static class ProdTable_Extension
{
    [SysClientCacheDataMethodAttribute(true)]
    public static display CustAccount custAccount(ProdTable _this)
    {
       CustAccount custAccount;

       if (_this.InventRefType == InventRefType::Sales)
       {
           custAccount = SalesTable::find(_this.InventRefId).CustAccount;
       }

        return CustAccount; 
    }
}

你混合使用了它们,我不确定它是否可以工作。就我个人而言,我从未在 AX 365 的 SSRS 中使用过显示方法,但我想第一个解决方案(我所描述的)应该可以工作。

我希望它可以帮助你。

于 2017-06-20T13:46:34.850 回答