Skip to main content

Hi,

 

I need to create a string containing a number formatted as currency, for example:

 

"This is my string containing my formatted number: $ 651,226.00"

 

The number is a calculation and is formatted as desired (currency, 2 decimal places, prefix $ etc.). Though when I concatenate the strings the formatting disappears and the string will become:

 

"This is my string containing my formatted number: 65122600"

 

The only solution I was able to come up with so far is to create two different fields: one field contains only the string and another field containing only the number (which can be formatted as desired). Then both fields are dropped into the text mark of the view. I needed to create a field also for the text only because the content of it depends on a parameter.

 

This works fine when there are only a few strings and numbers, but it would be very time consuming for a string containing several numbers.

 

Do you have any idea how this can be achieved in a more efficient way?

Thanks for any advice

Rossella

16 risposte
  1. 20 set 2013, 23:15

    Well sort of, but it ain't pretty and it will probably be pretty slow. You'll need to parse your number to build it as a string. So if your number was 70000 and you wanted 70,000 then you'd write this:

     

    LEFT(STR([My_Number]), 2) + ',' + RIGHT(STR([My_Number]), 3)

     

    But then you're going to need to add a bunch of logic using LEN() to determine how long the number is and then build the string accordingly. You'll also need to search for any decimals FIND([My_Number], '.') and then subtract this from LEN() to get the proper number of decimal places. It all very tedious and can get complicated very quickly.

     

    --Shawn

0/9000