Telerik Aggregate function in code behind

2 posts, 0 answers
  1. Sobiya
    Sobiya avatar
    21 posts
    Member since:
    Jan 2013

    Posted 30 Jan 2013 Link to this post

    Hi,

    I am working on telerik reports and used a function for selecting all values by default
    for multivalue parameter, i am using value in parameter like 'AllValues(Parameters.ParameterName.Value)',
    and function is written in report code behind as-

    [AggregateFunction(Description = "Collects all values", Name = "AllValues")]
            public class AllValuesAggregateFunction : IAggregateFunction
            {
                ArrayList values;

                public void Accumulate(object[] values)
                {
                    var value = values[0];
                    this.values.Add(value);
                }

                public object GetValue()
                {
                    return this.values;
                }

                public void Init()
                {
                    this.values = new ArrayList();
                }

                public void Merge(IAggregateFunction aggregateFunction)
                {
                    var otherFunction = (AllValuesAggregateFunction)aggregateFunction;
                    this.values.AddRange(otherFunction.values);
                }
            }

    now i have some parameters which are added from code , how can i use this function for those parameters
    this.ReportParameters["Department"].Value= ??


  2. Hadib Ahmabi
    Hadib Ahmabi avatar
    181 posts
    Member since:
    Nov 2011

    Posted 01 Feb 2013 Link to this post

    I guess you can use the same expression:
    this.ReportParameters["Department"].Value= "AllValues(Parameters.ParameterName.Value)";

    or you can directly assign the collection of the real parameter values 
    this.ReportParameters["Department"].Value= DepartamentParameterValuesList; //this is some collection of the actual values
  3. DevCraft banner
Back to Top