hi community
I have 2 selectionId,
1. select the city with value "Malang"
2. select the month with value "3"
this is the my code
let list : ISelectionId[] = []; list.push(this.model.dataPoints[0].selectionId); // city == Malang list.push(this.model.dataPoints[index].selectionId); // month == 3 // console.log('sebelum', this.model.dataPoints[index].selectionId); // let includes = this.model.dataPoints[index].selectionId.includes(this.model.dataPoints[0].selectionId); // console.log('includes', includes); // console.log('hasil includes', this.model.dataPoints[index].selectionId); // ISQExpr.and selectionManager.select(list, true).then((ids: ISelectionId[]) => { console.log('hasilnya', ids); });
but the result are "select all city with month == 3 or city == Malang"
how to make multiple selectionId with and operator?
the expected result only show month == 3 && city == Malang
Solved! Go to Solution.
Hi @Anonymous,
I can't tell from your snippet how your selectionIds are generated, I believe you'll need to apply both columns to your ISelectionIdBuilder in order to generate one that intersects both categoricial values.
Not sure if you've previously referred to this page, but it covers how you might chain the createSelectionId method with multiple values (for instance, .withCategory() and .withSeries()).
If you're not having much luck with this, perhaps you can share your capabilities.json and your view model mapping code? We can have a look and see if we can get a little further with it for you.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @Anonymous,
I can't tell from your snippet how your selectionIds are generated, I believe you'll need to apply both columns to your ISelectionIdBuilder in order to generate one that intersects both categoricial values.
Not sure if you've previously referred to this page, but it covers how you might chain the createSelectionId method with multiple values (for instance, .withCategory() and .withSeries()).
If you're not having much luck with this, perhaps you can share your capabilities.json and your view model mapping code? We can have a look and see if we can get a little further with it for you.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
hi @dm-p
I'm already solve this, the key is not how the manager to select but how the builder to create selectionId, right as your comment.
the hard way with matrix are how to create selectionId with row parents and columns parent.
this is my function with recursive children
if (x.values) { let keys = Object.keys(x.values); keys.forEach(k => { let keyNum = Number(k); let builder = host.createSelectionIdBuilder(); copyParents.forEach(p => { builder.withMatrixNode(p, matrix.rows.levels); }); let colRef = columnsRef[keyNum]; colRef.nodes.forEach(p => { builder.withMatrixNode(p, matrix.columns.levels); }); let _td: DataListSelection = { value: x.values[k], selectionId: builder.createSelectionId(), } listSelectionPerRow.push(_td); }); }