Reports - Text Controls: Format numbers as string

Reports - Text Controls: Format numbers as string

Peter2_1
Collaborator Collaborator
178 Views
2 Replies
Message 1 of 3

Reports - Text Controls: Format numbers as string

Peter2_1
Collaborator
Collaborator

The Help-file for the Reports tell me something like "to format numbers in text-controls use any definition from VB .NET-Format". Sounds great, but I failed ..

Searching the web I found a lot of code examples and also these sites:

https://www.thevbprogrammer.com/VB2010_04/04-01-FormattingNumbersDateStrings.htm

https://thedeveloperblog.com/string-format-vbnet

https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings

 

 

What do I have?

different numbers, from "0.5" to "12345.6789"

 

What do I want?

Display them with 4 digits and a separator for thousands, so

0.5  -> 0.5000

12345.6789 -> 12'345.6789

 

I tried:

- the standard definition with "0.0000" which creates

0.5  -> 0.5000

12345.6789 -> 12345.6789

- this "##'##0.0000" which creates

12345.6789 -> 12346##0.0000

- and finally ("N", en-US) with the result

12345.6789 -> (N en-US)

 

With "#,0.0000" I get

12345.6789 -> 12,345.6789

This looks fine at first moment, but due to my locale I need 12'345.6789

 

So what's the right way to format the numbers?

 

Thanks in advance!

AutoCAD Map 3D 2023 German / Oracle
0 Likes
Accepted solutions (1)
179 Views
2 Replies
Replies (2)
Message 2 of 3

Peter2_1
Collaborator
Collaborator

I think I found it:

##\'###\'##0.0000

 

Based on the information from here:

https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.strings.format?view=net-9.0

 

Edit:
I thought(!) I got it 😞

 

I also tried "\'0.0000", but now I get also an unwanted leading separator

12345.6789 -> '12'345.6789

 

A solution is still very welcomed

AutoCAD Map 3D 2023 German / Oracle
0 Likes
Message 3 of 3

Peter2_1
Collaborator
Collaborator
Accepted solution

solved, thanks to Autodesk Support:

#,##0.0000

Means:

  • #  : write the number when it exists. Write nothing, when nothing exists.
  • ,   : Use the standard thousand separator, defined in the windows region settings. This is also valid for "million / billion" separator
  • 0  : write the number when it exists. Write 0 when nothing exists.
AutoCAD Map 3D 2023 German / Oracle
0 Likes