Distorted TXT Data when exporting via dataport (Hidden charachters problem)

Hello everyone,
I am exporting the customer table with a dataport.
How can I clean the data with code before exporting from the Carriage Returns and Line Feeds into fields like Invoice Numbers, Addresses, Names, etc?
I will appreciate your help very much.

Answers

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-08-03
    Make a function CleanseText:
    CleanseText(InputText : Text1024) : OutputText : Text1024
    WhiteChars :  Text[30] //local var
    WhiteChars := '    '; //4 spaces in here
    WhiteChars[1] := 9;  
    WhiteChars[2] := 10;
    WhiteChars[3] := 13;
    WhiteChars[4] := 255; //thousands separator in NAV
    
    OutputText:= CONVERTSTR(InputText, WhiteChars, '    ');  //4 spaces in 3rd parameter
    OutputText := DELCHR(OutputText , '<>', ' ');
    
    Then in OnBeforeExport pass all text fields through the function. Or use the function directly in source expression
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.