We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PivotTable Invalid calculated field name-it could not be same as the previous field name

Hello,


I am adding 9 pivot tables to an existing spreadsheet. I am trying to add a calculated field to all 9 of the pivot tables, and occasionally I receive the following error:

Invalid calculated field name,it could not be same as the previous field name.

I have given the pivot tables different names (i.e. PivotTable1, PivotTable2, etc.) but the name of my calculated field is the same in all 9 of the pivot tables. Do you have any thoughts on why this could happen?

Thank you!

–Eric

Hi,


Thanks for sharing the error description with details.

I am afraid, we got to evaluate your issue with your sample code and resource files. Please provide us a sample console application (runnable), you may zip the project prior attaching here to reproduce the issue on our end, we will check it soon.

Thank you.

Ok thank you, I’ll continue to debug. The app is rather large and would be much too time consuming to recreate for you.


Maybe you can answer this, when creating new pivot tables, do you recommend that I instantiate a new Aspose.Cells.Pivot.PivotTable for each new pivot table?

For example, should it be necessary to do this:

Aspose.Cells.Pivot.PivotTable pivotTable1

Aspose.Cells.Pivot.PivotTable pivotTable2

Aspose.Cells.Pivot.PivotTable pivotTable3


I think I found the issue, but I’m not sure why it’s happening. Here is some sample code.


If I run this:

detailWorksheet = workbook.Worksheets[“GL Audit History Detail”];

worksheet = workbook.Worksheets.Add(“GL Audit History Summary”);

pivotTables = worksheet.PivotTables;

pivotTableIndex = pivotTables.Add(string.Format("‘GL Audit History Detail’!A1:{0}", CellsHelper.CellIndexToName(detailWorksheet.Cells.MaxDataRow, 30)), “A1”, “PivotTable3”);

pivotTable = pivotTables[pivotTableIndex];

pivotTable.AddCalculatedField(“ChangeInExp”, “=Field1/Field2”);


And then run this code right after:

detailWorksheet = workbook.Worksheets[“GL Audit History Detail”];

worksheet = workbook.Worksheets.Add(“GL Audit History Totals”);

pivotTables = worksheet.PivotTables;

pivotTableIndex = pivotTables.Add(string.Format("‘GL Audit History Detail’!A1:{0}", CellsHelper.CellIndexToName(detailWorksheet.Cells.MaxDataRow, 30)), “A1”, “PivotTable4”);

pivotTable = pivotTables[pivotTableIndex];

pivotTable.AddCalculatedField(“ChangeInExp”, “=Field1/Field2”);


It appears that by calling the pivotTables.Add with the exact same Cell Range, the CalculatedField is being brought over to the 2nd Worksheet’s pivot table for some reason.

If I change the range in the 2nd pivotTable.Add to use column 31, the CalculatedField is not brought over, which is the expected behavior.

I am currently using Aspose.Cells v17.1.0 (we are in the process of upgrading our license). Do you happen to know if the above behavior has been fixed in a recent release?

Hi,


Thanks for the code segments and further details.

Well, we did include some enhancements for rendering and manipulating PivotTables modules in recent releases, so it would be good if you could give it a try to our latest version/fix (e.g v17.4.x) to check if it makes any difference. I am afraid, it is a bit hard to evaluate your issue precisely without your resource file(s) with data and complete sample code. So, we appreciate if you could create a sample console application (runnable), you may zip the project prior attaching here to reproduce the issue on our end, we will check it soon.

Thank you.

Ok, I tried using the latest v17.4.0 but it still is generating the error.


I was able to quickly put together a runnable console app for you and have attached it for your review. I have also placed a comment on line 300 of PivotTableSample.cs where the code is generating the error.

Please let me know if you can help me with fixing this issue.

Thank you!!

Hi,


Thanks for the sample project with template file.

After an initial test, I was able to observe the issue as you mentioned by using your sample project with your template file. I found an exception: “Invalid calculated field name,it could not be same as the previous field name” when adding calculated field to PivotTable on the specified line of code in your project. It looks to me a bug but we have to sort it out first. I have logged a ticket with an id “CELLSNET-45313” for your issue.

We will look into your issue soon.

Once we have an update on it, we will let you know here.

Thank you.

Great, thank you Amjad! Looking forward to hearing back from you with a fix.

Hi Amjat,


I was wondering if you had any type of ETA on when this issue is scheduled to be looked at?

Thank you!

–Eric

Hi,


Thanks for your posting and using Aspose.Cells.

We are working over your issue and we are hopeful, your issue will be fixed before May 24, 2017.
Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix

Aspose.Cells for .NET v17.4.6 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.4.6 (.NET 4.0) compiled in .NET Framework 4.0.

and let us know your feedback.

Hi Shakeel,


My code is now working, thank you very much!!

Can you tell me when the next official version of Aspose.Cells is scheduled for release, and if this fix will be included?

Also, is this DLL stable for production use or should I wait for the official release?

Thank you,

–Eric

Hi,


Good to know that your issue is sorted out by the latest fix/version.

Well, you may use the fix for production server, it contains all the functionality (full-fledged) of previous release i.e., Aspose.Cells for .NET v17.4.0 till this fix. We publish hotfixes in the forums, so our users don’t have to wait for too long. However, our next official release is on the card, we might publish the release (v17.5.0) before the end of this week or in the next week.

Thank you.

The issues you have found earlier (filed as CELLSNET-45313) have been fixed in Aspose.Cells for .NET 17.5.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.