<?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 custom visual enumeration issues in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/146866#M5057</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I'm developing a custom visual for PowerBI. I have a question . After investigating and the documentation is not very detailed I can't insert items in the dropbox of the capabilities objects, ie I want to have the columns of my table dynamically in a property object like the matrix table has.How to do this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zzzzz.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34153i0B2C6F1336DC071A/image-size/large?v=v2&amp;amp;px=999" role="button" title="zzzzz.jpg" alt="zzzzz.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_ei.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34154i9117DB934BECE190/image-size/large?v=v2&amp;amp;px=999" role="button" title="_ei.jpg" alt="_ei.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="issue.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34155i1AA601DAD421439A/image-size/large?v=v2&amp;amp;px=999" role="button" title="issue.jpg" alt="issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 10:26:08 GMT</pubDate>
    <dc:creator>joao_pires</dc:creator>
    <dc:date>2017-03-22T10:26:08Z</dc:date>
    <item>
      <title>custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/146866#M5057</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I'm developing a custom visual for PowerBI. I have a question . After investigating and the documentation is not very detailed I can't insert items in the dropbox of the capabilities objects, ie I want to have the columns of my table dynamically in a property object like the matrix table has.How to do this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zzzzz.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34153i0B2C6F1336DC071A/image-size/large?v=v2&amp;amp;px=999" role="button" title="zzzzz.jpg" alt="zzzzz.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_ei.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34154i9117DB934BECE190/image-size/large?v=v2&amp;amp;px=999" role="button" title="_ei.jpg" alt="_ei.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="issue.jpg" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34155i1AA601DAD421439A/image-size/large?v=v2&amp;amp;px=999" role="button" title="issue.jpg" alt="issue.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 10:26:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/146866#M5057</guid>
      <dc:creator>joao_pires</dc:creator>
      <dc:date>2017-03-22T10:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/148429#M5063</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24504"&gt;@joao_pires&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on my research, you may use dataViews in VisualUpdateOptions to make it.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 10:58:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/148429#M5063</guid>
      <dc:creator>v-chuncz-msft</dc:creator>
      <dc:date>2017-03-24T10:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/148522#M5065</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/11389"&gt;@v-chuncz-msft&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, i have data of columns of&amp;nbsp;&lt;SPAN&gt;dataViews in VisualUpdateOptions, but how make a combo dinamic with this values?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;regards&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;joão&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 14:32:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/148522#M5065</guid>
      <dc:creator>joao_pires</dc:creator>
      <dc:date>2017-03-24T14:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/149669#M5090</link>
      <description>&lt;P&gt;Are you tring to add a dynamic property for each column that has been added to a custom visual? If so, then I will describe what I am using to acheive that result where you add your property values into the objects collection for a specific column using the &lt;STRONG&gt;DataViewMetadataColumn.&lt;/STRONG&gt; Here is an example of a demo custom visual named &lt;STRONG&gt;snazzyTable&lt;/STRONG&gt;&amp;nbsp;which produces a custom table where I have added three columns. As you can see, this custom visual gives the user the ability to configure bold formatting on each column seperately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bold formatting can be enabled/disabled on each column seperately" style="width: 600px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34909iF568196436FF747E/image-size/large?v=v2&amp;amp;px=999" role="button" title="CustomColumnProperties.png" alt="Bold formatting can be enabled/disabled on each column seperately" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Bold formatting can be enabled/disabled on each column seperately&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It took me a little time to figure out working with dynamic objects but the key is recognizing that many objects in the Power BI visuals API have their own &lt;STRONG&gt;objects&lt;/STRONG&gt;&amp;nbsp;collections to track custom properties. For example, the metadata for the column named &lt;STRONG&gt;Sales Revenue&lt;/STRONG&gt; is persisted into the following path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CustomColumnPropertyMetadata.png" style="width: 506px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/34910i0013B7F7BD9FEE64/image-size/large?v=v2&amp;amp;px=999" role="button" title="CustomColumnPropertyMetadata.png" alt="CustomColumnPropertyMetadata.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how to recreate this effect.&amp;nbsp;Begin in the &lt;STRONG&gt;capabilities.json&lt;/STRONG&gt; file by defining a property just like you would for a single static property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"objects": {
    "columnFormatting": {
      "displayName": "Bold Column Formatting",
      "properties": {
        "fontBold": {
          "displayName": "Font Bold",
          "type": { "bool": true }
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;Next, define a generic method to retreive metadata property values. Here is my generic implementation of &lt;STRONG&gt;getValue&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public getValue&amp;lt;T&amp;gt;(objects: DataViewObjects, objectName: string, propertyName: string, defaultValue: T): T {
  if (objects) {
    let object = objects[objectName];
    if (object) {
      let property: T = &amp;lt;T&amp;gt;object[propertyName];
      if (property !== undefined) {
        return property;
      }
    }
  }
  return defaultValue;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now comes the tricky part. When you implement &lt;STRONG&gt;enumerateObjectInstance&lt;/STRONG&gt;, you must use a special selector for column metadata which invovles creating &lt;STRONG&gt;selector&lt;/STRONG&gt; object with &lt;STRONG&gt;metadata&lt;/STRONG&gt; propert to reference the specific column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;selector: { metadata: "YourColumnQueryNameHere" }&lt;/PRE&gt;&lt;P&gt;Here is the full implementation of&amp;nbsp;&lt;STRONG&gt;enumerateObjectInstance&lt;/STRONG&gt;. In particualr, check to see how it loops through each metadata column and adds a new property with a selector that includes the column query name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
  let objectName = options.objectName;
  let objectEnumeration: VisualObjectInstance[] = [];

  var metadataColumns: DataViewMetadataColumn[] = this.dataView.metadata.columns;

  switch (objectName) {
    case 'columnFormatting':
      for (var i = 0; i &amp;lt; metadataColumns.length; i++) {
        var currentColumn: DataViewMetadataColumn = metadataColumns[i];
        objectEnumeration.push({
          objectName: objectName,
          displayName: currentColumn.displayName,
          properties: {
            fontBold: this.getValue&amp;lt;boolean&amp;gt;(currentColumn.objects, objectName, "fontBold", false)
          },
          selector: { metadata: currentColumn.queryName }
        });

      };
      break;
  }
  return objectEnumeration;
}&lt;/PRE&gt;&lt;P&gt;That is all it takes to display the properties in the Format pane and to make these properties editable to the user designig a report. The last part is actually doing something difference once the user sets a column property value I handle this in the update method by querying the column property value and using the result to determine when to make the cell bold or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if (this.getValue&amp;lt;boolean&amp;gt;(columns[columnIndex].objects, "columnFormatting", "fontBold", false)) {
  tableCell.css({ "font-weight": "bold" });
}&lt;/PRE&gt;&lt;P&gt;Here's a link to the source code for snazzyTable in a GitHub repository.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="snazzyTable source code" href="https://github.com/CriticalPathTraining/CustomVisualsForPowerBI/tree/master/snazzyTable" target="_self"&gt;https://github.com/CriticalPathTraining/CustomVisualsForPowerBI/tree/master/snazzyTable&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 20:11:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/149669#M5090</guid>
      <dc:creator>TedPattison</dc:creator>
      <dc:date>2017-03-27T20:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/150180#M5104</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/2834"&gt;@TedPattison&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the long post,&amp;nbsp;but it was very useful, the trick was in the&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;selector: { metadata: "YourColumnQueryNameHere" }&lt;/PRE&gt;&lt;P&gt;and&lt;/P&gt;&lt;PRE&gt;displayName: currentColumn.displayName,&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks you so much&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;João&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 16:23:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/150180#M5104</guid>
      <dc:creator>joao_pires</dc:creator>
      <dc:date>2017-03-28T16:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/773808#M20496</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24504"&gt;@joao_pires&lt;/a&gt;&amp;nbsp;, and how you add dynamic data to combo box?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i try all step above and my combo box still show the static data from capabily file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is my visual.ts&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="visual.ts.01.PNG" style="width: 902px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/187008i413A7BFB6650E1D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="visual.ts.01.PNG" alt="visual.ts.01.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is my browser console log&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="log.ts.01.PNG" style="width: 650px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/187009i727F43EE5EEC7903/image-size/large?v=v2&amp;amp;px=999" role="button" title="log.ts.01.PNG" alt="log.ts.01.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 03:46:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/773808#M20496</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T03:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/774095#M20500</link>
      <description>&lt;P&gt;hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when dev my custom visual this option is not possible.&lt;/P&gt;&lt;P&gt;I make a combobox dinamic into CV in CSS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope is help you.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 08:49:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/774095#M20500</guid>
      <dc:creator>joao_pires</dc:creator>
      <dc:date>2019-08-23T08:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/774408#M20508</link>
      <description>&lt;P&gt;thanks&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24504"&gt;@joao_pires&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/2834"&gt;@TedPattison&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;finally I'm create dynamic color picker as much as fields values selected, and strore in dataview using selector metadata.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 14:14:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/774408#M20508</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-23T14:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/2737974#M38273</link>
      <description>&lt;P&gt;Your reply is a lifesaver, I was looking for this! I will write a blog article out of this as a continuation of series on how to develop custom visuals, I will make sure to give you credit!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 12:15:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/2737974#M38273</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2022-08-31T12:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: custom visual enumeration issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/4185484#M55883</link>
      <description>&lt;P&gt;I'd like to see this answer updated to use the new&amp;nbsp;&lt;STRONG&gt;getFormattingModel&lt;/STRONG&gt;&amp;nbsp;API instead of&amp;nbsp;&lt;STRONG&gt;enumerateObjectInstance&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 20:15:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/custom-visual-enumeration-issues/m-p/4185484#M55883</guid>
      <dc:creator>FelipeCosta</dc:creator>
      <dc:date>2024-09-27T20:15:05Z</dc:date>
    </item>
  </channel>
</rss>

