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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Unable to read csv file in ReadCSVFile method

Vatsal
7-Bedrock

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.

1 ACCEPTED SOLUTION
1 REPLY 1
Top Tags