locked
How can add reference for reporting service? RRS feed

  • Question

  • Hi all, I wanna add the following class for reporting service, but vs 2005 just can find ddl, but cannot find the class DSWR and method such as FormatCostChangeValue, GetCostChangeValue...

    In report properites -> Reference Tab, I added assemply and build successfully.

    and the class name CustomReportCode.DSWR (Or DSWR  if no namespace) has the instance name "Code".

    But I cannot call the method for report text box...
    e.g. =Code.FormatCostChangeValue(SomeValue) ...

    Could you please advise me how can I do?

    Many thanks for any help or advice.

    using System;
    using System.Collections.Generic;
    using System.Text;
    
    //Target Framework - .NET 2.0
    namespace CustomReportCode
    {
        public class DSWR
        {
            public static string FormatCostChangeValue(string in_CostChangeValue)
            {
                if (!string.IsNullOrEmpty(in_CostChangeValue))
                {
                    return ", HK$" + in_CostChangeValue;
                }
                else
                {
                    return "";
                }
            }
    
            public string GetCostChangeValue(string in_CostChangeValue)
            {
                if (!string.IsNullOrEmpty(in_CostChangeValue))
                {
                    return ", HK$" + in_CostChangeValue;
                }
                else
                {
                    return "";
                }
            }
        }
    }
    

    .NET Beginner 3.5
    Wednesday, November 4, 2009 8:00 AM

Answers

  • Hi,

    As the class "DSWR" is not a static class, we need to instantiate the class before using the function.

    So, please use the following expression:
    =(new CustomReportCode.DSWR()).FormatCostChangeValue(SomeValue)


    Or we can follow these steps:
    1.In the "Reference" tab, there has a Instance list.
    2.In the Class Name, type " CustomReportCode.DSWR"
    3.In the Instance Name, type "myDSWR"
    4.Go back to the report, use the following expression:
    =Code.myDSWR.FormatCostChangeValue(SomeValue)

    Please feel free to ask, if you have any more questions.

    Thanks,
    Jin Chen
    Jin Chen - MSFT
    • Marked as answer by Jerry Nee Friday, November 13, 2009 7:52 AM
    Thursday, November 5, 2009 8:39 AM

All replies

  • Hi,

    As the class "DSWR" is not a static class, we need to instantiate the class before using the function.

    So, please use the following expression:
    =(new CustomReportCode.DSWR()).FormatCostChangeValue(SomeValue)


    Or we can follow these steps:
    1.In the "Reference" tab, there has a Instance list.
    2.In the Class Name, type " CustomReportCode.DSWR"
    3.In the Instance Name, type "myDSWR"
    4.Go back to the report, use the following expression:
    =Code.myDSWR.FormatCostChangeValue(SomeValue)

    Please feel free to ask, if you have any more questions.

    Thanks,
    Jin Chen
    Jin Chen - MSFT
    • Marked as answer by Jerry Nee Friday, November 13, 2009 7:52 AM
    Thursday, November 5, 2009 8:39 AM
  • Thank you, Jin, it's helpful~^^~
    .NET Beginner 3.5
    Monday, November 30, 2009 2:43 AM