0

I need to know how can we use display methods in SSRS reports. I am having an issue. I have created extension class for an existing table. and under that class I have written my display method.

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

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

    return CustAccount; 
}

My report is a query based report. I am able to see the display method in report and also I have dropped the field into the report design. But there is no value on the report.

Please guide me though this.

FH-Inway
  • 4,432
  • 1
  • 20
  • 37

1 Answers1

0

If you are adding a display method to a table, your method has not a proper signature.

If you want to use the ExtensionOf attribute your code should be:

[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; 
    }
}

Alternately you can use a static display method - normally used for display methods binded in your forms - and your code should be:

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; 
    }
}

You used a mix of them, I am not sure it can work. Personally I have never used a display method in a SSRS for AX 365, but I guess the first solution (that I described) should work.

I hope it can help you.

Il Vic
  • 5,576
  • 4
  • 26
  • 37
  • The first solution worked in a form. It was not working as per my code. but still unable to get it on the SSRS. – Vishal Jevtani Jun 22 '17 at 08:10
  • I found some strange behavior. If I am keeping the method signature as in your code, it is working fine on the form but report is not being executed, it throws error "An error occurred during report data sets execution." On the other hand, if I change the signature as per my code, Form is throwing error but report is working fine. But obviously with no value from display method. – Vishal Jevtani Jun 22 '17 at 08:34