Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
dselgo_eidex
Partner - Creator III
Partner - Creator III

setOptions not working for pivot table

Hello, I am having a problem using the Visualization APIs setOptions method for my pivot table. Each time I try, I get the following error message: 

error{code: 8, parameter: "Patch value not on valid JSON format.", message: "Invalid parameters"}

In a nutshell, here is what I am trying to do. I want to be able to change the pivot table's properties based on user input. Specifically, I want to change one of the dimensions to a completely different field. I am using qdtComponents to handle the chart's creation and to call setOptions. I think it is important to note that when setOptions is called, the entire properties object is passed as a parameter, so it is effectively patching every property.

I understand that setOptions is essentially a wrapper for applyPatches, and that the specific error I am receiving is from the applyPatches method.

The weird thing is, I am able to successfully accomplish the desired behavior on other chart types. For testing, I made a line chart and a bar chart with the same measures and there is no problem. When setOptions is called, the chart updates with the correct dimension. The error is only happening for the pivot table.

Below is the stringified applyPatches call:

{
  "delta": true,
  "handle": 8,
  "method": "ApplyPatches",
  "params": [
    [
      {
        "qPath": "/qInfo/qId",
        "qOp": "add",
        "qValue": "null"
      },
      {
        "qPath": "/qInfo/qType",
        "qOp": "add",
        "qValue": "\"pivot-table\""
      },
      {
        "qPath": "/qExtendsId",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qStateName",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qStateName",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qDimensions",
        "qOp": "add",
        "qValue": "[{\"qLibraryId\":\"\",\"qDef\":{\"qGrouping\":\"N\",\"qFieldDefs\":[\"STUDENT.YEAR\"],\"qFieldLabels\":[\"Year\"],\"qSortCriterias\":[{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":1,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0}],\"qNumberPresentations\":[],\"qReverseSort\":false,\"qActiveField\":0,\"qLabelExpression\":\"\",\"autoSort\":false,\"cId\":\"bMyJmm\",\"othersLabel\":\"Others\"},\"qNullSuppression\":true,\"qIncludeElemValue\":false,\"qOtherTotalSpec\":{\"qOtherMode\":\"OTHER_OFF\",\"qOtherCounted\":{\"qv\":\"10\"},\"qOtherLimit\":{\"qv\":\"0\"},\"qOtherLimitMode\":\"OTHER_GE_LIMIT\",\"qSuppressOther\":false,\"qForceBadValueKeeping\":true,\"qApplyEvenWhenPossiblyWrongResult\":true,\"qGlobalOtherGrouping\":false,\"qOtherCollapseInnerDimensions\":false,\"qOtherSortMode\":\"OTHER_SORT_DESCENDING\",\"qTotalMode\":\"TOTAL_OFF\",\"qReferencedExpression\":{\"qv\":\"\"}},\"qShowTotal\":false,\"qShowAll\":false,\"qOtherLabel\":{\"qv\":\"Others\"},\"qTotalLabel\":{\"qv\":\"Totals\"},\"qCalcCond\":{\"qv\":\"\"},\"qAttributeExpressions\":[],\"qAttributeDimensions\":[],\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qGrouping\":\"N\",\"qFieldDefs\":[\"STUDENT.BUILDING_NAME\"],\"qFieldLabels\":[\"Building\"],\"qSortCriterias\":[{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":1,\"qSortByAscii\":1,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0}],\"qNumberPresentations\":[],\"qReverseSort\":false,\"qActiveField\":0,\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"cFRFyMf\",\"othersLabel\":\"Others\"},\"qNullSuppression\":true,\"qIncludeElemValue\":false,\"qOtherTotalSpec\":{\"qOtherMode\":\"OTHER_OFF\",\"qOtherCounted\":{\"qv\":\"10\"},\"qOtherLimit\":{\"qv\":\"0\"},\"qOtherLimitMode\":\"OTHER_GE_LIMIT\",\"qSuppressOther\":false,\"qForceBadValueKeeping\":true,\"qApplyEvenWhenPossiblyWrongResult\":true,\"qGlobalOtherGrouping\":false,\"qOtherCollapseInnerDimensions\":false,\"qOtherSortMode\":\"OTHER_SORT_DESCENDING\",\"qTotalMode\":\"TOTAL_OFF\",\"qReferencedExpression\":{\"qv\":\"\"}},\"qShowTotal\":false,\"qShowAll\":false,\"qOtherLabel\":{\"qv\":\"Others\"},\"qTotalLabel\":{\"qv\":\"Totals\"},\"qCalcCond\":{\"qv\":\"\"},\"qAttributeExpressions\":[],\"qAttributeDimensions\":[],\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}}]"
      },
      {
        "qPath": "/qHyperCubeDef/qMeasures",
        "qOp": "add",
        "qValue": "[{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Met\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL_MET_FLAG = {1}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL_MET_FLAG -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"LUFKvh\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false,\"id\":\"cellBackgroundColor\"},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false,\"id\":\"cellForegroundColor\"}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Not Met\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL_MET_FLAG = {0}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL_MET_FLAG -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"TdWtBs\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Not Proficient\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL = {2}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"jrgwPN\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Partially Proficient\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL = {3}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"nfRShs\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Proficient\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL = {4}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"AjvzmM\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}},{\"qLibraryId\":\"\",\"qDef\":{\"qLabel\":\"Advanced\",\"qDescription\":\"\",\"qTags\":[],\"qGrouping\":\"N\",\"qDef\":\"\\n                                        =count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL = {5}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        ) / \\n                                        count({$<\\n                                            ASSESSMENT_LINK.TEST_NAME = {'MSTEP'},\\n                                            ASSESSMENT_RESULTS.PERFORMANCE_LEVEL -= {''}\\n                                            >} DISTINCT ASSESSMENT_RESULT_YEAR_HKEY\\n                                        )\\n                                    \",\"qNumFormat\":{\"qType\":\"F\",\"qnDec\":2,\"qUseThou\":0,\"qFmt\":\"0.0%\",\"qDec\":\".\",\"qThou\":\",\"},\"qRelative\":false,\"qBrutalSum\":false,\"qAggrFunc\":\"\",\"qAccumulate\":0,\"qReverseSort\":false,\"qActiveExpression\":0,\"qExpressions\":[],\"qLabelExpression\":\"\",\"autoSort\":true,\"cId\":\"fkXEQK\",\"numFormatFromTemplate\":true,\"isCustomFormatted\":false},\"qSortBy\":{\"qSortByState\":0,\"qSortByFrequency\":0,\"qSortByNumeric\":-1,\"qSortByAscii\":0,\"qSortByLoadOrder\":1,\"qSortByExpression\":0,\"qExpression\":{\"qv\":\"\"},\"qSortByGreyness\":0},\"qAttributeExpressions\":[{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false},{\"qExpression\":\"\",\"qLibraryId\":\"\",\"qAttribute\":false}],\"qAttributeDimensions\":[],\"qCalcCond\":{\"qv\":\"\"},\"qCalcCondition\":{\"qCond\":{\"qv\":\"\"},\"qMsg\":{\"qv\":\"\"}}}]"
      },
      {
        "qPath": "/qHyperCubeDef/qInterColumnSortOrder",
        "qOp": "add",
        "qValue": "[0,1,-1]"
      },
      {
        "qPath": "/qHyperCubeDef/qSuppressZero",
        "qOp": "add",
        "qValue": "true"
      },
      {
        "qPath": "/qHyperCubeDef/qSuppressMissing",
        "qOp": "add",
        "qValue": "true"
      },
      {
        "qPath": "/qHyperCubeDef/qInitialDataFetch",
        "qOp": "add",
        "qValue": "[{\"qLeft\":0,\"qTop\":0,\"qWidth\":50,\"qHeight\":50}]"
      },
      {
        "qPath": "/qHyperCubeDef/qReductionMode",
        "qOp": "add",
        "qValue": "\"N\""
      },
      {
        "qPath": "/qHyperCubeDef/qMode",
        "qOp": "add",
        "qValue": "\"P\""
      },
      {
        "qPath": "/qHyperCubeDef/qPseudoDimPos",
        "qOp": "add",
        "qValue": "-1"
      },
      {
        "qPath": "/qHyperCubeDef/qNoOfLeftDims",
        "qOp": "add",
        "qValue": "2"
      },
      {
        "qPath": "/qHyperCubeDef/qAlwaysFullyExpanded",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qMaxStackedCells",
        "qOp": "add",
        "qValue": "5000"
      },
      {
        "qPath": "/qHyperCubeDef/qPopulateMissing",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qShowTotalsAbove",
        "qOp": "add",
        "qValue": "true"
      },
      {
        "qPath": "/qHyperCubeDef/qIndentMode",
        "qOp": "add",
        "qValue": "true"
      },
      {
        "qPath": "/qHyperCubeDef/qCalcCond/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qSortbyYValue",
        "qOp": "add",
        "qValue": "0"
      },
      {
        "qPath": "/qHyperCubeDef/qTitle/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qCalcCondition/qCond/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qCalcCondition/qMsg/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qColumnOrder",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/columnWidths",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qStateName",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qDimensions",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qMeasures",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qInterColumnSortOrder",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qSuppressZero",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qSuppressMissing",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qInitialDataFetch",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qReductionMode",
        "qOp": "add",
        "qValue": "\"N\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qMode",
        "qOp": "add",
        "qValue": "\"S\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qPseudoDimPos",
        "qOp": "add",
        "qValue": "-1"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qNoOfLeftDims",
        "qOp": "add",
        "qValue": "-1"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qAlwaysFullyExpanded",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qMaxStackedCells",
        "qOp": "add",
        "qValue": "5000"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qPopulateMissing",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qShowTotalsAbove",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qIndentMode",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qCalcCond/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qSortbyYValue",
        "qOp": "add",
        "qValue": "0"
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qTitle/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qCalcCondition/qCond/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qCalcCondition/qMsg/qv",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qColumnOrder",
        "qOp": "add",
        "qValue": "[]"
      },
      {
        "qPath": "/showTitles",
        "qOp": "add",
        "qValue": "true"
      },
      {
        "qPath": "/title",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/subtitle",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/footnote",
        "qOp": "add",
        "qValue": "\"\""
      },
      {
        "qPath": "/showDetails",
        "qOp": "add",
        "qValue": "false"
      },
      {
        "qPath": "/visualization",
        "qOp": "add",
        "qValue": "\"pivot-table\""
      }
    ],
    true
  ],
  "id": 20,
  "jsonrpc": "2.0"
}

And this is the response:

{
  "jsonrpc": "2.0",
  "id": 20,
  "error": {
    "code": 8,
    "parameter": "Patch value not on valid JSON format.",
    "message": "Invalid parameters"
  }
}

Any help would be greatly appreciated Smiley Very Happy

Labels (4)
1 Solution

Accepted Solutions
ErikWetterberg

Well, then there is something else in your patch array that is wrong. Perhaps you should try just patching the stuff you actually wannt to change, like dimensions? Or at least skip the qLayoutExclude stuff, that's just a way for the client to save stuff when you convert visualizations.

View solution in original post

6 Replies
ErikWetterberg

Try removing the very first valde, /qInfo/qId. You shouldn’t patch the qId.

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

I tried it. Still receiving the same error.
ErikWetterberg

Well, then there is something else in your patch array that is wrong. Perhaps you should try just patching the stuff you actually wannt to change, like dimensions? Or at least skip the qLayoutExclude stuff, that's just a way for the client to save stuff when you convert visualizations.

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Got it! It looks like the qLayoutExclude was the problem. Once I removed that from the def it began working like a charm. The only reason that I had that in my chart properties was because it was what I got from the developer menu in the app.

 

Thank you so much Erik, I've been trying to figure this out for the past few days.

nitinsaivishnu1
Partner - Contributor II
Partner - Contributor II

@dselgo_eidex 

@ErikWetterberg 

Can you help me on how to replace the dimension/measure of a bar or pie chart using ApplyPatches or SetOptions API..

I used the following mashup from the  https://github.com/erikwett/QonnectionsMashup by @ErikWetterberg 

 but it was throwing me invalid parameters.

The existing dimension is City and i'd like to change it to Country.

Is my qValue correct?

I have the following code

 

var patches = [{
'qPath': '/qHyperCubeDef/qDimensionInfo/0',
'qOp': 'replace',
'qValue': \"Country\"
}];


vis.applyPatches( patches, false );

 

Any help would be appreciated.

ErikWetterberg

Please don't post new questions on old threads.