- Create a new query in AX 2012 from the AOT.
- Open a SSRS report and create a new data method.
- Replace the code with the following:
[DataMethod(), PermissionSet(SecurityAction.Assert, Name = "FullTrust")]
public static string TestMethod()
{
IEnumerable dt = Microsoft.Dynamics.Framework.Reports.AxQuery.ExecuteQueryStream("SELECT * FROM EmplQuery");
IEnumerator e = dt.GetEnumerator();
if (e.MoveNext())
return e.Current.Field(1);
else
return "No results";
}
Don't forget to rename the method to the one you created, replace "EmplQuery" with the name of your query, replace return type with your type and select the field that you want when returning.
Let me know if you want an example of returning a specific field by its name.
No comments:
Post a Comment