Skip to main content
Post a question

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Trailing whitespaces are getting removed automatically

Like (1) ShareShare
ReportReport
Posted on 11 Sep 2024 13:02:46 by 6
My requirement is based on D365 F&O to add multiple additional spaces at end of string value and later I am exporting it in xml.
         
Somehow only single space is coming in the output but while debugging I can see multiple spaces getting added as per code. Even if I'm trying to add in between same is happening
 
Code snippet:
value = "Test";
paddedvalue = value + strRep(" ",10) + "*";
 
Expected Value = Test          *
Output = Test *
 
I am using visual studio 2019 to write code.
Is there any feature automatically trimming the whitespaces or I'm missing any thing ?
      
  • RB-11091252-0 Profile Picture
    RB-11091252-0 6 on 12 Sep 2024 at 05:03:00
    Trailing whitespaces are getting removed automatically
    Hi Martin,
    I'm checking the output in XML and info log.
    For info log output I'm using code:
    info(paddedvalue); or info(strfmt("%1*",paddedvalue));
     
    In both outputs spaces are getting trimmed.
  • Martin Dráb Profile Picture
    Martin Dráb 230,575 Most Valuable Professional on 11 Sep 2024 at 16:49:27
    Trailing whitespaces are getting removed automatically
    How are you checking the result? Are you looking at the actual XML code in a text editor?
     
    I'm asking because if you use a view that displays XML in HTML, spaces are suppressed there.
  • Adis Profile Picture
    Adis 2,428 on 11 Sep 2024 at 16:32:21
    Trailing whitespaces are getting removed automatically
    Hey,
     
    I am not a developer, so sorry if the suggestion is noob. However, have you tried to use Char(32) for space and Char(160) for non braking space?
     
    If you are creating a report, check if there are report properties like the following f.e.
     
     
    Kind regards, Adis

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,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,575 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans
Loading complete