Forum Discussion
Creating SelectionIds when you have two categories in your DataViewMapping
- 5 years ago
Hi paul-maessen,
Yes, I believe so. It should be fairly easy to tell from the resulting SelectionId if it has both categories and indices in the resulting map though, if you wanted to try it out.
The only thing I might do differently (and this is more of a personal preference and has no net effect on your code) is swap the for with a forEach and a fat arrow function, e.g.:
categories[0].values.forEach((v, vi) => { const categorySelectionId = this.host.createSelectionIdBuilder() .withCategory(categories[0], vi) .withCategory(categories[1], vi) .createSelectionId(); });Cheers,
Daniel
Hi paul-maessen,
Yes, I believe so. It should be fairly easy to tell from the resulting SelectionId if it has both categories and indices in the resulting map though, if you wanted to try it out.
The only thing I might do differently (and this is more of a personal preference and has no net effect on your code) is swap the for with a forEach and a fat arrow function, e.g.:
categories[0].values.forEach((v, vi) => {
const categorySelectionId = this.host.createSelectionIdBuilder()
.withCategory(categories[0], vi)
.withCategory(categories[1], vi)
.createSelectionId();
});
Cheers,
Daniel
Hi dm-p
Thanks for the answer and the confirmation.
I normally also would use a forEach, but this code I copied from the documentation from Microsoft and modified it 🙂
Regards
Paul