Forum Discussion

paul-maessen's avatar
paul-maessen
Resolver I
5 years ago
Solved

Creating SelectionIds when you have two categories in your DataViewMapping

Hi,   I do have a question about the creation of SelectionIds when your DataViewMapping has 2 categories.   The dataRoles and dataViewMapping:     { "dataRoles": [ { "...
  • dm-p's avatar
    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