web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Import from csv files brings wrong data values

(0) ShareShare
ReportReport
Posted on by 157

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();

        }

I have the same question (0)
  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Hi SGbron,

    what do you mean by "brings back"? What part of your code handles this "bringing back"? Doesn't your code simply print one entry in the infolog for each row in your CSV file?

  • SGbron Profile Picture
    157 on at

    Hello Nikolaos.

    By brings back I mean that in lines:

    while(currentLine)

           {

               number = conPeek(currentLine,1);

               info(strFmt("Number : %1",number));

               currentLine = localStream.read();

           }

    where it reads the file, in the container takes the values that i am writing

    It misses the null value.

  • nmaenpaa Profile Picture
    101,172 Moderator on at

    Could you change your code a bit, to print the contents of currentLine (using con2str(currentLine))?

    And share with us some real CSV rows, and real output from your code? Thanks!

  • Suggested answer
    SGbron Profile Picture
    157 on at

    Finally I found the reason for missing colums.

    I had set the delimeter to ' ; ' but for some reason it doesn't read correct the file when null values exist. the correct delimeter is ' , '.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 622

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 532 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans