March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I need to call the passed Measures when the visual object is initialized, but when the object is created in the constructor, the data will not be updated, so I don't know if there is a way to get VisualUpdateOptions.dataViews, or if there is a way to force update data.
please help me, thx~
Hi @xuyonggang,
If your visual contains measures in the data view, then Power BI will automatically run the update method, making the data view available to your visual's logic.
If you want your visual to trigger the update method without the presence of measures in the data view, then you can look at the landing page APIs. This will force the visual to run both the constructor and the update methods sequentially when the visual is initialized without data.
If your requirement is outside this, I'm struggling to understand your case for needing this. Can you perhaps explain a bit more why this is important? What does your constructor need to do with the dataview that the update method cannot handle?
Regards,
Daniel
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)
Hi, @dm-p, glad for your reply, but i find run the update method is not helpful for my visual.
My visual object only needs to call the measurement value during initialization, and then get other values through the operation of the visual object, these values also will overwrite the measures【measures just only serve as default values for initialization】. If I write the initialization into the update function, this will cause it to be reset every time when data updated. This is not What I want, so what I need most is “How to get the options.dataViews[0] in the constructor"
Hi @xuyonggang,
Unless you can think within the constraints of the current visual lifecycle, and this is something you truly need, your current approach will be to create a feature request with Microsoft. There is no way to do this currently.
You can create an issue here: Issues · microsoft/PowerBI-visuals-tools (github.com)
Regards,
Daniel
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)
Hi @dm-p, Thank you for your idea, it made me think of using updateCount to determine whether it is initialized, so that it will not be reset when the data changes.
Now I have a new question, my component is a datepicker visual, can I filter data from other pages through this visual object, similar to the official synchronous slicer function?
Hi @xuyonggang,
You can only leverage the functionality to restore the filter to the data view if you have enabled slicer sync. Bear in mind that this is only a valid filter that Power BI has sanitized after your visual submits it (this is not documented and I found this out the hard way). If you want to share settings or other information that is not part of a filter object, then this is not possible through conventional means due to security restrictions on visuals.
The only other way to share information between visuals in a report is to use the local storage API. Note that to get access to this, you need to contact Microsoft to specifically enable it for your visual.
Regards,
Daniel
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)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |