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

Unable to read csv file in ReadCSVFile method

Vatsal
12-Amethyst

Unable to read csv file in ReadCSVFile method

I am trying to create a java code to read a csv file. The file is located in the systemrepository.

I am using the below code, but unable to get the result

 

DataShapeDefinition dsd = new DataShapeDefinition();
dsd.addFieldDefinition(new FieldDefinition("Field1", BaseTypes.STRING));
dsd.addFieldDefinition(new FieldDefinition("Field2", BaseTypes.STRING));
dsd.addFieldDefinition(new FieldDefinition("Field3", BaseTypes.STRING));

//mything.get
CSVParser csvParser = new CSVParser();
InfoTable csvInfotable = new InfoTable();
csvInfotable.setDataShape(dsd);
_logger.warn("InfotableCreated");
try {
csvInfotable = csvParser.ReadCSVFile("SystemRepository", "/new 1.csv", "TestDataShape",
hasHeader, columnMappings, null, null, dateFormat, ",", "\"");
_logger.warn("InfotableCreated after readCSV function");
//code to identify the memory usage

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

The error i am getting is: com.thingworx.common.exceptions.InvalidRequestException: Unable To Open [/new1.csv] in [SystemRepository] : null

attached is the sample csv file

Any help in this matter would be appreciated.

ACCEPTED SOLUTION
1 REPLY 1
Announcements


Top Tags