Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Trailing whitespaces a...
Finance forum
Unanswered

Trailing whitespaces are getting removed automatically

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 ?
      
  • RB-11091252-0 Profile Picture
    RB-11091252-0 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.
  • Martin Dráb Profile Picture
    Martin Dráb 228,552 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.
  • Adis Profile Picture
    Adis 2,305 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

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans