Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi, this.host.createSelectionIdBuilder() service is not working properly anymore for me, did something change with they key, it looks different now. Now there is somekind of identityIndex in it.
key: used to be something like this ->
Key:"{\"data\":[\"{\\\"and\\\":{\\\"l\\\":{\\\"comp\\\":{\\\"k\\\":0,\\\"l\\\":{\\\"col\\\":{\\\"s\\\":{\\\"e\\\":\\\"qtEmergencyRecords\\\"},\\\"r\\\":\\\"Year\\\"}},\\\"r\\\":{\\\"const\\\":{\\\"t\\\":4,\\\"v\\\":2017}}}},\\\"r\\\":{\\\"comp\\\":{\\\"k\\\":0,\\\"l\\\":{\\\"col\\\":{\\\"s\\\":{\\\"e\\\":\\\"qtFacility\\\"},\\\"r\\\":\\\"Facility County\\\"}},\\\"r\\\":{\\\"const\\\":{\\\"t\\\":1,\\\"v\\\":\\\"Alachua\\\"}}}}}}\"]}
Any idea ?
Solved! Go to Solution.
It looks good to me.
What API version are you using? API 2.3.0?
If so, I suggest downgrading API version to API 2.2.0 just to make sure it is not related to API.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Ok found something very strange, when debuggin identity object looks like this
DataView looks like this
I am confused 🙂
It's expected change that was made as a part of performance optimization for Custom Visuals API 2.x.x.
How are you generating a SelectionId?
I'm asking because the key property is not required to generate a SelectionId.
One possible break is with table and matrix mappings. You can have a look at this code sample to modify your code accordingly if you use table or matrix mappings.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hi, thanks for replaying
This is how i create SelectionId ->
I am using categorical mapping
It looks good to me.
What API version are you using? API 2.3.0?
If so, I suggest downgrading API version to API 2.2.0 just to make sure it is not related to API.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hello,
Could you please share with me your code?
Hello,
Could you please clarify what code do you mean?
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
I use for create SelectionIds
private getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity, idx) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[0], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, idx) .createSelectionId(); }); }
For click:
Microsoft.Maps.Events.addHandler(node, 'click', function (e: Microsoft.Maps.IMouseEventArgs) { console.log('marker identity is ', sensorData.selectionId); debugger; this.selectionManager.select(sensorData.selectionId, false).then((ids: ISelectionId[]) =>{ console.log(ids); }).catch(e => console.error(e)); });
I see that in selectionManager add/remove selectedIds.
But data from the dashboard are not filtered. Nothing happens.
I use API 2.2.0.
what I do wrong?
Hi,
Please check this and this pages.
Also you can look at the Sample Bar Chart code.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
There aren't examples with the table. I try to use above the recommendation from this task.
But selectionManager doesn't select data. I try to use
this.selectionManager
or
let selectionManager = this.selectionManager;
Microsoft.Maps.Events.addHandler(node, 'click', function (e: Microsoft.Maps.IMouseEventArgs) { console.log('marker identity is ', sensorData.selectionId); debugger; selectionManager.select(sensorData.selectionId, false).then((ids: ISelectionId[]) =>{ console.log(ids); }).catch(e => console.error(e)); });
Nothing helps.
There are two unclear moments:
1. Does your click event happen at all?
2. You mentioned dashboard, but selection will be aplied for report page data only. I meant that you cannot filter one report by filters from other report as I know.
Please clarify these moments.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Well,
I see that selection for table requires some hack.
Hopefully, a new API 2.5 which will be released next week contains .withTable method of the builder that must solve selection issues with Table mapping.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Ok, thanks
How to add selectionId to table?
Also, how correct to use ISelectionManager?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.