Robotic Process Automation RPA

Expand all | Collapse all

Line break "\n" is not working

  • 1.  Line break "\n" is not working

    Posted Fri July 23, 2021 01:39 PM
    Hi!

    When I run the command:
            textWrite --text "\"SMS não enviado para:  ,${varMatricula_Empregado}, ${varNome_Empregado} , ${varItem_Celular}, \\n\"" --file ${writerText_ErroSMS}

    it isn´t breaking the line, what is the error?

    Here is an example of the output file:
    "SMS não enviado para: ,000000000424619, MISLENE MIRANDA SALES DE JESUS , 31998539568, \n""SMS não enviado para: ,000000000658186, GRACIELLE APARECIDA FONTOURA SUIQUER , 31997914687, \n""SMS não enviado para: ,000000000668318, ROSEMAR GOMES VITAL ,

    Regards,

    ------------------------------
    Mauro Sérgio
    ------------------------------


  • 2.  RE: Line break "\n" is not working

    Posted Mon July 26, 2021 07:05 AM

    Hello, Mauro!

    This happens because "\n" is not the pattern for line breaking inside text files, so the text writer won't escape the instruction.
    In order to break lines using file streams commands, I would suggest you use the "Write Text Line to Text File" command (textWriteLine). This command writes a new line in the file, without needing to add any break line escape instruction, but it only writes one line at once.
    Another option is to use the "Write to File" command (writeToFile), using "Content" and "New line" parameters as needed.

    Hope it helps!

    Best regards



    ------------------------------
    Antonio Campos - WDG
    ------------------------------



  • 3.  RE: Line break "\n" is not working

    Posted Mon July 26, 2021 08:00 AM
    Hi Antonio, good day.
    WritetoFile is a good and elegant solution, thanks for your recommendation, problem solved.

    ------------------------------
    Mauro Sérgio
    ------------------------------