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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to Create the Infotable from extracting data of CSV file

Nuttapol
11-Garnet

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 = sp[0].slice(5,15);

            power = 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.

2 REPLIES 2
PaiChung
22-Sapphire I
(To:Nuttapol)

Check out the Parsley extension in the market place.

Thank you Pai Chung i can do it.

gg.png

Top Tags