Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

How to delete special charatcters while importing txt file

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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 Microsoft Employee 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 21,091 Super User 2024 Season 1 on at
    RE: How to delete special charatcters while importing txt file

    Try this.

    keepTxtChars := '''';

    DELCHR(string,'=',keepTxtChars)

  • Community Member Profile Picture
    Community Member Microsoft Employee 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 962 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 21,091 Super User 2024 Season 1 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 Microsoft Employee 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 21,091 Super User 2024 Season 1 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 Microsoft Employee 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 21,091 Super User 2024 Season 1 on at
    RE: How to delete special charatcters while importing txt file

    Hi,

    Please share your complete code.

    Thanks.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans