Different designs will be called based on parameter value selection in Ax2012
My scenario is, by using multi select look up, whenever i select only one record in report parameter , that time one report design will be called, and whenever i select two more or null parameter that time another report design will be called. By using controller class we can complete this task.
class Wre_PurchPurchaseOrderController extends SrsReportRunController
{
PurchId purchid;
TransDate fromDate,toDate;
}
public int isSingleParameter()
{
Wre_PurchPurchaseOrderContract contract ;
int selectedParameters = 0;
int size = 6;
contract = this.parmReportContract().parmRdpContract() as Wre_PurchPurchaseOrderContract;
purchid = contract.parmPurchId();
if (strLen(purchID)< size || strLen(purchid)!= 0)
{
selectedParameters++ ;
}
return selectedParameters ;
}
public int isDoubleParameter()
{
Wre_PurchPurchaseOrderContract contract;
int selectedParameters = 1;
int size = 7;
contract = this.parmReportContract().parmRdpContract() as Wre_PurchPurchaseOrderContract;
purchid = contract.parmPurchId();
if (strLen(purchID) > size || strLen(purchid)== 0)
{
selectedParameters++ ;
}
return selectedParameters ;
}
protected void preRunModifyContract()
{
Wre_PurchPurchaseOrderContract contract;
contract = this.parmReportContract().parmRdpContract() as Wre_PurchPurchaseOrderContract;
if(this.isDoubleParameter() ==2)
{
this.parmReportContract().parmReportName(ssrsReportStr(Wre_PurchPurchaseOrder,Report));
}
else if(this.isSingleParameter() == 1)
{
this.parmReportContract().parmReportName(ssrsReportStr(Wre_PurchPurchaseOrder,Report_New));
}
else
{
this.parmReportContract().parmReportName(ssrsReportStr(Wre_PurchPurchaseOrder,Report));
}
super();
}
static void Main(Args _args)
{
Wre_PurchPurchaseOrderController controller = new Wre_PurchPurchaseOrderController();
Args args = new Args();
controller.parmArgs(args);
controller.parmReportName(ssrsReportStr(Wre_PurchPurchaseOrder,Report_New));
controller.parmShowDialog(true);
controller.startOperation();
}
Comments
Post a Comment