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
Anonymous
Not applicable

Custom Visual update options.updateId

I noticed the updateId on the VisualUpdateOptions passed in on a custom visual's update method when debugging.

 

What is that used for? 

Can it be used to get back to a previous options passed into visual.update?

 

I would like to be able to programatically get back to an earlier data state (drill up) after having drilled down using selectionManager.select().

 

Thanks for any help or information.

4 REPLIES 4
dm-p
Super User
Super User

@Anonymous,Hi 

The updateId property is not part of the API spec (here's the interface definition). TypeScript certainly doesn't like it when referenced:

image.png

You can hack around this by referring to it using bracket notation...

image.png

image.png

...but this isn't really very TypeScript-y, as you're working around the problem, and if for some reason, the property disappears from the object then you'll have to handle the error to avoid the visual crashing.

The property itself appears to be added by the developer visual (which hosts the custom visuals runtime) and is likely playing the role of a correlation ID for logging purposes and will only have any meaning to the originating service.

Personally, if I can't see it in the API spec, I wouldn't rely on it for anything I would do inside the visual logic. If I needed one, I'd generate it within the update method with a suitable package, as you have more control over what you can do with it.

The ID would not provide access to a previous state, so if you wanted to handle this, you would need to store a previous state in your view model when updating during the desired operation, to allow comparison to the current state later on, if you need to revert. TreeViz does something like this, although for the case they're using if for, VisualUpdateType (which has been introduced after they wrote their visual) might be more appropriate.

Regards,

Daniel


If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂





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 Daniel for your response.  You brought up some interesting points that I will find useful, but they don't resolve what I'm after.  I don't think I was clear enough in asking my question.

 

I'm working with hierarchies in a matrix grid and I would like to be able to programatically control expand up and down. 

 

I know of only selectionManager.select(dataPoint) for drilling down.  I haven't found a method (or API) to drill up, or drill to a specific level, or return to top level dataView.

 

I can use selectionManager.select(dataPoint) to drill down on the current dataView.  But that brings a new dataView and even if I held onto the previous dataView, Power Bi only knows about the current dataView.  If I attempt to drill down on another dataPoint from the previous dataView it has no meaning to Power Bi and nothing is returned.  A key issue is that the dataPoint identifiers are unique only to the dataView and not to the data that they represent.  So a hierarchy member in different dataViews can have different identifiers. When I saw the UpdateId (even though not officially exposed in the definition) I was hoping it may be a way to reference a dataPoint from a previous dataView in a select call.

 

At a minimum, I'm looking for code that can get Power Bi to return to the top level dataView.  I can then from there navigate down to where I want to go.

 

As an aside, in regards to VisualUpdateType, I've been confused by the meaning of VisualUpdateType.style=16.   I assumed it meant changes made in the Format/Style panel of the editor.  But when I make a change, I'm getting type = data (2), not style (16).  Can you tell me what style represents, or is there another issue taking place?

 

Thanks again for your timely response and any further help.

Regards,

Bruce

Hi @Anonymous,

Hmmm... this might be getting to the point where I'm trying to punch above my weight 😉

You can get Power BI to provide a higher-level dataView if you've enabled drilling on the specified dataRole, but this is via the conventional buttons on the visual header, and/or through the context menu, if you've enabled it. I have this working very nicely on a visual using the categorical data view mapping. Doing this programmatically with elements in the visual is where I might get stuck.

If I were to approach the challenge of a matrix with expandable/collapsible groups, I'd start with the approach of ensuring that my dataView contained all the data I needed for all levels and would then map my view model to show/hide each node/level accordingly, and providing a toggle control in the approrpiate state to expand/collapse as appropriate. This comes with the disclaimer that I haven't really thought about this before today...

There's not so many people on the forums who chime in on custom visuals development, so I'm not sure (but hoping) that we might get something more timely for you from someone else. Have you tried asking the custom visuals team about this one? The can be contacted at pbicvsupport@microsoft.com if you haven't tried them. They do frequent the Custom Visuals Development Discussion forum on this board as well, but this might be a specific enough challenge that a direct question could be warranted.

Regards,

Daniel


If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂





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

Thanks for your response.

 

I had already implemented your suggest approach to 'get all data' for rows, and that is working great.  But using this approach on columns, seems to me to be a performance nightmare.  I would like to start with fewer columns and make the user choose to drill for more.  Since it appears there is only the drill down (selectionManager.select) method and none of the other drilling options, with directly callable methods by the code, I have no other choice then to use the builtin drilling interface and/ context menu when it comes to columns.   

 

I new to power bi,  so I don't completely understand why the actions on the context menu cannot be callable from the custom visual directly.  It would also be great if you could add and restrict items on the menu. 

 

I'll try to reaching out to pbicvsupport@microsoft.com as well.

Thanks again for your response.  

Regards,

Bruce

 

 

 

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.