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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AdamWhittaker
Helper I
Helper I

dataRoles / dataViewMappings fror muliple tables?

Hello,

 

How would i go about designing the capabilities.json file if i want to add 3 related tables to a custom visual, at first i thought i should use tables but the api limits it to one..

 

I am trying to send somthing like this

 

Person:

personId

PersonName

 

Events:

personId

EventName

EventStart

EventEnd

 

The two tables are linked via personId.

I thought something like this:

    "dataViewMappings": [
        {
            "categorical": {
                "categories": [
                    {
                        "for": {
                            "in": "resourceId"
                        }
                    },
                    {
                        "for": {
                            "in": "resourceName"
                        }
                    },
                    {
                        "for": {
                            "in": "territory"
                        }
                    },
                    {
                        "for": {
                            "in": "eventColor"
                        }
                    }
                ],
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "eventId"
                            }
                        },
                        {
                            "bind": {
                                "to": "eventName"
                            }
                        },
                        {
                            "bind": {
                                "to": "manager"
                            }
                        },
                        {
                            "bind": {
                                "to": "appointmentNumber"
                            }
                        },
                        {
                            "bind": {
                                "to": "status"
                            }
                        },
                        {
                            "bind": {
                                "to": "description"
                            }
                        },
                        {
                            "bind": {
                                "to": "startDate"
                            }
                        },
                        {
                            "bind": {
                                "to": "endDate"
                            }
                        }
                    ]
                }
            }
        }
    ]



But categories cannot be an array?

 

Thanks

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @AdamWhittaker,

 

Because categories can have other potential properties (like dataReductionAlgorithm), you would add a select property with an array to your existing object and include the data roles there (like you have done for values). The following should work based on your above definition (or get you close to it - it's a valid pattern that I have used in other visuals):

 

{
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "resourceId"
                            }
                        },
                        {
                            "for": {
                                "in": "resourceName"
                            }
                        },
                        {
                            "for": {
                                "in": "territory"
                            }
                        },
                        {
                            "for": {
                                "in": "eventColor"
                            }
                        }
                    ]
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "eventId"
                            }
                        },
                        {
                            "bind": {
                                "to": "eventName"
                            }
                        },
                        {
                            "bind": {
                                "to": "manager"
                            }
                        },
                        {
                            "bind": {
                                "to": "appointmentNumber"
                            }
                        },
                        {
                            "bind": {
                                "to": "status"
                            }
                        },
                        {
                            "bind": {
                                "to": "description"
                            }
                        },
                        {
                            "bind": {
                                "to": "startDate"
                            }
                        },
                        {
                            "bind": {
                                "to": "endDate"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

 

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

2 REPLIES 2
AdamWhittaker
Helper I
Helper I

@dm-p Thanks for the help, it worked. Looks like i just missed the select part in:

                "categories": {
                    "select": [

 

dm-p
Super User
Super User

Hi @AdamWhittaker,

 

Because categories can have other potential properties (like dataReductionAlgorithm), you would add a select property with an array to your existing object and include the data roles there (like you have done for values). The following should work based on your above definition (or get you close to it - it's a valid pattern that I have used in other visuals):

 

{
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "resourceId"
                            }
                        },
                        {
                            "for": {
                                "in": "resourceName"
                            }
                        },
                        {
                            "for": {
                                "in": "territory"
                            }
                        },
                        {
                            "for": {
                                "in": "eventColor"
                            }
                        }
                    ]
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "eventId"
                            }
                        },
                        {
                            "bind": {
                                "to": "eventName"
                            }
                        },
                        {
                            "bind": {
                                "to": "manager"
                            }
                        },
                        {
                            "bind": {
                                "to": "appointmentNumber"
                            }
                        },
                        {
                            "bind": {
                                "to": "status"
                            }
                        },
                        {
                            "bind": {
                                "to": "description"
                            }
                        },
                        {
                            "bind": {
                                "to": "startDate"
                            }
                        },
                        {
                            "bind": {
                                "to": "endDate"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

 

Good luck!

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors