Hello to everyone.
I have an issue after reading a file from csv.
The csv has 22 rows, but some of them are empty in some lines and in the container that brings back the data, some values are in wrong position.
for example:
line 1 : value 1; value2; ; value4; value5
it brings back : [1value1, [2value2, [3value4, [4value5
when it has to bring back [1value1, [2value2, [3null , [4value4, [5value5
Is it possible to fix this issue somehow?
The code i use to read the file is #File
container currentLine;
int totalOfLines;
CommaTextStreamIo localStream;
Num number;
FileUpload fileUploadControl = this.getFormControl(dialog, FileUploadName);
FileUploadTemporaryStorageResult fileUploadResult = fileUploadControl.getFileUploadResult();
if (fileUploadResult != null && fileUploadResult.getUploadStatus())
{
textFile = fileUploadResult.getDownloadUrl();
}
localStream = CommaTextStreamIo::constructForRead(File::UseFileFromURL(textFile));
localStream.inFieldDelimiter("\;");
localStream.inRecordDelimiter("\n");
currentLine = localStream.read();
totalOfLines ;
while(currentLine)
{
number = conPeek(currentLine,1);
info(strFmt("Number : %1",number));
currentLine = localStream.read();
}