Format Decimals in MessageBox - Align Right

Hi All It’s time for another Format - question [xx(]. I want to show some decimals in a message box like: xxx:1.000.000,00 yyy:75.000,00 Is it possible to get an result like this: xxx: 1.000.000,00 yyy: 75.000,00 I tried to add an empty string for each missing sign at the lower amount. But this isn’t really a solution because the Windows font (Arial) doesn’t show the expected result. The result is this [:(!]: xxx: 1.000.000,00 yyy: 75.000,00 Is it possible to format a string in a message box with align=right? Or are there any other suggestions[?] TIA bye André

Hi Andre, I’m afraid you’re out of luck on this one - well, maybe you could try and do the whole thing in Excel [:D] The problem is that you do not just want right-aligned text, but text that is aligned on both sides (what’s “Blocksatz” in English[?] “block format”?). Using a proportional font like Arial, this is going to be a rather hard task - you will need to retrieve each character’s screen width from the font’s metric and fill in spaces as required into the lines that will show shorter than the longest line. If you settle for right-aligned text, you can concatenate two right-aligned texts of the same length, separated by ‘’, into a single string. The result is not too satisfying, though [xx(]

Hi Heinz

quote:


Originally posted by xorph
… I’m afraid you’re out of luck on this one …


It seems so [:(].

quote:


… well, maybe you could try and do the whole thing in Excel [:D] …


Hear I an ironic undertone [}:)]? I would try this if the font in the Excel messagebox would not the same as in the Navision messagebox [8D]. Just an idea: write the decimals into a HTML file with a table (Align=RIGHT) and run the IE to show the formated figures. It should work [:D][8D]. (not tested it - honestly!! [^]) bye André

quote:


Originally posted by Andre DDB
Just an idea: write the decimals into a HTML file with a table (Align=RIGHT) and run the IE to show the formated figures.


If you really do consider this option, you might as well do it in Excel. Saves you from searching for a temporary directory to store this pesky HTML-file, for which you would have to think up a name to begin with [:D]

Hi You could try this Var1 := FORMAT(val1); Var1 := COPYSTR(‘Stringofspaces’,1,20-STRLEN(Var1)) + Var1; Where 20 is the max length of the string. ‘Stringofspaces’ is of course just a string full of at least 20 (or the Max) spaces but web browsers don’t show multiple spaces. Paul Baxter

Hello there, instead of displaying the values in a message box, which anyway has an “emergency feel”, you could create a small form with the relevant text boxes to hold your data, to be modally run. Pelle

MESSAGE(‘Number %1’, format(1.0, 10, ‘<Precision,2:2><Standard format,0>’)); Best regards from bcn.

Hi I solved this problem with showing underlines instead of spaces. xxxtxt:= FORMAT(xxx,0,'<Precision,2:2><Standard format,0>'); yyytxt:= FORMAT(yyy,0,'<Precision,2:2><Standard format,0>'); IF STRLEN(yyytxt) > STRLEN(xxxtxt) THEN BEGIN REPEAT IF (STRLEN(xxxtxt) = 6) OR (STRLEN(xxxtxt) = 10) THEN xxxtxt:= '.'+xxxtxt ELSE xxxtxt:= '_'+xxxtxt; UNTIL STRLEN(yyytxt) = STRLEN(xxxtxt); END ELSE IF STRLEN(xxxtxt) > STRLEN(yyytxt) THEN BEGIN REPEAT IF (STRLEN(yyytxt) = 6) OR (STRLEN(yyytxt) = 10) THEN yyytxt:= '.'+yyytxt ELSE yyytxt:= '_'+yyytxt; UNTIL STRLEN(xxxtxt) = STRLEN(yyytxt); END; MESSAGE('bank account balances:\'+ '-----------------------\'+ 'yyy : '+yyytxt+'\'+ 'xxx : '+xxxtxt); If xxx = 4,50 and yyy = 27.549.647,61 the message is (nearly!): bank account balances: ----------------------- yyy : 27.549.647,61 xxx : __.___.__4,50 It is not really nice but much better than the ‘jumping’ amounts with or without spaces. bye André