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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
mrslyfox
Helper II
Helper II

Real Time data from local measuring device

Hello,

 

we have measuring controller, which has integrated web portal to access real-time measures.

We access web page by the link http://10.30.61.1/awp/Demo/IOCounter.html

Inside of html I see folowing code

:="webdata".counter:;:="webdata".HTMLcolor:

 

<script type="text/javascript">
function loadXMLDoc() {
var xmlhttp = new XMLHttpRequest();

xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.responseText);
}
}

xmlhttp.open("GET", "IOCounter.htm", true);
xmlhttp.send();
}

function myFunction(response) {

var result;
result = response.split(";");
document.getElementById ("id01").style.backgroundColor = result[1];
document.getElementById ("id01").innerHTML = result[0] + " f/h";
}

loadXMLDoc();
setInterval(loadXMLDoc, 1000);
</script>

 

I can add it PowerBI desktop as a Web source and manually I can refresh measured value, but

how can I push this data from controller to PowerBi service ?

2 REPLIES 2
Anonymous
Not applicable

HI @mrslyfox,


AFAIK, power bi not load/run javascript functions when you use web connector, it will get html elements and stored as text format.

 

In addition, you can also take a look at following link:

Call custom Javascript function in a table column

 

Regards,

Xiaoxin Sheng

Hello @Anonymous

 

Here is My test powershell script to push data to PBI service

 

while($true){
$endpoint = "https://api.powerbi.com/xxxxxxxxxx"

$payload = @{

"Measured" =Get-Random -Minimum 10 -Maximum 100

"DateTime" =Get-Date -Format F
"MachineName" ="Ford"
"TargetValue" =80
"MinValue" =10
"MaxValue" =100

}
Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
}

 

and with second Script, which can get counter result from Measuring device

 

$WebResponse = Invoke-WebRequest "http://10.20.30.1/awp/Ford/IOCounter.htm"
$WebResponse.Content

 

 

Two problem I have (for the lack of scripting knowledges) 

1. I have no idea how to put result from second script into the 'Measured" = 

2. result from second script return value with char " ; ", like: 25000;

and I need to delete it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.