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

Getting blank infotable after fetching data from URL using GetJSON(param) method

SOLVED
Highlighted
Level 1

Getting blank infotable after fetching data from URL using GetJSON(param) method

Hi ,I am trying to pull data using method GetJSON. But i am getting blank infoTable. While i am getting result in postman fro the same URL. Below is the code snippet :-

var params1 = {

proxyScheme: undefined /* STRING */,

headers: {

  "Accept": "*/*",

  "tenantId": "12345"

}/* JSON */,

ignoreSSLErrors: undefined /* BOOLEAN */,

useNTLM: undefined /* BOOLEAN */,

workstation: undefined /* STRING */,

useProxy: undefined /* BOOLEAN */,

withCookies: undefined /* BOOLEAN */,

proxyHost: undefined /* STRING */,

//url:"http://dev1.tcupiot.com/app/user5/TTSLService/Alert/Query?eventDateTime=YYYY-MM-dd" /* STRING */,

url:"http://localhost:8081/TTSLFleetWeb/Alert/Query?eventDateTime=YYYY-MM-dd" /* STRING */,

    timeout: undefined /* NUMBER */,

proxyPort: undefined /* INTEGER */,

password: undefined /* STRING */,

username: undefined /* STRING */

};

// result: JSON

var data = Resources["ContentLoaderFunctions"].GetJSON(params1);

var params = {

infoTableName: "alertTable" /* STRING */,

dataShapeName: "AlertDataShape" /* DATASHAPENAME */

};

// result: INFOTABLE

var jsonTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

for(var i=0;i<data.length;i++)

{

jsonTable.AddRow({vehicleRegNo:data.array.vehicleRegNo,

                  eventTypeName:data.eventTypeName,

                  eventLocDescription:data.eventLocDescription,

                  eventDatetime:data.eventDatetime,

                  speed:data.speed,

                  description:data.description});

}

//}

result = jsonTable;

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Getting blank infotable after fetching data from URL using GetJSON(param) method

In your "for" function, you have to specify the array index in each, i.e i<data.rows.length and for each element name:data.rows.name

3 REPLIES 3

Re: Getting blank infotable after fetching data from URL using GetJSON(param) method

In your "for" function, you have to specify the array index in each, i.e i<data.rows.length and for each element name:data.rows.name

Re: Getting blank infotable after fetching data from URL using GetJSON(param) method

You may also look into using this extension ThingWorx IoT Marketplace

Re: Getting blank infotable after fetching data from URL using GetJSON(param) method

Thank you . It worked out.