User Defined Functions

4 posts, 0 answers
  1. Peter
    Peter avatar
    71 posts
    Member since:
    Mar 2012

    Posted 16 Aug 2013 Link to this post

    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,"")))))))))))))))))))))))))))))))))))))))

  2. Squall
    Squall avatar
    174 posts
    Member since:
    Feb 2011

    Posted 19 Aug 2013 Link to this post

    Just use the DataObject instance:

    =MyUserFunction(ReportItem.DataObject)
  3. DevCraft banner
  4. Peter
    Peter avatar
    71 posts
    Member since:
    Mar 2012

    Posted 19 Aug 2013 Link to this post

    Thank you for the information.   

    The documentation does not clearly indicate how to define parameter descriptions.
  5. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 22 Aug 2013 Link to this post

    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.

Back to Top