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 ,
Can you anyone let me know how to build selectionId in table visual or direct me to its Source code.
Solved! Go to Solution.
@v-viig Hi Ignat,
I already shared you my complete source code to your messages can you please check that and give me reply.
Hello @chotu27
Code has been updated. Please take a llok at the private message.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Please use this code as an example and current workaround:
getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity: DataViewScopeIdentity) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[0], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); }); }
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hi Ignat
I tried to create selection id's with the workaround that you have sent. But its not working. The code just breaks at
return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); });
statement giving no errors. I do not know how createSelectionIdBuilder is working. Please help
Hello @chotu27
Can you share source code? It that possible?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hi @v-viig
I can share you apart of it.
Here is the source code
Everything else seems to be working fine. It is only at that line where i am trying to create selection id's is what's not working.
//function for dataModelling public visualTransform(options: VisualUpdateOptions, host: IVisualHost):TableBarViewModel { let iValueFormatterPercent = ValueFormatter.create({ format: "0 %;-0%;0%" }); var dataViews =this.dataView = options.dataViews[0]; let tableSelectionId: ISelectionId[] = this.getSelectionIds(dataViews,host); //selection id function public getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity: DataViewScopeIdentity) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[0], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); }) }; capabilities.json "dataRoles": [ { "displayName": "Values", "name": "values", "kind": "GroupingOrMeasure" } ], "dataViewMappings": [ { "conditions": [ { "values": { "min": 1, "max": 25 } } ], "table": { "rows": { "select": [{"for": { "in": "values" }}] } } } ],
This code works well for me.
Are you sure that another part of the code works properly?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
@v-viig Hi Ignat,
I already shared you my complete source code to your messages can you please check that and give me reply.
Hello @chotu27
Code has been updated. Please take a llok at the private message.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hello,
Could you please share with me your code?
Hello,
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
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.
User | Count |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
22 | |
2 | |
2 | |
2 | |
2 |