PivotGrid -> CalculatedField -> TotalFormat -> DifferenceFromPrevious

4 Answers 77 Views
PivotGrid
Chris
Top achievements
Rank 1
Iron
Chris asked on 07 Feb 2023, 07:33 AM | edited on 09 Feb 2023, 09:49 AM

Hi all,

I have a question regarding calculated fields and the TotalFormat option DifferenceFromPrevious: I am using dates to compare previous values and obviously the first date compare values will be empty as there is no date to compare to (see the uploaded image). I would like to be able to remove empty columns.  How would I accomplish that? Also, is there an option to exclude the total columns?

Regards,

Chris

Chris
Top achievements
Rank 1
Iron
commented on 09 Feb 2023, 07:06 AM

Hi!

Could somebody please give an answer to my question? That would be great, thanks :-)

 

Regards,

Chris

Chris
Top achievements
Rank 1
Iron
commented on 13 Feb 2023, 09:40 AM

Hi,

well, to be honest, this is not what I would expect from writing into the Telerik forum: If a customer aquires and uses your controls, then he should expect appropriate support if things are not working as they should. I have also posted another question that has been left unanswered: https://www.telerik.com/forums/using-percentdifferencefromprevious-function-within-a-calculatedaggregatedescription-based-on-a-calculated-field-has-unwanted-side-effects .

I am a freelancer currently working for a client in the banking sector that has aquired the WPF Telerik controls to use the pivot functionality among other things. The controls may be good, but if the support isn´t - why stay with Telerik?

Regards,

Chris

4 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 15 Feb 2023, 02:34 PM

Hello Chris,

There isn't an easy way to remove a column/row from the generated RadPivotGrid. This is due to the fact that there isn't really a specific visual element that represents rows/columns, since the control utilizes as few visual elements as possible to optimize performance.

That said, I investigated the scenario and I have come up with a possible approach that you can try. It involves handling the Completed event of the RadPivotGrid viewmodel via reflection and removing the groups that you want before they are passed to the RadPivotGrid to be drawn.

I am attaching the sample project that you sent in the other forum thread modified to demonstrate what I have in mind. Note, that I have setup the logic in the Completed handler just as a demonstration and it is tailored for the specific arrangement of descriptions that I have added. You will need to update it in order to handle different scenarios.

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Chris
Top achievements
Rank 1
Iron
commented on 16 Feb 2023, 07:15 AM

Hi Vladimir!

Thanks a lot for the example. You pointed me in the right direction :-) I know where and how to start the adjustments now. The example works for that specific setting, but breaks the layout when adding additional columns. I´ll take a deeper look into that. Thanks again for your effort!

Regards,

Chris

Chris
Top achievements
Rank 1
Iron
commented on 20 Feb 2023, 10:07 AM

Hi Vladimir,

unfortunately my adaptation of your solution in my project throws sporadic unhandled exceptions within the Telerik library. I cannot reproduce this error in your solution and suspect a race condition in the more complex project of mine. I was able to catch the exception and the StackTrace, see the attached picture. This error can occur when initially loading the PivotGrid. The column modifications within the CompletedEventHandler are only run through once and no eexception is thrown within my code.

I know this is tricky, but do you maybe have an idea how I could avoid this? If I don´t find a solution then I won´t be able to implement this feature.

Regards,

Chris

 

Vladimir Stoyanov
Telerik team
commented on 23 Feb 2023, 09:15 AM

Thank you for the shared picture. 

I investigated the scenario some more and I have come up with an alternative approach that you can try. It involves inheriting the PivotGridPanel and replacing the instances in the RadPivotGrid ControlTemplate with your implementation. You can plug in the custom logic inside the MeasureOverride method and make sure to invoke the Initialize method of the RadPivotGrid after that via reflection. 

You can find the sample project attached updated with the above mentioned approach.

 

Chris
Top achievements
Rank 1
Iron
commented on 23 Feb 2023, 12:51 PM

Hi Vladimir!

Thanks a lot for the updated solution. I really appreciate the work youve put into this ticket generally. I implemented a variation of the changed logic in my customers project and it works now! No sporadic errors anymore :-) Thanks again for your help!

Regards,

Chris

0
Vladimir Stoyanov
Telerik team
answered on 13 Feb 2023, 03:00 PM

Hello Chris,

Thank you for the shared picture. 

I investigated the described scenario, however with the current implementation of the RadPivotGrid there isn't an option to hide the empty group. Generally speaking, the engine of the control generates groups for each value from the source data on the corresponding axis. The TotalFormat option provides a way to change the way the aggregate values are calculated, but it does remove any created groups.

With regards to the sub totals, can you check out the AutoShowSubTotals property of the group description to see, if it helps in your scenario?

As a side note, if you need faster resolution time I would strongly recommend you to contact the support team via your telerik.com account by opening a new support ticket. This way you will receive a reply within the 24h response timeframe. On the other hand there is no guarantee that a forum will be answered by the Telerik staff.

Regards,
Vladimir Stoyanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Chris
Top achievements
Rank 1
Iron
answered on 14 Feb 2023, 07:46 AM | edited on 14 Feb 2023, 08:00 AM

Hi Vladimir!

I wasn´t aware of the support tickets option - thanks for pointing that out :-)

I´ve attached a screenshot and an example program reproducting the error I stated. Could you please have a look at that?

Thanks in advance,

Chris

Chris
Top achievements
Rank 1
Iron
commented on 14 Feb 2023, 07:51 AM

Please ignore my answer here - it was meant for my other question: https://www.telerik.com/forums/using-percentdifferencefromprevious-function-within-a-calculatedaggregatedescription-based-on-a-calculated-field-has-unwanted-side-effects
0
Chris
Top achievements
Rank 1
Iron
answered on 14 Feb 2023, 08:00 AM | edited on 14 Feb 2023, 08:02 AM

Hi Vladimir,

the AutoShowSubTotals option is not the issue as I can turn that on and off any time in the row options. I mean the total columns - is there a possibility to exclude them?

Generally, could you point me to a direction of how I could manually disable specific generated columns? What (layers) do I need to be aware of? Which templates would need to be changed? Maybe I could collapse columns via Visibility and a converter?

Regards,

Chris

Tags
PivotGrid
Asked by
Chris
Top achievements
Rank 1
Iron
Answers by
Vladimir Stoyanov
Telerik team
Chris
Top achievements
Rank 1
Iron
Share this question
or