SSRS Report

hi,

In SSRS Report I’m calling class with below query. I have to set return type for method. I set inventTable. I’m getting inventTable record in SSRS report but how can I call to inventsum record in SSRS report?

InventTable querySSRS( … _primaryVendor)
{

(…)

select inventSum
join inventTable
join inventDim
where inventTable.ItemId == inventSum.ItemId
&& inventTable.PrimaryVendorId == _primaryVendor
&& inventTable.ABCXYZ_RS == ABCXYZ_RS::AX
&& inventTable.QuotationStatus_RS == InventQuotationStatus_RS::Permanent
&& inventDim.inventDimId == inventSum.InventDimId
&& inventDim.InventLocationId == ‘MG’;

return inventTable;

}

SSRS report BL;

public static DataTable dmGetValueQuery (string primaryVendor)
{
AxaptaWrapper ax = SessionManager.GetSession();
AxaptaObjectWrapper axClass = ax.CreateAxaptaObject(“ARTDeliveryMinimumSSRS”);
AxaptaRecordWrapper axRecord = ax.CreateAxaptaRecord(axClass.Call(“deliveryMinimumQuery”, primaryVendor));

DataTable retTable = new DataTable();
CultureInfo myCultureInfo = new CultureInfo(“en-gb”);

retTable.Locale = CultureInfo.CurrentCulture;

retTable.Columns.Add(“ItemId”, typeof(String));
retTable.Columns.Add(“PrimaryVendor”, typeof(String));

while (axRecord.Found)
{
retTable.Rows.Add(axRecord.GetField(“ItemId”), axRecord.GetField(“AvailPhysical”));

axRecord.Next();
}

return retTable;
}

Hi,

well, “return inventTable” says it all. You are only returning InventTable from that method.

By the way - you haven’t mentioned the AX version you are using… is it AX 2009? or AX 2012?

If by any case it is AX 2012 then I would strongly advise you to use RDP framework instead (create a class that would fill up data in a temp table with all you necessary fields). OR what’s even better - you could just simply use an AX query and that one WOULD return all the records contained in AX query (InventTable, InventSum and InventDim).

If it is AX 2009… then I wonder if the use of BL data method has had any benefit. From the code you have shared above, I doesn’t look like you would really need a data method. That whole “SELECT” statement that you have there above could be definable within an AX query object… The other way around would be if you would create a kind of a Helper class for this report which would have static methods that you could call with parameters that would return the InventSum record for the matching ItemId or whatever else.

If there is a chance not to use BL, then avoid it. A report with BL works slower than the one working directly with AX queries.

Janis

I use 2009 version.

This query is incomplete. There is condition with< > signs. I commented it for testing purpose and forgot copy to forum. I can’t use standard query object.

&& inventSum.AvailPhysical < reqItemTable.MaxInventOnhand
&& inventSum.AvailPhysical > reqItemTable.MinInventOnhand;

Now I wrote helper class which return what I need.

I would like to know this good way… :slight_smile: