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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

How can I get RolesIndex from the API?

Hi there, when there are multiple columns mapped in the same fields panel,  like that

gabrielAlmeida_0-1613484979870.png

in the metadata -> columns -> rolesIndex  a vector is created containing the index of each field

gabrielAlmeida_1-1613485129097.png

gabrielAlmeida_2-1613485151979.png

But in the interface of the API this not acessible. I checked the DataViewUtils (Introduction to use Data view utils in Power BI visual in Power BI embedded analytics for better emb...) , but its just help to find the specific role in different fields.

How i get that specific property named rolesIndex in my code?

Thanks.

Gabriel.

 

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Anonymous,

I would say that if you want a supported way to do this, then it's probably better to make a request in the repo for the feature.

A hacky workaround would be to refer to it explicitly like this, but it's going to get resolved as an any type, and you may need to write some safety checks around the object properties in the chain, otherwise your visual will potential experience some unintended side-effects:

dataViews[0].metadata.columns[i]['roleIndex']['statusImg'][0]

It might be worth stepping back to see if this is absolutely the way to solve what you are trying to do though - perhaps if you can share enough info and code around what you are trying to achieve, along with some sample data then perhaps we can take a look at a more supported approach?

Ragards,

Daniel





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

Proud to be a Super User!


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




View solution in original post

1 REPLY 1
dm-p
Super User
Super User

Hi @Anonymous,

I would say that if you want a supported way to do this, then it's probably better to make a request in the repo for the feature.

A hacky workaround would be to refer to it explicitly like this, but it's going to get resolved as an any type, and you may need to write some safety checks around the object properties in the chain, otherwise your visual will potential experience some unintended side-effects:

dataViews[0].metadata.columns[i]['roleIndex']['statusImg'][0]

It might be worth stepping back to see if this is absolutely the way to solve what you are trying to do though - perhaps if you can share enough info and code around what you are trying to achieve, along with some sample data then perhaps we can take a look at a more supported approach?

Ragards,

Daniel





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

Proud to be a Super User!


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




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.