Add integration with power BI
Would be very usefull to add "Open in power BI" as third option in filter sharing menue.
Main point is to convert vats filter in to *.pbids file and download it like in example below.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>WATS powerBI converter</title>
<script>
function download(event) {
var my_auth_token = "place token here";
var my_server_address = "place server address here";
if (event.button == 0) {
// extract filter from URL
var filter = atob(document.getElementById('wats_filter_base64').value.replace( my_server_address + "/dist/#/reporting/test-repair/uut-report?filter=", '').split('%')[0]);
// count change to be removed in latest wersion of server > 19.2
var total_count = document.getElementById('total_count').value;
filter = btoa(filter.replace(":1000,", ":" + total_count + ","));
var textToSave = '{' +
'"version": "0.1",' +
'"connections": [' +
'{' +
'"details": {' +
'"protocol": "http",' +
'"address": {' +
'"url":' + '"'+ my_server_address +'/api/App/UutReport"' +
'},' +
'"authentication": null,' +
'"query": null' +
'},' +
'"options": {' +
'"Headers": {' +
'"Content-Type": "application/json",' +
'"Accept": "application/json",' +
'"Authorization": "Basic '+ my_auth_token +'"},' +
'"Content":"' + filter + '"' +
'},' +
'"mode": null' +
'}' +
']' +
'}';
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = 'wats_query.pbids';
hiddenElement.click();
}
}
function convert_to_base64(event) {
if (event.keyCode == 13) {
document.getElementById('wats_filter_base64').value = btoa(document.getElementById('wats_filter_text').value);
}
}
</script>
</head>
<body>
<label for="_wats_filter_base64">Paste filter from WATS here</label> <input id="wats_filter_base64" type="text" value="" "/>
<input type="hidden" id="wats_filter_text" type="text" value="" onkeydown="convert_to_base64(event)" />
<br>
<label>Result Count</label> <input id="total_count" type="text" value="10""/>
<br>
<input type="button" value="Open in PowerBi" onclick="download(event)">
<br>
</body>
</html>
Please sign in to leave a comment.
Comments
0 comments