This is a migrated thread and some comments may be shown as answers.

User Defined Functions

3 Answers 175 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 16 Aug 2013, 07:44 PM
We have some internal staff using the Report designer to build different flavors of reports I have built in visual studio.

I previously provided them my report.dll so they could see those reports.

They have an expression in the report that slows down the processing of the report.  I would like to build a user defined function that could handle some of this and then I can use "SELECT CASE" statements, etc.   How can the current row of the dataset be based in a user defined function when it is called from an expression.  The expression is below.

= IIf(Fields.AdjType1 = "ETR",  "$" + " " + Fields.AdjAmount1,IIF(Fields.AdjType2 = "ETR",  "$" + " " + Fields.AdjAmount2,IIF(Fields.AdjType3 = "ETR",  "$" + " " + Fields.AdjAmount3,IIF(Fields.AdjType4 = "ETR",  "$" + " " + Fields.AdjAmount4,IIF(Fields.AdjType5 = "ETR",  "$" + " " + Fields.AdjAmount5,IIf

(Fields.AdjType1 = "ETR T",  "$" + " " + Fields.AdjAmount1,IIF(Fields.AdjType2 = "ETR T",  "$" + " " + Fields.AdjAmount2,IIF(Fields.AdjType3 = "ETR T",  "$" + " " + Fields.AdjAmount3,IIF(Fields.AdjType4 = "ETR T",  "$" + " " + Fields.AdjAmount4,IIF(Fields.AdjType5 = "ETR T",  "$" + " " + Fields.AdjAmount5,IIf(Fields.AdjType1 = "PARKT",  "$" + " " + Fields.AdjAmount1,IIF(Fields.AdjType2 = "PARKT",  "$" + " " + Fields.AdjAmount2,IIF(Fields.AdjType3 = "PARKT",  "$" + " " + Fields.AdjAmount3,IIF(Fields.AdjType4 = "PARKT",  "$" + " " + Fields.AdjAmount4,IIF(Fields.AdjType5 = "PARKT",  "$" + " " + Fields.AdjAmount5,IIF(Fields.OptSvcCust1Code = "ETR",  "$" + " " + Fields.OptSvcCust1TotalAmt,IIF(Fields.OptSvcCust2Code = "ETR",  "$" + " " + Fields.OptSvcCust2TotalAmt,IIF(Fields.OptSvcCust3Code = "ETR",  "$" + " " + Fields.OptSvcCust3TotalAmt,IIF(Fields.OptSvcCust4Code = "ETR",  "$" + " " + Fields.OptSvcCust4TotalAmt,IIF(Fields.OptSvcCust5Code = "ETR",  "$" + " " + Fields.OptSvcCust5TotalAmt,IIF(Fields.OptSvcCust6Code = "ETR",  "$" + " " + Fields.OptSvcCust6TotalAmt,IIF(Fields.OptSvcCust7Code = "ETR",  "$" + " " + Fields.OptSvcCust7TotalAmt,IIF(Fields.OptSvcCust8Code = "ETR",  "$" + " " + Fields.OptSvcCust8TotalAmt,IIF(Fields.OptSvcCust1Code = "ETR T",  "$" + " " + Fields.OptSvcCust1TotalAmt,IIF(Fields.OptSvcCust2Code = "ETR T",  "$" + " " + Fields.OptSvcCust2TotalAmt,IIF(Fields.OptSvcCust3Code = "ETR T",  "$" + " " + Fields.OptSvcCust3TotalAmt,IIF(Fields.OptSvcCust4Code = "ETR T",  "$" + " " + Fields.OptSvcCust4TotalAmt,IIF(Fields.OptSvcCust5Code = "ETR T",  "$" + " " + Fields.OptSvcCust5TotalAmt,IIF(Fields.OptSvcCust6Code = "ETR T",  "$" + " " + Fields.OptSvcCust6TotalAmt,IIF(Fields.OptSvcCust7Code = "ETR T",  "$" + " " + Fields.OptSvcCust7TotalAmt,IIF(Fields.OptSvcCust8Code = "ETR T",  "$" + " " + Fields.OptSvcCust8TotalAmt,IIF(Fields.OptSvcCust1Code = "PARKT",  "$" + " " + Fields.OptSvcCust1TotalAmt,IIF(Fields.OptSvcCust2Code = "PARKT",  "$" + " " + Fields.OptSvcCust2TotalAmt,IIF(Fields.OptSvcCust3Code = "PARKT",  "$" + " " + Fields.OptSvcCust3TotalAmt,IIF(Fields.OptSvcCust4Code = "PARKT",  "$" + " " + Fields.OptSvcCust4TotalAmt,IIF

(Fields.OptSvcCust5Code = "PARKT",  "$" + " " + Fields.OptSvcCust5TotalAmt,IIF(Fields.OptSvcCust6Code = "PARKT",  "$" + " " + Fields.OptSvcCust6TotalAmt,IIF(Fields.OptSvcCust7Code = "PARKT",  "$" + " " + Fields.OptSvcCust7TotalAmt,IIF(Fields.OptSvcCust8Code = "PARKT",  "$" + " " + Fields.OptSvcCust8TotalAmt,"")))))))))))))))))))))))))))))))))))))))

3 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 19 Aug 2013, 01:38 PM
Just use the DataObject instance:

=MyUserFunction(ReportItem.DataObject)
0
Peter
Top achievements
Rank 1
answered on 19 Aug 2013, 09:12 PM
Thank you for the information.   

The documentation does not clearly indicate how to define parameter descriptions.
0
Stef
Telerik team
answered on 22 Aug 2013, 02:06 PM
Hello Peter,

Just to add that you can use and the DataObject.RawData to get the current record data. For more details:

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
Report Designer (standalone)
Asked by
Peter
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Stef
Telerik team
Share this question
or