Send to email the SSRS report in batch

Hello All, can some body please help me on the following problem:
I have an SSRS report, which normally should be sent in batch (once per month) on to the certain email, but some time the user should have a possibility to create a report manually.
The problem is:

  1. If the report is in batch, it should contain information for previous month, i.e. if today is March 2015, the report should contain information for February 2015. //how and in which class I should input such check (whether the report created in batch or not?)

  2. When the user create a report manually, he should choose the type of equipment (see the next item)

  3. The report should be created for the three different type of equipment (EQ1, EQ2, EQ3 – base enum). The logic of the report creation for EQ1 and EQ2 is the same, but for the EQ3 the report should contain information for the previous calendar quarter, i.e. if today is March 2015, the report for the EQ3 should contains information for the period Oct2014-Dec2014. //how to generate a report for each category in batch? (I understand that it should be a loop, please explain a bit more)

  4. The report should be sent in xls

So, generally, there are three questions:

  1. how and in which class I should input such check (whether the report created in batch or not?)

  2. how to generate a report for each category in batch?

  3. And last but not least: how to email a report (I would appreciate a step by step explanation), I’m sure that someone has already created such post, but surfing related sites I have found different approaches and I can’t put them together, so just provide please with link

The report is on Ax 2012, created based on RDP, Contract, UI Builder and Controller classes.
Thanks a lot

User can run the report manually and send it to batch, therefore checking whether it runs in batch or not isn’t useful. You should do the distinction by parameters. If you want to run a query for previous month, you could simply set a range to (monthRange(-1, 0)) when configuring the batch.

Regarding e-mails, please look at How To: Directing Reports to Email.

Hello Martin,

Thank you for reply!

You suggested not exactly what I expected, but your advise helped me to find another way (please see below)

I would appreciate if you have time to verify/improve it. Thank you.

int qtyEnum;

int counter;

DictEnum iEnum;

SRSPrintMediumType printType;

ReportContract contract;


contract = this.parmReportContract().parmRdpContract() as ReportContract;

printType = this.parmReportContract().parmPrintSettings().printMediumType();

iEnum = new DictEnum(enumName2Id(#insuranceCategory));

qtyEnum = iEnum.values();

if (printType != SRSPrintMediumType::Email)


throw error("@Error");


for(counter = 0; counter < qtyEnum; counter ++)


if(iEnum.index2Value(counter) == myEDTName::Eq1)


//TODO set the default values for category and maybe something else