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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Getting empty return when using Resources["CSVParserFunctions"].ReadCSVFile(params);

wmacnaughton
8-Gravel

Getting empty return when using Resources["CSVParserFunctions"].ReadCSVFile(params);

I have a simple CSV file with content like below.

Date,PCSN,Total
4/27/2018,H192857,3
4/27/2018,H193177,4
4/27/2018,H193100,20

 

I'm using CSVParser_Extensions v4.0.1, but keeps getting empty returns with the following code. Really appreciate any help on this.

 

var sFile = "PMP/test1.csv";

var params = {
path: sFile /* STRING */,
columnMappings: 'Date;PCSN;Total' /* STRING */,
hasHeader: true /* BOOLEAN */,
longitudeField: undefined /* NUMBER */,
dateFormat: "dd.MM.yyyy" /* STRING */,
fileRepository: me.name /* THINGNAME */,
latitudeField: undefined /* NUMBER */,
fieldDelimiter: "," /* STRING */,
stringDelimiter: "\"" /* STRING */,
dataShape: "VMS.CSV.Test" /* DATASHAPENAME */
};

// result: INFOTABLE
var result = Resources["CSVParserFunctions"].ReadCSVFile(params);

7 REPLIES 7

I will doubt about fileRepository parameter value ,why you have inputted me.name there ? I think fileRepository is a ThingName where the file is located .Like for example "SystemRepository" .What is me.name here ,i think its the current thing name you have place .Can you please check this and retry .

 Thank you for responding my issue, mnarang

I'm writing the service on a FileRepository thing, me.name is the ThingName. I tried to use hard-coded ThingName, same problem, still getting the emplty return.

 

Thanks,

Wendy 

I tried the same thing and it is working fine .Can you also try running this service from the Composer only ?

And see if any error is coming while executing the service manually .See the attached executed sample at my end 

 

Hi mnarang,

 

I've been testing from Compose through my script. I tested ReadCSVFile service on CSVParserFunctions directly, got Data Shape Must Be Specified error.

Attached the error screenshot and test1.csv file here

Sorry, I missed the dataShape in UI. I added the correct dataShape, and I got the return, but return column shifted, miss a column when I use ';Date;PCSN;Total' columnMappings, and got error when I use ';Date;PCSN;Total;' columnMappings. Attaching both screenshots.

Hello,

 

Although i am very late on this ,but are you able to resolve it now ?
I have 4 columns like Title1,Title2,Title3,Title4 and i used the property like is Title1;Title2;Title3;Title4

By this way i am able to get every column out there .

 

Thanks,

Mukul Narang 

Top Tags