cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to access external data feed through javascript

Participant

How to access external data feed through javascript

Hello,

I have a thing created which feeds a live data feed into studio (just a python script i'm using for testing right now). I want to be able to access the value of this live data feed in javascript so I can manipulate it for several purposes (alter the text of a widget based on the data being between a certain range, apply math to the raw value to make it within a certain range, etc.).

I've been trying code like the following, which doesn't work:

$scope.app.mdl['DataTest'].svc['MockData1'];

$scope.app.mdl['DataTest'].data.current['MockData1'];


suggestions?

Tags (1)
2 REPLIES 2
Highlighted

Re: How to access external data feed through javascript

I too would like to see some documentation on the Angular JS to see how we can interact with data dynamically.

Re: How to access external data feed through javascript

Paul WRIGHT​ The syntax that you wrote is correct. To retrieve the data/result of the service - "$scope.app.mdl['<thingname>'].svc['<servicename>'];" And the critical part is if the service returns the result in InfoTable format we need to convert that data into JSON format. Follow the below:

var temp = $scope.app.mdl['<thingname>'].svc['<servicename>'];

var tmpjson = angular.fromJson (temp);

To retrieve the values of the properties:  app.mdl['<thingname>'].properties['<prop-name>'];