Forum Discussion
How to implement selections based on a categorical dataviewmapping with multiple fields
Hi djpirra,
In terms of selections with the categorical dataViewMapping, you can generate selectionIds for all values of 1 category x 1 grouping (series) x 1 measure. You would add a .withSeries() to your chain to include the grouping, similar to the worked example in the MS doc here.
I have also used this pattern in one of my visuals - this can be seen in how I map my view model here (and here's the dataViewMapping in the capabilities).
If you want to create a selectionId for a context of more categories than this, then you may need to use a table or matrix dataViewMapping (although if you wish to make use of highlighting in your visual, only categorical and matrix would be viable choices).
If you'd want to proceed with using the categorical approach, we should have a look at your code to see if it's possible to re-structure your capabilities or view model to see if we can make valid selectionIds work in this case.
Regards,
Daniel
Hi Daniel,
This is what I have tried and also below is the output of one of the generated / triggered selectionIDs on the current setup.
Scenario 1:
- Created selectionId based on measure and 4 entries in categories ( current scenario )
- Created an array of selectionIds based on measure and each of the categories ( since apparently the selectionManager can receive an array of selectionIds )
e {measures: Array(1), dataMap: {…}, key: "{"XXXX.Is Auto":[{"identityIndex":11}],"Custo…tityIndex":11}]}["KPIs.# Active Customers"]"}
measures: ["KPIs.# Active Customers"]
dataMap:
XXXX.Is Auto: Array(1)
0: {identityIndex: 11}
length: 1
__proto__: Array(0)
XXXX.Is Malls: Array(1)
0: {identityIndex: 11}
length: 1
__proto__: Array(0)
XXXX.Is Real Estate: Array(1)
0: {identityIndex: 11}
length: 1
__proto__: Array(0)
XXXX.Is Retail: Array(1)
0: {identityIndex: 11}
length: 1
__proto__: Array(0)
__proto__: Object
key: "{"XXXX.Is Auto":[{"identityIndex":11}],"XXXX.Is Malls":[{"identityIndex":11}],"XXXX.Is Real Estate":[{"identityIndex":11}],"XXXX.Is Retail":[{"identityIndex":11}]}["KPIs.# Active Customers"]"
__proto__: Object
- djpirra6 years ago
Helper III
Hey everyone.
Was able to make it work....Everything was ok with the code except that I had this option on my capabilities file:
"general": { "displayName": "General", "displayNameKey": "formattingGeneral", "properties": { "filter": { "type": { "filter": true } } } },Apparently this disables the normal behavior.
Thank you!