Showing posts with label SSRS. Show all posts
Showing posts with label SSRS. Show all posts

Thursday, August 28, 2014

[AX 2012 - SSRS] DrillThroughCommonHelper.ToPurchTable does not work anymore

Normally you can use DrillThroughCommonHelper.ToPurchTable on your SSRS report to create a link to the PurchTable form:

[DataMethod(), PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
public static String drillThroughActionPurchId(String reportContext, String purchId)
{
  return DrillThroughCommonHelper.ToPurchTable(reportContext, purchId);
}

If this function somehow does not work anymore (in my case my client upgraded from AX 2012 to AX 2012 R2 and since the upgrade all the hyperlink to the PurchTable form does not work anymore), a workaround is by creating directly the hyperlink on the expression window (without business logic as the code above):

="MenuItemDisplay://PurchTable/+345+[1:" & Fields!PurchId.Value & "]"

345 is the ID of the PurchTable and 1 is the ID of the PurchId field.

Is there another way to fix it / make it work?

Tuesday, October 1, 2013

[AX 2012] SSRS: Excel sheet name

If you save a SSRS report to an Excel and you want to control the sheet name, you will not be able to do it via Visual Studio. You have to do it via SQL Server Report Builder because the PageName property is not available at Visual Studio (and AX).

Friday, January 13, 2012

AX SSRS: Use AX Label with localization

To use AX label with localization, you can wrap SysLabel::labelId2String static method or SysLabel::labelId2String2 static method in a data method and call it in the design:

[DataMethod(), AxSessionPermission(SecurityAction.Assert)]
public static String GetLabel(String labelId, String languageId)
{
    return SessionManager.GetSession().CallStaticClassMethod(
                          "SysLabel", "labelId2String2", labelId, languageId);
}


and use it: =GetLabel("@SYS103105", User!Language)

Wednesday, November 16, 2011

AX SSRS: CreateAxaptaRecord, CallStaticClassMethod, and CallStaticRecordMethod Sample Code

A sample code to get text of an item dependent on the (AX) user language in Data Method of Dynamics AX Reporting Project:

AxaptaWrapper axSession = SessionManager.GetSession();

AxaptaRecordWrapper userInfo =
  axSession.CreateAxaptaRecord(
    axSession.CallStaticClassMethod("xUserInfo", "find"));

AxaptaRecordWrapper inventTable = 
  axSession.CreateAxaptaRecord(
    axSession.CallStaticRecordMethod("InventTable", "find""ItemId"));

String itemText =
  (String)inventTable.Call("txt", userInfo.GetField("language"));


The AX code to get similar result is:

return InventTable::find("ItemId").txt(xUserInfo::find().language);

Tuesday, November 8, 2011

AX SSRS: Date Range

A sample code to specify date range values (with date format culture used by AX) for AX AOT Query in Data Method of Dynamics AX Reporting Project:

[DataMethod(), AxSessionPermission(SecurityAction.Assert)]
public static DataTable GetData(DateTime dateFrom, DateTime dateTo)
{
  Dictionary<string, object> ranges = new Dictionary<string, object>
  {
    {"AXTable.DateFieldRange",
      dateFrom.ToString(AxQuery.Culture) + ".." + dateTo.ToString(AxQuery.Culture)}
  };

  return AxQuery.ExecuteQuery("SELECT * FROM AXAOTQuery", ranges);
}

Monday, October 31, 2011

Note to Self: AX SSRS Default (Today) Value for Date Parameter

I find this useful as my copy and paste resource for my Dynamics AX Reporting Project development to create default (today) value for Date parameter:
=DateSerial(Year(NOW), Month(NOW), Day(NOW))

And the properties window snapshot:

Of course, other alternative is by using Datasets as following snapshot (taken from Cust ReportsLibrary):