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;
Solved! Go to Solution.
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
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
Thank you . It worked out.