web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Trailing whitespaces are getting removed automatically

(1) ShareShare
ReportReport
Posted on 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 ?
      
I have the same question (0)
  • Adis Profile Picture
    5,772 Super User 2025 Season 2 on at
    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
  • Martin Dráb Profile Picture
    236,851 Most Valuable Professional on at
    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.
  • RB-11091252-0 Profile Picture
    6 on at
    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 756 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 678

#3
Martin Dráb Profile Picture

Martin Dráb 526 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans