Adding RDP parameter to report
Let us see how to add parameter to existing report. We will
take up customer transaction report and add from date and to date as parameters.
Step 1: Create 2 parm
methods in CustTransListContract
For FromDate and
ToDate
/// <summary>
/// Gets or sets the
value of the datacontract parameter FromDate.
/// </summary>
/// <param
name="_fromDate">
/// The new value of
the datacontract parameter FromDate; optional.
/// </param>
/// <returns>
/// The current value
of datacontract parameter FromDate.
/// </returns>
[
DataMemberAttribute('FromDate'),
SysOperationHelpTextAttribute(literalStr("@SYS26930"))
]
public FromDate parmFromDate(FromDate
_fromDate = fromDate)
{
fromDate
= _fromDate;
return fromDate;
}
/// <summary>
/// Gets or sets the
value of the datacontract parameter ToDate.
/// </summary>
/// <param
name="_toDate">
/// The new value of
the datacontract parameter ToDate; optional.
/// </param>
/// <returns>
/// The current value
of datacontract parameter ToDate.
/// </returns>
[
DataMemberAttribute('ToDate'),
SysOperationHelpTextAttribute(literalStr("@SYS26929"))
]
public ToDate parmToDate(ToDate _toDate
= toDate)
{
toDate =
_toDate;
return toDate;
}
Step 2: Check for initialisation code in processReport method
of CustTransListDP class
contract =
this.parmDataContract() as
CustTransListContract;
Step 3: Assign the parameter value to local variable and use
it for filtering in process report.
FromDate FromDate;
ToDate
ToDate;
fromDate = contract.parmDate();
toDate =
contract.ToDate();
if ((cursor.TableId ==
custTable.TableId ||
!(remainAmount &&
(custTrans.CurrencyCode ? custTrans.AmountCur ==
custTrans.SettleAmountCur : custTrans.AmountMST == custTrans.SettleAmountMST)))
&&
(custTrans.TransType != LedgerTransType::ExchAdjustment ||
(custTrans.TransType == LedgerTransType::ExchAdjustment &&
this.balanceMST(exchangeAdjustmentType) != 0))
&& (custInvoiceJour.InvoiceDate
>= fromdate && custInvoiceJour.InvoiceDate <= toDate) )
{
// insertion code as is
}
Step 4: Add fromDate and ToDate form control(dialog control)
in form(dialog) for end user input in CustTransListUIBuilder-> build method.
FromDateField =
this.bindInfo().getDialogField(custTransListContract, methodStr(CustTransListContract,
parmfromDate));
ToDateField
= this.bindInfo().getDialogField(custTransListContract, methodStr(CustTransListContract,
parmToDate));
Step 5:Compile forward the contract class,UI builder and DP
classes which were updated before.
Step 6: Open the report design in visual studio and check
the parameters node available for fromDate and toDate
Build and Deploy the report.
If parameter is unavailable then
Right click datasets and add new dataset . Update the
properties as below.
Select CustTransListDP and all fields . Click next and finish the wizard.
Redeploy the report.
Step 6: Delete report from report manager site.
Report manager url is available at following location.
System Administration -> Setup-> Business Intelligence
-> Reporting Services-> Report servers
Redeploy the report.
Restart AOS.
Restart SSRS service.




No comments:
Post a Comment