So, I am running 6.0 and am trying to parse a CSV file. I have downloaded the CSV Parser Extension and have boiled down the code to the bare minimum and haven't been able to get it to work.
In fact, I have a very simple test and my results are the same as when I use the GetCSVFile Method. Here below I am using a very simple example and the result is that I only get the very first column and not the second column. I am certain I am doing something wrong but I haven't been able to locate the documentation for the extension. I have looked through the forum and found links but they are dead links.
Can someone help with getting the Description column populated?
Thanks in advance
var params = {
columnMappings: "Tagname; Description;" /* STRING */,
hasHeader: "false" /* BOOLEAN */,
longitudeField: undefined /* NUMBER */,
dateFormat: undefined /* STRING */,
latitudeField: undefined /* NUMBER */,
fieldDelimiter: undefined /* STRING */,
stringDelimiter: undefined /* STRING */,
content: '"XV101,Valve Input"' /* STRING */,
dataShape: "PES_Tags" /* DATASHAPENAME */
};
// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ParseCSVFile(params);
Solved! Go to Solution.
Few things that may cause it:
Few things that may cause it:
Hi Jeff,
Here is an example per the test data you provided and it works on my Thingworx 7.0.0-b479:
var params = {
columnMappings: "Tagname;Description" /* STRING */,
hasHeader: "false" /* BOOLEAN */,
longitudeField: undefined /* NUMBER */,
dateFormat: undefined /* STRING */,
latitudeField: undefined /* NUMBER */,
fieldDelimiter: "," /* STRING */,
stringDelimiter: "\"" /* STRING */,
content: "XV101,Valve Input\n" /* STRING */,
dataShape: "PES_Tags" /* DATASHAPENAME */
};
// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ParseCSVFile(params);
Hope this helps,
Thanks,
Br,
Anna
Thanks both of you!!!! My issue was the space between the columnMappings... I appreciate it.
Hi.
If i am having a column which data type is date time means, how to parse in thingworx?
Hi,
I am new to thingworx, can you help me on CSV Parser plugin, I dont know how to use this and how should i implement it.
Regards
Vikas
Hi,
I used below script to parse CSV Data.
var params = { path: "/"+ file /* STRING */, columnMappings: undefined /* STRING */, hasHeader: true /* BOOLEAN */, longitudeField: undefined /* NUMBER */, dateFormat: undefined /* STRING */, fileRepository: "SystemRepository" /* THINGNAME */, latitudeField: undefined /* NUMBER */, fieldDelimiter: undefined /* STRING */, stringDelimiter: undefined /* STRING */, dataShape: "parseCSV" /* DATASHAPENAME */ }; var result = Resources["Parsley"].ParseCSV(params); //result: INFOTABLE
file - CSV file name(eg. "data.csv")
parseCSV - Datashape Name which have all field names with "STRING" basetype.
Thanks & Regards,
Sathishkumar C.
Hi Satish,
I understood the script, I dont know the way from where i should start and upload csv file to run this script?
can you plz tell me?
Use Upload widget with Mashup.
Thanks Satish for prompt reply.
so, i have to follow following steps?
1) create datashapre
2) upload widget
3) create service with provided code
If Am i right? there is otherway to import csv directly without creating Mashup.
Regards
Vikas
Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________