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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! 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