Page 1 of 2

Inline formatting of currency in expression of text box

Posted: Fri Apr 29, 2011 5:20 pm
by brobar
I have a text component that has a paragraph of text that I'm displaying and has a database variable in the text that displays a total monetary value. Here is an example:

The expression in my text box is:
PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of {quoteTable.projTotal} for the Equipment and Services, due in installments as follows:
So you can see the quoteTable.projTotal value being pulled from the database and injected into the text box, which comes out looking like this:

PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of 343096.92 for the Equipment and Services, due in installments as follows:

However I need to format that quoteTable.projTotal value into a currency format so it would look like this:

PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of $343,096.92 for the Equipment and Services, due in installments as follows:

Is there a function that I could use inline in the expression of this text box that would format that value into currency?

Thanks for the assistance!


Inline formatting of currency in expression of text box

Posted: Tue May 03, 2011 4:27 am
by Vladimir
Hello,

You can use the following expression:

Code: Select all

PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of {Format("{0:C}", quoteTable.projTotal)} for the Equipment and Services, due in installments as follows:
Thank you.

Inline formatting of currency in expression of text box

Posted: Tue May 03, 2011 10:26 am
by brobar
Vladimir wrote:Hello,

You can use the following expression:

Code: Select all

PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of {Format("{0:C}", quoteTable.projTotal)} for the Equipment and Services, due in installments as follows:
Thank you.
Thanks for the reply. That got me much closer. It is now spitting out.

PAYMENT TERMS: Buyer shall pay Seller the cash purchase price of $343 096.92 for the Equipment and Services, due in installments as follows:

So it added the dollar sign to the left like it should but for some reason it adds a space where the comma should be. Is there any way to tweak that Format function to where it uses a comma "," instead of a space " " so it would spit out $343,096.92 instead of $343 096.92?

Thanks again. I really appreciate the assistance.

Inline formatting of currency in expression of text box

Posted: Tue May 03, 2011 11:00 am
by brobar
Same thing happens if I use {Format("{0:N}", quoteTable.projTotal)} replacing the C with an N. Of course that won't give me the ($) dollar sign but I just wanted to see if it would format the number with commas and it doesn't. It spits it out as: 343 096.92. Any idea why it wouldn't be utilizing commas for currency or number formats? Is this a locale thing that I can change within stimulsoft or is it possibly a locale thing within my web server? If this is a server issue and not a application issue... any idea where I can check locale settings on a MAMP server to get that corrected?

Thanks,

*** EDIT ***
I checked the languages & text formats on my Mac and they are set correctly to the US Dollar and show that it should format correctly with the dollar sign AND comma so it isn't that:
Image

Any other ideas?

Inline formatting of currency in expression of text box

Posted: Wed May 04, 2011 8:50 am
by Vladimir
Hello,

In the future, inline-formatting will be expanded. As an alternative, currently you can use the following expression:

{Replace(Format("{0:N}", quoteTable.projTotal), " ", ",")}

Thank you.

Inline formatting of currency in expression of text box

Posted: Wed May 04, 2011 3:20 pm
by brobar
Vladimir wrote:Hello,

In the future, inline-formatting will be expanded. As an alternative, currently you can use the following expression:

{Replace(Format("{0:N}", quoteTable.projTotal), " ", ",")}

Thank you.
Perfect! Works like a charm! Thanks so much!

Inline formatting of currency in expression of text box

Posted: Tue May 10, 2011 10:11 pm
by Andrew
Hello,

Great!

If you have any other questions regarding Stimulsoft Reports products then please let us know.

Thank you.

Re: Inline formatting of currency in expression of text box

Posted: Wed Jun 10, 2020 4:52 pm
by alex.coles
Is there any way to use the local setting, as you would with a standard currency field? I'm always seeing $ instead of my local currency. When using a standard currently field ticking Use Local Setting gives me the correct currency.

Re: Inline formatting of currency in expression of text box

Posted: Mon Jun 15, 2020 6:37 am
by Lech Kulikowski
Hello,

Could you explain your issue in more detail?

Also, please clarify which product and version are you use?

Thank you.

Re: Inline formatting of currency in expression of text box

Posted: Thu Oct 15, 2020 4:05 pm
by alex.coles
I am using the following as an expression:

Code: Select all

Was: {Format("{0:C}", data_items.price)}
but it comes out as

Code: Select all

Was: $2.49
on the report.

I have other fields that are numeric and set to type 'Currency' with the 'Use Local' property set to true and they show '£' correctly (without the Local property they revert to '$' so suspect this is not being used in the inline conversion).

Stimulsoft.Reports.JS
Version: 2019.4.2
Build date: 2019.11.13