Help with "DataPivotHierarchy setSummarizeBy: The argument is invalid or missing or has an incorrect format." error

Felipe Leefu Huang Lin 0 Reputation points
2024-07-11T05:26:39.35+00:00

I have an excel script which used to run with no problems. Suddenly I'am getting an error when trying to set a column to summarise by average in a pivot table. I get the following error:

DataPivotHierarchy setSummarizeBy: The argument is invalid or missing or has an incorrect format.

when running the following snippet:

	netAppPivotTable.addDataHierarchy(netAppPivotTable.getHierarchy("Count of Usable Capacity (PB)"));
	let field = netAppPivotTable.getDataHierarchy("Count of Usable Capacity (PB)");
	field.setPosition(0);
	console.log(field);
	field.setSummarizeBy(ExcelScript.AggregationFunction.sum);

Even though I' am calling with a valid DataPivotHierarchy object:

{
    "type": "DataPivotHierarchy",
    "instance": {
        "m_contextBase": {
            "m_nextId": 397,
            "m_customRequestHeaders": {},
            "m_batchMode": 0,
            "_onRunFinishedNotifiers": [],
            "m_requestUrlAndHeaderInfoResolver": {
                "_resolveRequestUrlAndHeaderInfo": "function () {\r\n                            return OfficeExtension.Utility._createPromiseFromResult(null);\r\n                        }",
                "_createRequestExecutorOrNull": "function () {\r\n        if (!WorkerRequestExecutor.globalWorkerRequestExecutor) {\r\n            WorkerRequestExecutor.globalWorkerRequestExecutor =\r\n                new WorkerRequestExecutor();\r\n        }\r\n        return WorkerRequestExecutor.globalWorkerRequestExecutor;\r\n    }"
            },
            "_processingResult": false,
            "_customData": "IterativeExecutor",
            "sync": "function () { [native code] }",
            "m_workbook": {
                "m_contextBase": "<CIRCULAR REFERENCE OBJECT>",
                "m_objectPath": {
                    "m_objectPathInfo": {
                        "Id": 1,
                        "ObjectPathType": 1,
                        "Name": ""
                    },
                    "m_parentObjectPath": null,
                    "m_isCollection": false,
                    "m_isInvalidAfterRequest": false,
                    "m_isValid": true,
                    "m_operationType": 1,
                    "m_flags": 4
                },
                "m_context": "<CIRCULAR REFERENCE OBJECT>",
                "m_worksheets": {
                    "m_contextBase": "<CIRCULAR REFERENCE OBJECT>",
                    "m_objectPath": {
                        "m_objectPathInfo": {
                            "Id": 4,
                            "ObjectPathType": 4,
                            "Name": "Worksheets",
                            "ParentObjectPathId": 1
                        },
                        "m_parentObjectPath": {
                            "m_objectPathInfo": {
                                "Id": 1,
                                "ObjectPathType": 1,
                                "Name": ""
                            },
                            "m_parentObjectPath": null,
                            "m_isCollection": false,
                            "m_isInvalidAfterRequest": false,
                            "m_isValid": true,
                            "m_operationType": 1,
                            "m_flags": 4
                        },
                        "m_isCollection": true,
                        "m_isInvalidAfterRequest": false,
                        "m_isValid": true,
                        "m_operationType": 1,
                        "m_flags": 4
                    },
                    "m_context": "<CIRCULAR REFERENCE OBJECT>",
                    "m_isNull": false
                },
     

Can anyone please provide some guidance?

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,447 questions
Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,668 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,694 questions
0 comments No comments
{count} votes