<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: host.persistProperties with data bound properties in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2621352#M37206</link>
    <description>&lt;P&gt;Anyone can help us?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 05:50:25 GMT</pubDate>
    <dc:creator>danieleperilli</dc:creator>
    <dc:date>2022-07-06T05:50:25Z</dc:date>
    <item>
      <title>host.persistProperties with data bound properties</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2573317#M36645</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 different problems with the &lt;STRONG&gt;host.persistProperties&lt;/STRONG&gt; method with data bound properties. I'm perfectly able to use it with static properties.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. When the property is bound to a measure I use this syntax:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;host.persistProperties({
    merge: [
        {
            objectName: "dataPoint",
            properties: {
                "color": "#000000"
            },
            selector: {
                metadata: "Sales.Sales Cost"
            }
        }
    ]
});&lt;/LI-CODE&gt;&lt;P&gt;In this case the property "&lt;STRONG&gt;color"&lt;/STRONG&gt; is stored but I need to call an additional update to see the property in the dataview - in fact the update that comes immediately after the &lt;STRONG&gt;persistProperties&lt;/STRONG&gt; call doesn't contain the updated color. Workaround: after calling the &lt;STRONG&gt;host.refreshHostData&lt;/STRONG&gt; method the dataview is correctly updated. Is it something that can be fixed? I would avoid using the workaround if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. When the property is bound to a category, instead, I use this syntax:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;host.persistProperties({
    merge: [
        {
            objectName: "dataPoint",
            properties: {
                "color": "#000000"
            },
            selector: {
                data: [ { "identityIndex": 0 } ]
            },
            // containerIdx: 0 // I also tried this...
        }
    ]
});&lt;/LI-CODE&gt;&lt;P&gt;Unfortunately, it doesn't seem to work. Please note that the selector in the sample has been created with the selectionIdBuilder.withCategory... Am I missing something or is there an issue?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Daniele&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2022 16:33:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2573317#M36645</guid>
      <dc:creator>danieleperilli</dc:creator>
      <dc:date>2022-06-12T16:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: host.persistProperties with data bound properties</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2579482#M36714</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1620"&gt;@danieleperilli&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the offical blog:&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/visuals/visual-api#visualconstructoroptions" target="_self"&gt;VisualConstructorOptions&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;persistProperties&lt;/CODE&gt;, allows users to create persistent settings and save them along with the visual definition, so they're available on the next reload&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You can look for an example in powerbi-visuals-sankey custom visual, where it is used to store various properties.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/microsoft/powerbi-visuals-sankey" target="_self" rel="nofollow noreferrer"&gt; powerbi-visuals-sankey&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;A rough example for your case:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;options.host.persistProperties({
            VisualObjectInstance = {
            objectName: "filterSetting",
            selector: undefined, 
            properties: {
                filter: "xyz"
            }
        };
     });
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After triggering the persistProperties function, the visual triggers an update, populating the VisualUpdateOptions' options.dataViews.metadata.objects with the persisted property. Note, that you have to define your property in the capabilities.json beforehand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 07:37:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2579482#M36714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-15T07:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: host.persistProperties with data bound properties</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2579563#M36716</link>
      <description>&lt;P&gt;Hi Rico,&lt;/P&gt;&lt;P&gt;I know how the method works, thanks, since I use it in several projects from 6 years &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm talking about using the method &lt;STRONG&gt;with a not null selector&lt;/STRONG&gt;, which is when the issue raises.&lt;/P&gt;&lt;P&gt;Can you provide a working example of using the persistProperties method with a selector pointing to a category bound property? E.g. You have a categorical data mapping and a property that must be saved on categories values like a color for each category.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 08:03:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2579563#M36716</guid>
      <dc:creator>danieleperilli</dc:creator>
      <dc:date>2022-06-15T08:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: host.persistProperties with data bound properties</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2621352#M37206</link>
      <description>&lt;P&gt;Anyone can help us?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 05:50:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/2621352#M37206</guid>
      <dc:creator>danieleperilli</dc:creator>
      <dc:date>2022-07-06T05:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: host.persistProperties with data bound properties</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/4285923#M58297</link>
      <description>&lt;P&gt;Hi, I'm having the very same issue here. Have you find a solution in the meanwhile? Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 10:54:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/host-persistProperties-with-data-bound-properties/m-p/4285923#M58297</guid>
      <dc:creator>MartinRKrupa</dc:creator>
      <dc:date>2024-11-15T10:54:40Z</dc:date>
    </item>
  </channel>
</rss>

