Page 1 of 1

"+" character in a number-formatted text box

Posted: Tue Nov 08, 2022 1:28 pm
by Artimidor
Usually, when a text box has the text format "Number" and Decimal Digits 2, you get something like "13.34" as a result.

Now, if a character is put in front, the result is e.g. "A13.34" - so the format works, and the character is shown. However, if a plus-sign (+) is used instead of the character, this is eliminated whenever the number is positive (result: 13.34). If the number is negative I get "+-13.34". How is it possible to show e.g. "+13.34" and keep the text format a number? The idea would be to add a plus whenever the number is positive and if it is negative keep it as it is.

Re: "+" character in a number-formatted text box

Posted: Wed Nov 09, 2022 10:23 am
by Lech Kulikowski
Hello,

You can use the Format function:
{String.Format("+{0:N2}",Variable1)}

Thank you.

Re: "+" character in a number-formatted text box

Posted: Wed Nov 09, 2022 1:07 pm
by Artimidor
Yes, this works as intended (text format in this case has to be "General" of course). Thank you!

Re: "+" character in a number-formatted text box

Posted: Wed Nov 09, 2022 3:04 pm
by Lech Kulikowski
Hello,

You are welcome.