Monday, 16 December 2013

Controller Class for the current Record SSRS Report in Ax 2012

Controller Class for the current Record
Controller Class :
class ProjHourUtilisationController extends SrsReportRunController
{
#define.ReportName('ProjHourUtilisation.PrecisionDesign1')
ProjHourUtilisationContract projHourUtilisationContract;
ProjTable projTable ;
}
____________________________________________________________________
protected void prePromptModifyContract()
{
if (this.parmArgs() &&this.parmArgs().record() && this.parmArgs().dataset() == tableNum(ProjTable))
{
projTable = this.parmArgs().record();
}
if (!projHourUtilisationContract)
{
projHourUtilisationContract = this.parmReportContract().parmRdpContract();
}
projHourUtilisationContract.parmProjectId(projTable.ProjId);
super();
}
___________________________________________________________________
public void setRange(Args _args, Query _query)
{
QueryBuildDataSource qbds;
QueryBuildRange qbr;
if (_args && _args.dataset())
{
switch(_args.dataset())
{
case tableNum(ProjTable) :
projTable = _args.record();
break;
}
}
qbds = _query.dataSourceTable(tableNum(ProjTable));
qbds.clearRanges();
//qbr = qbds.findRange(fieldName2id(tableNum(ProjTable),fieldStr(ProjTable, ProjId)));
if (!qbr)
{
qbr = qbds.addRange(fieldNum(ProjTable, ProjId));
}
if(ProjTable)
{
qbr.value(projTable.ProjId);
}
}
___________________________________________________________________
public boolean showQueryValues(str parameterName)
{
return true;
}
____________________________________________________________________
public static ProjHourUtilisationController construct(Args _args)
{
ProjHourUtilisationController controller=new ProjHourUtilisationController();
controller.parmArgs(_args);
return controller;
}
_____________________________________________________________________
public static void main(Args _args)
{
ProjHourUtilisationController controller = new ProjHourUtilisationController();
controller.parmReportName(#ReportName);
controller.parmArgs(_args);
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
controller.parmShowDialog(true);
controller.startOperation();
}

No comments:

Post a Comment