Friday, 21 November 2014

Passing parameter to Report for Selected Record in Grid

Passing Parameter to Report for Selected Record in Grid

example: let us create Purchase Requisition Report

Step 1:

Create a Class

public class PurchreqDetails extends SrsReportRunController
{
}

public void prePromptModifyContract()
{

    this.setRanges(this.parmReportContract().parmQueryContracts().lookup(this.getFirstQueryContractKey()));

}

public void setRanges(
    Query _query)
{
    MultiSelectionHelper    multiSelectionHelper;
    InternalExternal        argsDescription;

    argsDescription = this.parmArgs().parmEnum();


    _query.dataSourceTable(tableNum(PurchReqTable)).clearRanges();
    _query.dataSourceTable(tableNum(PurchReqTable)).addRange(fieldNum(PurchReqTable, PurchReqId));


    if (this.parmArgs().dataset() == tableNum(PurchReqTable) && this.parmArgs().caller())
    {
        multiSelectionHelper = MultiSelectionHelper::createFromCaller(this.parmArgs().caller());
        multiSelectionHelper.createQueryRanges(_query.dataSourceTable(tableNum(PurchReqTable)), fieldStr(PurchReqTable, PurchReqId));
    }


}

public static void main(Args _args)
{
    PurchreqDetails controller  = new PurchreqDetails();

    controller.parmReportName(ssrsReportStr(report10,sample1));
    controller.parmArgs(_args);
    controller.startOperation();
}


Step 2:
Create a query
AOT>Query>new Query


Step 3:
Create Report ssrs Report Design




 Step 4:

Create Menu Item and Attach it in PurchReqTableListPage Form in action Pane

Click on Purchreq report









Completed guys




1 comment: