Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
callum
Helper II
Helper II

Accessing data through names defined in capabilities.json

 I'll try to explain this the best I can.

 

If I have the following capabilities.json file:

{
  "dataRoles": [
    {
      "displayName": "Test 1",
      "name": "test1",
      "kind": "Grouping"
    },
    {
      "displayName": "Test 2",
      "name": "test2",
      "kind": "Grouping"
    }
  ],
  "dataViewMappings": [
    {
      "table": {
        "rows": {
          "select": [
            {
              "for": {
                "in": "test1"
              }
            },
            {
              "for": {
                "in": "test2"
              }
            }
          ]
        }
      }
    }
  ]
}

and in my dataset I have columns "foo" and "bar", then on my custom visual I can drag the foo column into the "Test 1" field, and the bar column into the "Test 2" field.

 

However, when I view the resulting dataset with console.log(options.dataViews[0].table), I don't see any mention of the words test1 and test2, only foo and bar... But these names are defined by the user, so they aren't much use to me!

 

At first I thought the columns might be ordered in the way they're defined in capabilities.json, so for example the first test1 item would be at options.dataViews[0].table.rows[0][0] and the first test2 item would be at options.dataViews[0].table.rows[0][1]... but there doesn't actually appear to be any particular order to the columns, so I can't rely on that method.

 

If I'm not being clear here, the following question is pretty much equivalent: how would I loop through every row in the table and output only the values corresponding to test1?

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@callum,

 

You may check "options.dataViews[0].table.columns[0].roles".

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.