Change calculated field programmatically

Is there anyway to change the calculation for a calculated field programmatically?   I have a drop down list with a list of values.   1, 2, 3 4.  On selecting one of those values I would like to change the calculated field and for the pivot table to update:

        switch(i)

        {

            case 1:

                calcTotalPrice = "\"" + "Sum(Hours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";

                break;

            case 2:

                calcTotalPrice = "\"" + "Sum(SHours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";

                break;

            case 3:

                calcTotalPrice = "\"" + "Sum(DHours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";

                break;

            case 4:

                calcTotalPrice = "\"" + "Sum(THours)" + "\"" + "/" + "\"" + "Sum(Count)" + "\"";

                break;

        }

I've tried doing StateHasChanged but that doesn't affect it.  


3 Replies

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team March 17, 2022 04:27 PM UTC

Hi Jason,


Currently, we are analyzing this query at our end, and we will update further details within two business days (March 21, 2022).


Regards,

Angelin Faith Sheeba.



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team March 21, 2022 05:18 PM UTC

Hi Jason,


You can use an external dropdown list to dynamically change the calculation(formula) for a calculated field. However, we are currently having a problem on dynamically changing calculations, which have now been resolved. This issue fix will also be included in our 2022, Volume 1 SP release which is estimated to be rolled out in the mid of April 2022.


Regards,

Angelin Faith Sheeba.



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team May 16, 2022 06:25 AM UTC

Hi Jason,


We are glad to announce that our Essential Studio 2022 Volume 1 SP Release V20.1.0.55 is rolled out and fix for the reported issue has been included in this release. Please refer to the following sample.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotTable1689681272


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Angelin Faith Sheeba


Loader.
Up arrow icon