3 Replies Latest reply on Aug 27, 2017 9:12 AM by pmishra-4 RSS
    pmishra-4 Explorer

    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[i].vehicleRegNo,

                      eventTypeName:data[i].eventTypeName,

                      eventLocDescription:data[i].eventLocDescription,

                      eventDatetime:data[i].eventDatetime,

                      speed:data[i].speed,

                      description:data[i].description});

     

    }

     

     

     

    //}

    result = jsonTable;