Skip to main content
Business Central forum
Suggested answer

How to delete special charatcters while importing txt file

editSubscribe (0) ShareShare
ReportReport
Posted on by UG Leader

I am trying to import txt file and iam getting an error

pastedimage1671686919769v1.png

And I tried to delete this character in the XML port and iam getting different error 

pastedimage1671687262089v1.png

 trigger OnOpenPage()
    var
        String: Text;
        Where: Text;
        Which: Text;
        NewString: Text;
        Text000: label 'Achtung';
        Text001: Label '>%1< is transformed to >%2<';
    begin
        String := Text000;
        Where := '<>';
        Which := '';
        NewString := DelChr(String, Where, Which);
        Message(Text001, String, NewString);
    end;

How can i remove this 2 ''  character while importing XML file any help will be great, Thanks in Advance.

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: How to delete special charatcters while importing txt file

    Its working on open page

    but  during the import its still the same error

    i have added in on trigger OnAfterGetRecord()

    but here no record is getting so its not working is there any  other alternative solutions for  it.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: How to delete special charatcters while importing txt file

    Try this.

    keepTxtChars := '''';

    DELCHR(string,'=',keepTxtChars)

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: How to delete special charatcters while importing txt file

    Thanks the quick response Nitin Verma Yes, I tried This on XML port on trigger after get record but still the error pops up

  • Suggested answer
    pankaj.k Profile Picture
    pankaj.k 960 on at
    RE: How to delete special charatcters while importing txt file

    Hi sainudheen,

    Please check the below link that will help you to How to work All String  Function.....

    https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/text/text-delchr-method

    https://learn.microsoft.com/en-us/dynamics-nav/delchr-function--code--text-

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: How to delete special charatcters while importing txt file

    Yes its blank as a string, you can not remove blank if you wan to remove try this

    keepTxtChars := ‘1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’;

    newstring := DELCHR(string,’=’,DELCHR(string,’=’,keepTxtChars));

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: How to delete special charatcters while importing txt file

    In the code I have written this when copied the code it shows as blank.

    tw.jpg

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: How to delete special charatcters while importing txt file

    but this string Text000: label 'Achtung'; does not have '', how you can remove that?

  • Community Member Profile Picture
    Community Member UG Leader on at
    RE: How to delete special charatcters while importing txt file

    This is my code I have written and I have my XML ,table, page, Iam trying to test this code on open page if it works there then i will add it on the XML port on after get record,

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 20,984 Super User on at
    RE: How to delete special charatcters while importing txt file

    Hi,

    Please share your complete code.

    Thanks.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Sundar…

Industry experts answer burning questions directly from our amazing Community…

Enabling Copilot Case and Conversation…

Agents can easily recap an ongoing chat, transcribe a voice conversation…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 282,978 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans