<?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 Data bound settings/objects with Table DataViewMapping in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Data-bound-settings-objects-with-Table-DataViewMapping/m-p/3186119#M7313</link>
    <description>&lt;P&gt;I don't find a way to implement dataBound settings on for table dataViewMapping. My data is simplified and changed to a table of fruits saled in countries:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Capabilities:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "privileges": [],
    "objects": {
      "dataItem": {
        "properties": {
          "color": {
            "type": {
              "fill": {
                "solid": {
                  "color": true
                }
              }
            }
          }
        }
      }
    },
    "dataRoles": [
      {
        "displayName": "Country",
        "name": "country",
        "kind": "Grouping"
      },
      {
        "displayName": "Fruit",
        "name": "fruit",
        "kind": "Grouping"
      },
      {
        "displayName": "Saled pieces",
        "name": "saleCount",
        "kind": "Measure"
      }
    ],
    "dataViewMappings": [
      {
        "table": {
          "rows": {
            "select": [
              {
                "for": {
                  "in": "country"
                }
              },
              {
                "for": {
                  "in": "fruit"
                }
              },
              {
                "for": {
                  "in": "saleCount"
                }
              }
            ]
          }
        }
      }
    ],
    "sorting": {
      "implicit": {
        "clauses": []
      }
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;visual.ts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;class MyVisual {
  public getFormattingModel(): powerbi.visuals.FormattingModel {
    return {
      cards: [
        {
          displayName: "Fruit Card",
          uid: "card",
          groups: [
            this.data
              .getFruitTypes()
              .map(({ fruit, fruitTypeSelectionId, color }) =&amp;gt; ({
                uid: fruit,
                displayName: fruit,
                slices: [
                  {
                    uid: "sliceid",
                    displayName: "Color",
                    control: {
                      type: powerbi.visuals.FormattingComponent.ColorPicker,
                      properties: {
                        descriptor: {
                          objectName: "dataItem",
                          propertyName: "color",
                          altConstantValueSelector:
                            fruitTypeSelectionId.getSelector(),
                          selector: fruitTypeSelectionId.getSelector(),
                        },
                        value: { value: color },
                      },
                    },
                  },
                ],
              })),
          ],
        },
      ],
    };
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and my DataViewModel sth. like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export class Data {
  static fromDataView = (dataView: DataView, host: IVisualHost) =&amp;gt; {
    const fruitTypes = [];
    dataView.table.rows.forEach((row) =&amp;gt; {
      if (fruitTypeDoesNotExist(row, fruitTypes)) {
        fruitTypes.push({
          color:
            someSelectFunctionToRetrieveTheFruitColorFromDataView(dataView),
          fruitTypeSelectionId: host
            .createSelectionIdBuilder()
            .withMeasure(selectFruitName(row))
            .createSelectionId(),
          fruit: selectFruitName(row),
        });
      }
    });
    return new Data(fruitTypes /* ... */);
  };
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I dont't find any documentation on how to choose the selector and on how to create selectionIds for table DataViewMappings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help?&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2023 12:01:30 GMT</pubDate>
    <dc:creator>julip</dc:creator>
    <dc:date>2023-04-13T12:01:30Z</dc:date>
    <item>
      <title>Data bound settings/objects with Table DataViewMapping</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Data-bound-settings-objects-with-Table-DataViewMapping/m-p/3186119#M7313</link>
      <description>&lt;P&gt;I don't find a way to implement dataBound settings on for table dataViewMapping. My data is simplified and changed to a table of fruits saled in countries:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Capabilities:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "privileges": [],
    "objects": {
      "dataItem": {
        "properties": {
          "color": {
            "type": {
              "fill": {
                "solid": {
                  "color": true
                }
              }
            }
          }
        }
      }
    },
    "dataRoles": [
      {
        "displayName": "Country",
        "name": "country",
        "kind": "Grouping"
      },
      {
        "displayName": "Fruit",
        "name": "fruit",
        "kind": "Grouping"
      },
      {
        "displayName": "Saled pieces",
        "name": "saleCount",
        "kind": "Measure"
      }
    ],
    "dataViewMappings": [
      {
        "table": {
          "rows": {
            "select": [
              {
                "for": {
                  "in": "country"
                }
              },
              {
                "for": {
                  "in": "fruit"
                }
              },
              {
                "for": {
                  "in": "saleCount"
                }
              }
            ]
          }
        }
      }
    ],
    "sorting": {
      "implicit": {
        "clauses": []
      }
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;visual.ts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;class MyVisual {
  public getFormattingModel(): powerbi.visuals.FormattingModel {
    return {
      cards: [
        {
          displayName: "Fruit Card",
          uid: "card",
          groups: [
            this.data
              .getFruitTypes()
              .map(({ fruit, fruitTypeSelectionId, color }) =&amp;gt; ({
                uid: fruit,
                displayName: fruit,
                slices: [
                  {
                    uid: "sliceid",
                    displayName: "Color",
                    control: {
                      type: powerbi.visuals.FormattingComponent.ColorPicker,
                      properties: {
                        descriptor: {
                          objectName: "dataItem",
                          propertyName: "color",
                          altConstantValueSelector:
                            fruitTypeSelectionId.getSelector(),
                          selector: fruitTypeSelectionId.getSelector(),
                        },
                        value: { value: color },
                      },
                    },
                  },
                ],
              })),
          ],
        },
      ],
    };
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and my DataViewModel sth. like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;export class Data {
  static fromDataView = (dataView: DataView, host: IVisualHost) =&amp;gt; {
    const fruitTypes = [];
    dataView.table.rows.forEach((row) =&amp;gt; {
      if (fruitTypeDoesNotExist(row, fruitTypes)) {
        fruitTypes.push({
          color:
            someSelectFunctionToRetrieveTheFruitColorFromDataView(dataView),
          fruitTypeSelectionId: host
            .createSelectionIdBuilder()
            .withMeasure(selectFruitName(row))
            .createSelectionId(),
          fruit: selectFruitName(row),
        });
      }
    });
    return new Data(fruitTypes /* ... */);
  };
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I dont't find any documentation on how to choose the selector and on how to create selectionIds for table DataViewMappings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 12:01:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Data-bound-settings-objects-with-Table-DataViewMapping/m-p/3186119#M7313</guid>
      <dc:creator>julip</dc:creator>
      <dc:date>2023-04-13T12:01:30Z</dc:date>
    </item>
  </channel>
</rss>

