Wrong value from count number of lines in CSV

1
Hi forum, I’m using CSV Module to import between ~3k to ~1.5M lines depending on the file. I’m also using a progress bar in the front end, so the users can see how many lines were imported. To get the max value for the Progress Bar, I’m using the “Count number of lines in CSV” java action of the csv module. What I noticed is that the file has 360k lines and the java action only got count around 150k lines. Has anyone experienced something similar? Is it a bug?  
asked
2 answers
2

Maybe you should insert

    .withIgnoreQuotations(true)

in the implementation of countlines

CSVReader reader = new CSVReaderBuilder(new InputStreamReader(Core.getFileDocumentContent(getContext(), this.file.getMendixObject())))
	.withSkipLines((int) skipLines.intValue())
	.withCSVParser(parser)
	.build();

Otherwise the check the line separators.

answered
2

Chris' comment fixes the Countlines java action in this case. However if you want to make an object for every one of those lines you need to use the ReadNextLine java action. In my case it did not read the lines either. For this action to work you need to change the CSVParser in the ImportCSV java action (as this is the parser used by the ReadNextLine action).

ImportCSV:

 

answered