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

AggregateFunctions SumFunction not working in Version 2012_1_0326

17 Answers 226 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Gert
Top achievements
Rank 1
Gert asked on 28 Mar 2012, 03:58 PM
Dear Telerik,

Today we have upgraded to version 'RadControls_for_WPF_2012_1_0326'.
We have encountered a problem after upgrading.
The Aggregate Sumfunction of our RadTreeListView always displays 0 instead of the right sum.

Did something change in the new version ?

Regards,
Gert



<
telerik:GridViewDataColumn DataMemberBinding="{Binding CalVal,StringFormat=N,ConverterCulture=DE}" Header="Σ" Width="Auto" TextAlignment="Right" FooterTextAlignment="Right"  IsReadOnly="True">
<telerik:GridViewDataColumn.CellStyle>
          <Style TargetType="telerik:GridViewCell">
               <Setter Property="Background" Value="{Binding parentItem, Converter={StaticResource backColorConvertor},ConverterParameter=Summe}" />
           </Style>
 </telerik:GridViewDataColumn.CellStyle>
<telerik:GridViewDataColumn.AggregateFunctions>
            <telerik:SumFunction SourceField="CalVal" Caption="Sum: " />
 </telerik:GridViewDataColumn.AggregateFunctions>
</telerik:GridViewDataColumn>

17 Answers, 1 is accepted

Sort by
0
Henri
Top achievements
Rank 1
answered on 29 Mar 2012, 09:34 AM
Hi,

I have the same problem. The Aggregate functions in the RadGridView work fine, but in the RadTreeListView it is always 0.
I tried defining the functions in the code-behind, but that did not help. I tried setting the SourceFieldType but that did not help either.

Can you please check this?

Best Regards,

Henri

0
Vera
Telerik team
answered on 29 Mar 2012, 09:42 AM
Hi,

 
Thank you for reporting this issue. We were able to reproduce it on our side and we will do our best to provide a fix as soon as possible. 

Excuse us for the inconvenience caused.

Greetings,
Vera
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Vera
Telerik team
answered on 02 Apr 2012, 02:46 PM
Hi,

 
The issue was resolved and the fix for it will be part of our next Internal Build expected till the end of the day.

Greetings,
Vera
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Henri
Top achievements
Rank 1
answered on 03 Apr 2012, 09:27 AM
The SumFunction is working again in version 2012.1.402.40.
Thank you :)
0
Gert
Top achievements
Rank 1
answered on 03 Apr 2012, 11:23 AM
Ok, thx !
0
gisela
Top achievements
Rank 1
answered on 16 Apr 2012, 12:01 PM
Hi All,

I am working with trial version 2012.1.326.1050.
The definition of the datacolumn is:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Data}"

Header="Umsatz"

Background="#10FFFFFF"

 

TextAlignment="Right"

 

Width="100"

HeaderTextAlignment="Right">

 

<telerik:GridViewDataColumn.AggregateFunctions>

 

<telerik:SumFunction Caption="Sum: " />

 

</telerik:GridViewDataColumn.AggregateFunctions>

 

</telerik:GridViewDataColumn>



and I get an error with the following stacktrace:

Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.ConvertMemberAccessExpressionIfNecessary(Expression memberExpression)
   bei Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.CreateMemberSelectorExpression()
   bei Telerik.Windows.Data.Expressions.EnumerableSelectorAggregateFunctionExpressionBuilder.CreateAggregateExpression()
   bei Telerik.Windows.Data.EnumerableSelectorAggregateFunction.CreateAggregateExpression(Expression enumerableExpression)
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<ProjectionPropertyValueExpressions>b__3(AggregateFunction f)
   bei System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateProjectionInitExpression()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateAggregateFunctionsProjectionMemberBinding()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.<CreateMemberBindings>d__0.MoveNext()
   bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   bei System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)
   bei System.Linq.Expressions.Expression.MemberInit(NewExpression newExpression, IEnumerable`1 bindings)
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateSelectBodyExpression()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.CreateResultSelectorExpression()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilder.get_ResultSelectorExpression()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorExpressionBuilderBase.CreateQuery()
   bei Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateChildQuery(GroupDescriptorExpressionBuilder childBuilder)
   bei Telerik.Windows.Data.Expressions.GroupDescriptorCollectionExpressionBuilder.CreateQuery()
   bei Telerik.Windows.Data.QueryableExtensions.GroupBy(IQueryable source, IEnumerable`1 groupDescriptors)
   bei Telerik.Windows.Data.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
   bei Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
   bei Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()
   bei Telerik.Windows.Controls.GridViewColumnCollectionInternal.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   bei System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   bei Telerik.Windows.Controls.GridViewColumnCollectionInternal.InsertItem(Int32 index, GridViewColumn item)
   bei System.Collections.ObjectModel.Collection`1.Add(T item)
   bei System.Collections.ObjectModel.Collection`1.System.Collections.IList.Add(Object value)
   bei MS.Internal.XamlManagedRuntimeRPInvokes.Add(XamlQualifiedObject& qoCollection, XamlPropertyToken inCollectionProperty, XamlQualifiedObject& inValue)

For the "CountFunction" all works fine and in the previous version 2011.3.1220.1040 i have had no problems.

I want to use the DataBar in the treelistview control, so i have to change the version.

Is it possible to get the version 2012.1.402.40 for trials ?

Thanks

Gisela




0
gisela
Top achievements
Rank 1
answered on 16 Apr 2012, 12:11 PM
Sorry, i have forgotton to say, that i am working with Silverlight.

Thanks
0
Vera
Telerik team
answered on 16 Apr 2012, 12:34 PM
Hi Gisela,

 
Unfortunately, we were not able to reproduce the issue. May I ask you to open a support ticket and to send a simple runnable project demonstrating the problem? 

Thank you in advance.

All the best,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Erol
Top achievements
Rank 1
answered on 05 Nov 2012, 08:44 PM
Just started getting this problem. Updated today to RadControls for WPF Q3 2012 (2012.3.1017.40).
<radGrid:RadTreeListView ItemsSource="{Binding ...}">
    <radGrid:RadTreeListView.ChildTableDefinitions>
        <radGrid:TreeListViewTableDefinition ItemsSource="{Binding ....}">
            </radGrid:TreeListViewTableDefinition>
        </radGrid:RadTreeListView.ChildTableDefinitions>
    <radGrid:RadTreeListView.Columns>
        <radGrid:GridViewDataColumn UniqueName="Amount" DataMemberBinding="{Binding Amount}" DataFormatString="{}{0:c}" >
            <radGrid:GridViewDataColumn.AggregateFunctions>
                <teldata:SumFunction Caption="" ResultFormatString="{}{0:c}" SourceField="Amount" />
            </radGrid:GridViewDataColumn.AggregateFunctions>
        </radGrid:GridViewDataColumn>
    </radGrid:RadTreeListView.Columns>
</radGrid:RadTreeListView>
0
Vera
Telerik team
answered on 06 Nov 2012, 09:17 AM
Hi Erol,

 
We found a problem with the format string of the aggregate function result. The currency sign in the footer is different than the one in the column. May I ask you to clarify if this is the exact problem you experience? What is your current culture?

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Erol
Top achievements
Rank 1
answered on 06 Nov 2012, 01:23 PM
Vera,

Thanks for the quick response.

I do not have a culture specified. App is in-house and is under en-US only and not meant to support anything else. There have been no code changes, also this is the only instance of RadTreeListView in the application.
Previous RadControls version was 2012.1.215.40. Which I upgraded yesterday to the new dlls and this stopped working. RadGrid total rows are unaffected.

The exact problem is that the footer shows $0.00 as total. Do you want me to specify culture specifically for the tree list?

Thanks,
Erol
0
Vera
Telerik team
answered on 06 Nov 2012, 03:29 PM
Hello Erol,

 
The issue you experience was fixed a long time ago. May I ask you to take a look at the attached project? Are you able to get the problem on it? 

Greetings,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Erol
Top achievements
Rank 1
answered on 12 Nov 2012, 06:14 PM
Vera,

Thanks for your project, it helped realize the difference.

My inner list is not the same as outer. It is not a self referencing structure and it is a 2 level structure only. Somehow the new sum function expects the child element to be of the same type as the parent element.

I have modified the project you provided with my changes to replicate the issue as below,
public class WarehouseItemInner
    {
        public WarehouseItemInner()
        {
  
        }
 
        public WarehouseItemInner(string name, decimal count, DateTime date, bool isExpanded)
        {
            this.Name = name;
            this.Count = count;
            this.Date = date;
            this.IsExpanded = isExpanded;
        }
 
        public bool IsExpanded
        {
            get;
            set;
        }
 
        public string Name
        {
            get;
            set;
        }
 
        public decimal Count
        {
            get;
            set;
        }
 
        public DateTime Date
        {
            get;
            set;
        }
 
        public override string ToString()
        {
            return this.Name;
        }
    }
 
 
public static ObservableCollection<WarehouseItem> GetWarehouseData()
        {
            ObservableCollection<WarehouseItem> data = new ObservableCollection<WarehouseItem>();
             
            WarehouseItem drinks = new WarehouseItem("_Drinks", 1, new DateTime(2011, 12, 1), true);
            drinks.Items.Add(new WarehouseItemInner("Water", 20.2M, new DateTime(2011, 12, 2), false));
            data.Add(drinks);
            WarehouseItem vegetables = new WarehouseItem("Vegetables", 40, new DateTime(2011, 12, 9), true);
            vegetables.Items.Add(new WarehouseItemInner("Tomato", 50, new DateTime(2011, 12, 10), false));
            vegetables.Items.Add(new WarehouseItemInner("Carrot", 50, new DateTime(2011, 12, 11), false));
            vegetables.Items.Add(new WarehouseItemInner("Onion", 50, new DateTime(2011, 12, 12), false));
            data.Add(vegetables);
            WarehouseItem fruits = new WarehouseItem("Fruits", 50, new DateTime(2011, 12, 13), true);
            fruits.Items.Add(new WarehouseItemInner("Cherry", 60, new DateTime(2011, 12, 14), false));
            fruits.Items.Add(new WarehouseItemInner("Apple ", 60, new DateTime(2011, 12, 15), false));
            fruits.Items.Add(new WarehouseItemInner("Melon", 60, new DateTime(2011, 12, 16), false));
            data.Add(fruits);
       
            return data;
        }
 

Let me know if this can be handled directly or if it is possible for me to just override the data in footer to show a pre-calculated number.

Thanks,
Erol
0
Vera
Telerik team
answered on 13 Nov 2012, 11:44 AM
Hi Erol,

 
Unfortunately, your scenario is not supported. What you can do in order to achieve the desired result is to use a custom aggregate function. You can take a look at this demo as well. Those are Silverlight demos but you can find them in your WPF local copy.

I hope this helps.

Regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Erol
Top achievements
Rank 1
answered on 13 Nov 2012, 03:25 PM
Vera,

Thanks a lot. Will do Custom Aggregates. BTW another upgrade related issue, this time RichTextBox raised here http://www.telerik.com/community/forums/wpf/richtextbox/html-export-of-td-with-colspan-has-wrong-width.aspx#2372219

Thanks,
Erol
0
Eddy
Top achievements
Rank 1
answered on 17 Oct 2013, 12:21 PM
Why does't it work in Version 2013_2_0724?

When I use SumFunction in TreeListView,it always get 0.but it's right in GridView.
0
Yoan
Telerik team
answered on 22 Oct 2013, 08:36 AM
Hello Li,

Does your collection contain homogeneous data? Please keep in mind that TreeListView is designed to work with homogeneous data. 


Regards,
Yoan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TreeListView
Asked by
Gert
Top achievements
Rank 1
Answers by
Henri
Top achievements
Rank 1
Vera
Telerik team
Gert
Top achievements
Rank 1
gisela
Top achievements
Rank 1
Erol
Top achievements
Rank 1
Eddy
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or