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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
callum
Helper II
Helper II

instance.dataViewMappings[0].categorical additionalProperty "xxxxx" exists in instance when not...

Hi,

 

When I save my capabilities.json file I get the following errors from the pbiviz command line tool:

 error  JSON  capabilities.json :  instance.dataViewMappings[0].categorical additionalProperty "names" exists in instance when not allowed
 error  JSON  capabilities.json :  instance.dataViewMappings[0].categorical additionalProperty "quadrants" exists in instance when not allowed
 error  JSON  capabilities.json :  instance.dataViewMappings[0].categorical additionalProperty "rings" exists in instance when not allowed

Here is the contents of said file:

{
  "dataRoles": [
    {
      "displayName": "Name",
      "name": "name",
      "kind": "Grouping"
    },
    {
      "displayName": "Quadrant",
      "name": "quadrant",
      "kind": "Grouping"
    },
    {
      "displayName": "Ring",
      "name": "ring",
      "kind": "Grouping"
    }
  ],
  "dataViewMappings": [
    {
      "categorical": {
        "names": {
          "for": {
            "in": "name"
          }
        },
        "quadrants": {
          "for": {
            "in": "quadrant"
          }
        },
        "rings": {
          "for": {
            "in": "ring"
          }
        }
      }
    }
  ]
}

I'm brand new to custom visual development so I don't really know where to start in trying to debug this. Can anyone spot where I'm going wrong with this?

 

For context, I'm basically trying to create a similar visual to this (click on one of the four boxes), i.e. plotting points, each of which has a name, a quadrant and a ring.

 

Thanks!

1 ACCEPTED SOLUTION
v-viig
Community Champion
Community Champion

Hello @callum,

 

You should use something like this:

{
    "dataRoles": [
        {
            "displayName": "Name",
            "name": "name",
            "kind": "Grouping"
        },
        {
            "displayName": "Quadrant",
            "name": "quadrant",
            "kind": "Grouping"
        },
        {
            "displayName": "Ring",
            "name": "ring",
            "kind": "Grouping"
        }
    ],
    "dataViewMappings": [
        {
            "table": {
                "rows": {
                    "select": [
                        {
                            "for": {
                                "in": "name"
                            }
                        },
                        {
                            "for": {
                                "in": "quadrant"
                            }
                        },
                        {
                            "for": {
                                "in": "ring"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

4 REPLIES 4
v-viig
Community Champion
Community Champion

Hello @callum,

 

You should use something like this:

{
    "dataRoles": [
        {
            "displayName": "Name",
            "name": "name",
            "kind": "Grouping"
        },
        {
            "displayName": "Quadrant",
            "name": "quadrant",
            "kind": "Grouping"
        },
        {
            "displayName": "Ring",
            "name": "ring",
            "kind": "Grouping"
        }
    ],
    "dataViewMappings": [
        {
            "table": {
                "rows": {
                    "select": [
                        {
                            "for": {
                                "in": "name"
                            }
                        },
                        {
                            "for": {
                                "in": "quadrant"
                            }
                        },
                        {
                            "for": {
                                "in": "ring"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Hi, thanks a lot for that solution. Unfortunately although it got rid of the error, I'm still a bit stuck, because the resultant table doesn't seem to be populated!

 

I've included a screenshot of what gets logged when I call 

console.log(options.dataViews[0].table)

from inside the visual's update method. As you can see, it has data about the structure of the table, i.e. in the "columns" property, but it does not actually contain any rows. If I go to Explore>See data then I do see the data I'm expecting to see, so it definitely does exist... it's just not being placed into the table object for some reason.

 

Do you have any ideas what could be causing this?

Thank you.

 

Capture.PNG

Ah... apparently the data is in there. If I actually do a console.log on options.dataViews[0].table.rows then I do see the data... the rows attribute just doesn't get included when I log the entire table, for whatever reason!

v-viig
Community Champion
Community Champion

Rows property is available under __proto__ property if you use console.log.

You should use options.dataViews[0].table.rows in your code to get rows.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.