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

No comments:

Post a Comment