2 Replies Latest reply on Aug 23, 2017 12:25 AM by npomtong RSS
    npomtong Newbie

    How to Create the Infotable from extracting data of  CSV file

    I have CSV file and i want to put it in Infotable.

    CSV.png

    So i extract data from CSV file for using Infotable.

     

    var params = {

    url: 'http://################.csv' /* HYPERLINK */,

    dataShape: 'DATA_NEW' /* DATASHAPENAME */

    };

    var date = new Array();

    var power = new Array();

    // result: INFOTABLE dataShape: "undefined"

    var csv = Resources["CSVParserFunctions"].GetCSVFile(params);

    var line = csv.length;

    var n = 0;

            for(var x = 3 ; x<line ; x++)

            {

                var R3 = csv.getRow(x);

                var V3 = R3.toString();

                var sp = V3.split(';');

                date[n] = sp[0].slice(5,15);

                power[n] = sp[1].slice(0,-1);

                n = n+1;

            }

    // values:INFOTABLE(Datashape: DATA_NEW)

    var values = Things["TABLE_NEW"].CreateValues();

     

    for(var i=0;i<10;i++)

    {

        var clonedData = values;

        clonedData.AddRow({ Names: "TEST" });

        values = clonedData;

    }

     

    values.T1 = date[0];

    values.T2 = power[0];

     

    me.T3 = values;

     

    var result = values;

    OUTPUT.png

    Then i want to use the data that is extracted to put in the Infotable but i do not know how to do?


    i want to create the table as shown down below

    T1T2

    01/08/2017

    194336

    02/08/2017

    190251

    03/08/2017

    96071

    04/08/2017

    164241

    05/08/2017

    129069

    06/08/2017

    120010

    07/08/2017143242

    Please suggest me.