Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48449

Re: How to define Table DataViewMappings

$
0
0

Basically, if your dataRoles array is defined as follows:

 

dataRoles: [
	{
		displayName: 'Title',
		name: 'title',
		kind: powerbi.VisualDataRoleKind.Grouping
	},
	{
		displayName: 'Url',
		name: 'url',
		kind: powerbi.VisualDataRoleKind.Grouping
	}
]

Then your dataViewMappings array should look like this(I omitted the conditions[] array for clarity):

 

dataViewMappings: [{
    table: {
        rows: {
            select: [{for: { in: 'title' }},{for: { in: 'url' }}]
        }
    }
}]

The above will result in:

 

1. There will be two field wells displayed in Power BI, titled "Title" and "Url".

2. Your dataViews[index] object will have the following properties(among others...):

  • dataViews[index].table.columns[] array, which will contain that will contain some metadata about each column.
  • dataViews[index].table.rows[] array, which will contain arrays with values corresponding to the column indices.
  • dataViews[index].table.identities[] array, which will contain DataViewScopeIdentity objects corresponding to row numbers.
  • dataViews[index].table.identityFields[] array, which will contain the identityFields for each column.

Note that while the "columns" property is belongs to the table object, the other three are actually in its prototype.

 

A personal recommendation would be to log the dataView to the console and go through it yourself, and maybe play with the different mapping options. It's currently the best way I know to understand how these things work(Due to lack of documentation).

 

Also, note that you cannot have link buttons inside Power BI visuals. This is a security measure(called Sandboxing) taken by Microsoft, since it can be used to perform various malicious actions, such as Clickjacking and Cross-Site Scripting attacks, which is not something you want to be possible anywhere near your precious confidential corporate data.


Viewing all articles
Browse latest Browse all 48449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>