cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Balogh1Bence
Frequent Visitor

using array of selectionIDs in tooptipService.show

Is it possible to give an array of selectinID-s in the identities property of the object passed to the toolTipService.show?

1 ACCEPTED SOLUTION
dm-p
Super User I
Super User I

Hi @Balogh1Bence

This show() method just supports a single selection ID, as report page tooltips work off a single selection ID that contains the necessary measures and/or columns + values) to trigger it.

If you need multiple values for a category, for example, you can chain .withCategory() for all applicable data view indicies when generating the selection ID.

Let's say you want to generate an ID for elements 0, 10, and 32 from your category column's values array (numbers are aribtrary).

Crude pseudocode (assuming you already have the column stored as a variable) would be something like:

const builder = host.createSelectionIdBuilder();
const selectionId = builder
    .withCategory(categoryColumn, 0)
    .withCategory(categoryColumn, 10)
    .withCategory(categoryColumn, 32)
    .createSelectionId();

This can then be passed to your tooltip's show() method to ensure that all three values are selected.

You can chain the .with* methods as many times a you need (including measures and matrix/table nodes, depending on how your data view mapping is set up).

You're also able to work this approach into an iterator, so if you have an array of selected values and their indices, you would declare the builder outside the loop, so it's appropriately scoped and then you can incrementally call the .with* method in the iterator on each pass. This will append the ID onto the outer-scoped builder.

Once complete, you can call .createSelectionId() on your builder variable to get an accumulated selection ID with multiple points that you can pass to a tooltip.

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

5 REPLIES 5
dm-p
Super User I
Super User I

Hi @Balogh1Bence

This show() method just supports a single selection ID, as report page tooltips work off a single selection ID that contains the necessary measures and/or columns + values) to trigger it.

If you need multiple values for a category, for example, you can chain .withCategory() for all applicable data view indicies when generating the selection ID.

Let's say you want to generate an ID for elements 0, 10, and 32 from your category column's values array (numbers are aribtrary).

Crude pseudocode (assuming you already have the column stored as a variable) would be something like:

const builder = host.createSelectionIdBuilder();
const selectionId = builder
    .withCategory(categoryColumn, 0)
    .withCategory(categoryColumn, 10)
    .withCategory(categoryColumn, 32)
    .createSelectionId();

This can then be passed to your tooltip's show() method to ensure that all three values are selected.

You can chain the .with* methods as many times a you need (including measures and matrix/table nodes, depending on how your data view mapping is set up).

You're also able to work this approach into an iterator, so if you have an array of selected values and their indices, you would declare the builder outside the loop, so it's appropriately scoped and then you can incrementally call the .with* method in the iterator on each pass. This will append the ID onto the outer-scoped builder.

Once complete, you can call .createSelectionId() on your builder variable to get an accumulated selection ID with multiple points that you can pass to a tooltip.

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

thank you, it works well. Do you know if there is a way to create a selectionID for a measure? Iam using a matrix dataView

Yes - use .withMeasure() and pass the queryName property from the relevant MetadataColumn.





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)




The sympton is that I can see all the measures on the tooltip report

somehow it does not work. This is the selectionID created with the queryname. 
Balogh1Bence_0-1623405349729.png

And thats how I create it:

Balogh1Bence_1-1623405584648.png

 

 

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors