Forum Discussion
Custom Visual dataViewMappings Setting Up
Are you going to use it with R-script?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Yes I'm using an R script and Plotly. One thing I failed to mention in my previous post is that I put a Stop(<dataRole>) in to see what values are being used. For the measures I get the correct values, but for the groups I'm getting numbers and not the actual text values.
- v-viig9 years agoCommunity Champion
As far as I know, Power BI might return numbers for grouping if the field contains numbers.
Does this fact affect your code somehow?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- ranstett9 years agoRegular Visitor
Unfortunatly no because the data in those axis columns is text not numbers.
If I change the capabilties.json file back to it's original form:
{ "dataRoles": [ { "displayName": "Values", "kind": "GroupingOrMeasure", "name": "Values" } ], "dataViewMappings": [ { "scriptResult": { "dataInput": { "table": { "rows": { "select": [ { "for": { "in": "Values" } } ], "dataReductionAlgorithm": { "top": {} } } } }, "script": { "scriptProviderDefault": "R", "scriptOutputType": "html", "source": { "objectName": "rcv_script", "propertyName": "source" }, "provider": { "objectName": "rcv_script", "propertyName": "provider" } } } } ], "objects": { "rcv_script": { "properties": { "provider": { "type": { "text": true } }, "source": { "type": { "scripting": { "source": true } } } } } }, "suppressDefaultTitle": true }I can then access in my r script Values$[columnName], but the columnNames need to be hard coded. I'm basically trying to genericize this visual so I can use it with other data.
Is there a way of seeing table definition? I tried to view it through dataViews[0] but that didn't seem to be available in R. Also is there a way to debug the R script with the data being sent it?
- v-viig9 years agoCommunity Champion
Could you please send an email to [email protected]? Or share your email?
We'd like to include our R-script engineer to assist you with this issue.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals