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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to access external data feed through javascript

pwright1
4-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?

2 REPLIES 2

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

katte
1-Newbie
(To:pwright1)

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>'];

Top Tags