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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mikihiir
Helper III
Helper III

Did something change with SelectionId, the key looks different now

Laheasi.png

 

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 ?

 

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

View solution in original post

13 REPLIES 13
mikihiir
Helper III
Helper III

Ok found something very strange, when debuggin identity object looks like this 

image.png

DataView looks like this 

I am confused 🙂image.png

v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

Hi, thanks for replaying

 

This is how i create SelectionId ->

image.png

 

I am using categorical mapping 

v-viig
Community Champion
Community Champion

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

pbicvsupport@microsoft.com

Anonymous
Not applicable

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

Anonymous
Not applicable

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

Anonymous
Not applicable

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

Anonymous
Not applicable

Ok,  thanks

Anonymous
Not applicable

How to add selectionId to table?

Also, how correct to use ISelectionManager?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors