1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to remove empty lines while exporting Text Files?

Discussão em 'StackOverflow' iniciado por fdantas, Junho 1, 2019.

  1. fdantas

    fdantas Administrator Moderador

    I have written a program for generate the text file format but I am facing issue with creating last line of empty. So the program which is used to generated text file give an error for empty line. As you know we can remove empty line while parsing but our client says no need to create empty lines while generating text file. So please help this case for get ride of empty lines creation. Let me share some sample query for your reference

    DEFINE VARIABLE cExportData AS CHARACTER NO-UNDO FORMAT 'X(250)'.
    DEFINE VARIABLE cPath AS CHARACTER NO-UNDO.
    DEFINE VARIABLE cExt AS CHARACTER NO-UNDO.
    DEFINE VARIABLE cSFTL AS CHARACTER NO-UNDO FORMAT 'X(150)'.
    DEFINE VARIABLE cMessageDateTime AS CHARACTER NO-UNDO.

    ASSIGN
    cPath = "R:\Downloads\progress\".
    cExt = ".Txt".
    cMessageDateTime = "123456789".



    OUTPUT TO VALUE (cPath + cMessageDateTime + STRING(MTIME) + cExt ).


    cExportData = "Data1" + CHR(10) + "Data2" + CHR(10) + "Data3" + CHR(10) + "END.".
    MESSAGE cExportData.

    OUTPUT TO CLOSE.


    So when I see exported text file using NOtepad++ I could see first 3 for Data1,Data2,Data3 but 4 line is created with empty. So i need to stop creating 4th line.

    Continue reading...

Compartilhe esta Página