Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Adding interactivity into custom visual using table dataviewmapping

I'm working on adding interactivity into my custom visual. And I'm trying the code from https://docs.microsoft.com/en-us/power-bi/developer/visuals/selection-api#select-datapoints-to-slice...

However, I don't understand what is "rowDiv". Can someone explain this?

feiyiding_0-1631709235702.png

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

I've never looked at this particular section of the selection ID doc in great detail, but the sample code is certainly not going to work completely as-is and this is very unfortunate, as selection handling is one of the more tricky bits to get right.

rowDiv is not scoped anywhere, so this line of code is not valid in context. I would expect rowDiv to be declared and assigned above that line, as presumably it will be different for each iteration of the forEach loop and appends the correct data.

As it is an incomplete fragment of code, I couldn't presume to know how to make it work fully and the only useful part of that code snippet is that bit that shows the difference on how to create the selection ID using .withTable() vs. the other data view mappings. The selection ID is not assigned to any event listener or persisted elsewhere either, so this potentially causes further confusion.

If you're looking for some assistance, it might be better if you can share your code, or the section that works with your data view and we can see if we can help adapt this for you.

If you're not able to share, or it is impractical, the example for the categorical mapping in the doc page is a bit more complete and could be adapted, with considerations for the slightly different structure of the table data view mapping and how to use .withTable() rather than .withCategory() / .withSeries() / .withMeasure().

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

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)




View solution in original post

3 REPLIES 3
dm-p
Super User
Super User

I've never looked at this particular section of the selection ID doc in great detail, but the sample code is certainly not going to work completely as-is and this is very unfortunate, as selection handling is one of the more tricky bits to get right.

rowDiv is not scoped anywhere, so this line of code is not valid in context. I would expect rowDiv to be declared and assigned above that line, as presumably it will be different for each iteration of the forEach loop and appends the correct data.

As it is an incomplete fragment of code, I couldn't presume to know how to make it work fully and the only useful part of that code snippet is that bit that shows the difference on how to create the selection ID using .withTable() vs. the other data view mappings. The selection ID is not assigned to any event listener or persisted elsewhere either, so this potentially causes further confusion.

If you're looking for some assistance, it might be better if you can share your code, or the section that works with your data view and we can see if we can help adapt this for you.

If you're not able to share, or it is impractical, the example for the categorical mapping in the doc page is a bit more complete and could be adapted, with considerations for the slightly different structure of the table data view mapping and how to use .withTable() rather than .withCategory() / .withSeries() / .withMeasure().

Regards,

Daniel





Did I answer your question? Mark my post as a solution!

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)




Anonymous
Not applicable

Thank you for the reply. I have figured it out.

Hello, is it possible for you to share the source code because I am struggling with the same thing?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.