cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikihiir Member
Member

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

Accepted Solutions
Moderator v-viig
Moderator

Re: Did something change with SelectionId, the key looks different now

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

13 REPLIES 13
mikihiir Member
Member

Re: Did something change with SelectionId, the key looks different now

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

image.png

DataView looks like this 

I am confused Smiley Happyimage.png

Moderator v-viig
Moderator

Re: Did something change with SelectionId, the key looks different now

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

Highlighted
mikihiir Member
Member

Re: Did something change with SelectionId, the key looks different now

Hi, thanks for replaying

 

This is how i create SelectionId ->

image.png

 

I am using categorical mapping 

Moderator v-viig
Moderator

Re: Did something change with SelectionId, the key looks different now

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

ovdenysiuk Regular Visitor
Regular Visitor

Re: Did something change with SelectionId, the key looks different now

Hello,

Could you please share with me your code?

v-evelk Established Member
Established Member

Re: Did something change with SelectionId, the key looks different now

Hello,

 

Could you please clarify what code do you mean?

 

Kind Regards,

 

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com

ovdenysiuk Regular Visitor
Regular Visitor

Re: Did something change with SelectionId, the key looks different now

How to add selectionId to table?

Also, how correct to use ISelectionManager?

ovdenysiuk Regular Visitor
Regular Visitor

Re: Did something change with SelectionId, the key looks different now

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?

 

 

v-evelk Established Member
Established Member

Re: Did something change with SelectionId, the key looks different now

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