Tuesday, 16 July 2013

Controller class code


Controller class:(al khaldi)
 class SIController extends SrsReportRunController
{
  #define.ReportName(‘SIRep.PrecisionDesign1′)
    SIContract SIContract;
    CustInvoiceJour CustInvoiceJour ;
}

 protected void prePromptModifyContract()
{
   /* if (this.parmArgs()             &&
        this.parmArgs().record()    &&
        this.parmArgs().dataset() == tableNum(CustInvoiceTrans))
    {
        CustInvoiceTrans = this.parmArgs().record();
    }
    if (!SIContract)
    {
        SIContract = this.parmReportContract().parmRdpContract();
    }
    SIContract.parmProjectId(projTable.ProjId);
   */
    super();
}

public void setRange(Args _args, Query _query)
{
    QueryBuildDataSource qbds;
    QueryBuildRange qbr;
    if (_args && _args.dataset())
    {
        switch(_args.dataset())
        {
            case tableNum(CustInvoiceJour) :
                CustInvoiceJour = _args.record();
                break;
        }
    }

    qbds = _query.dataSourceTable(tableNum(CustInvoiceJour));

    qbds.clearRanges();

    qbr = qbds.findRange(fieldName2id(tableNum(CustInvoiceJour),fieldStr(CustInvoiceJour, SalesId)));
  
    if (!qbr)
    {
        qbr = qbds.addRange(fieldNum(CustInvoiceJour, SalesId));
    }
    if(CustInvoiceJour)
    {
        qbr.value(CustInvoiceJour.SalesId);
    }

}

public boolean showQueryValues(str parameterName)
{
    return true;
}
 public static SIController construct(Args _args)
{
    SIController controller=new SIController();
    controller.parmArgs(_args);
    return controller;
}

public static void main(Args _args)
{
    SIController controller = new SIController();
    controller.parmReportName(#ReportName);
    controller.parmArgs(_args);
    controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
    controller.parmShowDialog(false);
    controller.startOperation();
 }


Bhanu’s controller class:
Controller :
If  you create Controller class, then you need to create output menu item, set  property Object type – class, Object – Controller class created,  Linked permission type – SSRS report, Linked Permission object – SSRS report Created,  Linked permission object type – Design name.
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