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
Cubist
Advocate II
Advocate II

Is this how update and persistProperties are supposed to work?


In what ways do update and persistProperties affect or trigger each other?  

[custom visual question] 


 Two specific questions are:

 

1)  Is this assumption correct?

Calling persistProperties triggers and update event, and from within the triggered event handler, calling VisualSettings.parse should always return results that include the new property value set during the perist call. 

 

This seems like what is supposed to happen, however I notice in some cases the actual behaviour is different or odd/unusual.  It seems either my understanding is incorrect, or there are exceptions where this does not happen.

 

2)  What is the expected behaviour of merge and replace for the persistProperties method? 

For example, these points are not clear:

  • When a property already exists: How is merge different from replace?  If the prop exists, does merge act identically and replace the property, or ignore it?
  • What a property does not exist:  How is merge different from replace?  If the prop does not exist, do they act identically and simply save the new property?

Any comments are appreciated, thank you.

 

3 REPLIES 3
v-viig
Community Champion
Community Champion

Hello @Cubist,

 

  1. Yes, you're correct. Calling persistProperties always triggers the update method. The argument of update method contains the up dated value that has been set by using persistProperties. What for do you use persistProperties?
  2. The merge operation merges the existing properties and the new properties. The replace operation removes the existing properies and saves the new properties. If properties don't exist persistProperties just saves the new properties.

 

Please let me know if you any further questions.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Thank you, I will mark you answer correct.  One more question please:

 

>>What for do you use persistProperties?

 

Because I have an input field on the visual, that the user can type directly into.  When the user types a value into an input field on my visual, isn't this the only way to save the value?

 

Thank you -

v-viig
Community Champion
Community Champion

@Cubist

 

There's no another way to keep users' input in such cases.

You should use persistProperties.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

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.