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

Error loading layout!

4 Answers 100 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 04 May 2017, 03:23 PM

Hi,

I'm having this error when loading a layout with a CustomAggregate.

I'm attaching the Layout XML

4 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 04 May 2017, 03:27 PM
My custom aggregate
0
Daniel
Top achievements
Rank 1
answered on 04 May 2017, 03:28 PM
public class CountDistinctAggregateFunction : Telerik.Pivot.Core.Aggregates.AggregateFunction
    {
        public override string DisplayName
        {
            get { return "CountDistinct"; }
        }

        protected override AggregateValue CreateAggregate(Type dataType)
        {
            return new CountDistinctAggregate();
        }

        public override string GetStringFormat(Type dataType, string format)
        {
            if (format == null)
            {
                return "G";
            }

            return format;
        }

        public override string ToString()
        {
            return "CountDistinct";
        }

        public override bool Equals(object obj)
        {
            return obj is CountDistinctAggregateFunction;
        }
0
Accepted
Hristo
Telerik team
answered on 05 May 2017, 04:47 PM
Hello Daniel,

Thank you for writing.

Our Save/Load API is relying on .NET 2.0 and cannot serialize the custom aggregation functions because it cannot use the DataContract attribute. In case you would be using our .40(.NET 4.0) assemblies you could serialize and deserialize the custom functions by implementing a custom DataProviderSerializer similar to the approach with of cubes: http://docs.telerik.com/devtools/winforms/pivotgrid/save-and-load-layout/serialize-adomddataprovider.

I am sending you attached a sample project which should get you going. 

I hope this helps. Please let me know if you need further assistance.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Daniel
Top achievements
Rank 1
answered on 29 Jun 2017, 02:07 PM
That worked great! Thanks
Tags
PivotGrid and PivotFieldList
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or