Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

BackendApi ApplyPatches for dimensions reorder

Hello,

I'm writing my own custom extension and I'd like to implement similar functionality to one present in native Pivot Table Extension which allows to change order of selected dimensions by dragging buttons, without entering edit mode. Since change which is done in Pivot Table is not permanent I assume that ApplyPatches method is used there with qSoftPatch flag set to true.

In my own extension so far I was not able to change the order of dimensions, because I receive error 'Patch value not on valid JSON format.'

My approach was to take one of the dimensions from Layout's qDimensionInfo, stringify it and apply it under different index like this:

self.backendApi.applyPatches([

  { qPath: '/qHyperCube/qDimensionInfo/0', qOp: 'replace', qValue: JSON.stringify(layout.qHyperCube.qDimensionInfo[1]).split('"').join('\\"') },

  { qPath: '/qHyperCube/qDimensionInfo/1', qOp: 'replace', qValue: JSON.stringify(layout.qHyperCube.qDimensionInfo[0]).split('"').join('\\"') },

  ], true);

Is this approach valid? If yes why am I receiving format errors?

0 Replies