Showing posts with label decimals. Show all posts
Showing posts with label decimals. Show all posts

Wednesday, March 28, 2012

Numeric Formatting

How can I achieve the following:
I'd like negative numbers to be enclosed in brackets and the decimals to
lign up (vertically) with the positive numbers (right justified).
I have used, Format ="#,##0.00 ;(#,##0.00); ", but the space is trimmed. Any
ideas ?
Thanks,
ClaudeI am not in front of Visual Studio so I cannot test this...
My idea is that you could use an expression to alter the right padding of
the numbers. If they are <0 then 2pt else 4pt (or whatever the width of the
bracket).
This is a little hackish because if you ever change the font, size or
anything that padding would change.
"Claude" <Claude@.discussions.microsoft.com> wrote in message
news:AC41BE0F-895D-4C2C-A1CA-0309F18A29EC@.microsoft.com...
> How can I achieve the following:
> I'd like negative numbers to be enclosed in brackets and the decimals to
> lign up (vertically) with the positive numbers (right justified).
> I have used, Format ="#,##0.00 ;(#,##0.00); ", but the space is trimmed.
> Any
> ideas ?
> Thanks,
> Claude|||You are spot on Joe. Thanks for the help.
Claude
"Joe L" wrote:
> I am not in front of Visual Studio so I cannot test this...
> My idea is that you could use an expression to alter the right padding of
> the numbers. If they are <0 then 2pt else 4pt (or whatever the width of the
> bracket).
> This is a little hackish because if you ever change the font, size or
> anything that padding would change.
>
> "Claude" <Claude@.discussions.microsoft.com> wrote in message
> news:AC41BE0F-895D-4C2C-A1CA-0309F18A29EC@.microsoft.com...
> > How can I achieve the following:
> >
> > I'd like negative numbers to be enclosed in brackets and the decimals to
> > lign up (vertically) with the positive numbers (right justified).
> >
> > I have used, Format ="#,##0.00 ;(#,##0.00); ", but the space is trimmed.
> > Any
> > ideas ?
> >
> > Thanks,
> > Claude
>
>

numeric data types

Hi,

I have a lot of decimals in the flat files. So far the largest numbers map to a numeric(18,6).

My question is, is DT_NUMERIC the correct datatype for this data? In which case, what size do I need to set it? Right now it's 18. Couldn't find much info on this.

Thanks

DT_NUMERIC is correct. For the example you've given, set precision to 18 and scale to 6.|||SSIS data types: http://msdn2.microsoft.com/en-us/library/ms141036.aspx|||Is there a trick to doing this? I tried 18,6 and it said it was invalid.|||

More precisely, the error is:

18,6 is not a valid value for Int32.

I have DT_NUMERIC selected as data type.

|||

Have you set 18 in the precision box and 6 in the scale box or "18,6" in a single box? 18 and 6 are separate attributes.

Thanks.

sql

Monday, March 19, 2012

number formatting w/in charts and colors

1) How do you format numbers within charts. My numbers are currently without
commas (ex. 20000) and decimals with no formattting ( example: 679.8906890).
I would like them to be prettier with commas ( 20,000) and just 2 decimal
places ( 679.89) , respectively.
2) How do I assign colors to certain data values on my charts?
Please help...thank you.
Sincerely,
AllisonOn your first question: Pull up Chart properties dialog, go to Y-axis tab,
and type in c2 for Format Code.
On your second question: Pull up Chart properties dialog, go to Data tab ->
Edit button -> Point Labels tab -> Check Show Point Labels checkbox -> Click
on the Label Style button. You can then choose color, font, etc. for your
data labels. You can use an expression for Color as follows: =iif(
Fields!UnitPrice.Value <= 400.0, "Orange", "Green")
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ha Vo" <ha.vo@.prometheuslabs.com> wrote in message
news:OMhiwxLdEHA.2408@.tk2msftngp13.phx.gbl...
> 1) How do you format numbers within charts. My numbers are currently
without
> commas (ex. 20000) and decimals with no formattting ( example:
679.8906890).
> I would like them to be prettier with commas ( 20,000) and just 2 decimal
> places ( 679.89) , respectively.
> 2) How do I assign colors to certain data values on my charts?
> Please help...thank you.
> Sincerely,
> Allison
>

Monday, March 12, 2012

Number format to return 0 when empty?

My client has several issues with the number formating in the reports.
They want to have a space between 1 000 and no decimals. First I created a
custom format, but today I noticed I could get the same result with N0.
Anyway, N0 format will not show empty numbers, it just leaves the cell
blank. But my client now wants to have a 0 instead of blank. Is it possible?
Kaisa M. LindahlTry using =IIF(<Your number field> Is Nothing, 0, <Your number field>) as
the value expression.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kaisa M. Lindahl" <kaisaml@.hotmail.com> wrote in message
news:e$Sm76V%23EHA.2076@.TK2MSFTNGP15.phx.gbl...
> My client has several issues with the number formating in the reports.
> They want to have a space between 1 000 and no decimals. First I created a
> custom format, but today I noticed I could get the same result with N0.
> Anyway, N0 format will not show empty numbers, it just leaves the cell
> blank. But my client now wants to have a 0 instead of blank. Is it
> possible?
> Kaisa M. Lindahl
>|||Yes, I've figured that one out.
Problem is, I'd have to do it on aprox. 20 cells in each report (> 10 so
far), all with different field names... If there are any other solutions,
I'd be very happy to hear it.
Kaisa M. Lindahl
"Fang Wang (MSFT)" <fangw@.microsoft.com> wrote in message
news:u907lUd#EHA.936@.TK2MSFTNGP12.phx.gbl...
> Try using =IIF(<Your number field> Is Nothing, 0, <Your number field>) as
> the value expression.
> --
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Kaisa M. Lindahl" <kaisaml@.hotmail.com> wrote in message
> news:e$Sm76V%23EHA.2076@.TK2MSFTNGP15.phx.gbl...
> > My client has several issues with the number formating in the reports.
> > They want to have a space between 1 000 and no decimals. First I created
a
> > custom format, but today I noticed I could get the same result with N0.
> > Anyway, N0 format will not show empty numbers, it just leaves the cell
> > blank. But my client now wants to have a 0 instead of blank. Is it
> > possible?
> >
> > Kaisa M. Lindahl
> >
> >
>|||I'm sorry, but there is no "easier" solution than using IIF for this
scenario.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Kaisa M. Lindahl" <kaisaml@.hotmail.com> wrote in message
news:ORxJ1Jh%23EHA.3988@.TK2MSFTNGP11.phx.gbl...
> Yes, I've figured that one out.
> Problem is, I'd have to do it on aprox. 20 cells in each report (> 10 so
> far), all with different field names... If there are any other solutions,
> I'd be very happy to hear it.
> Kaisa M. Lindahl
> "Fang Wang (MSFT)" <fangw@.microsoft.com> wrote in message
> news:u907lUd#EHA.936@.TK2MSFTNGP12.phx.gbl...
> > Try using =IIF(<Your number field> Is Nothing, 0, <Your number field>)
as
> > the value expression.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
> > "Kaisa M. Lindahl" <kaisaml@.hotmail.com> wrote in message
> > news:e$Sm76V%23EHA.2076@.TK2MSFTNGP15.phx.gbl...
> > > My client has several issues with the number formating in the reports.
> > > They want to have a space between 1 000 and no decimals. First I
created
> a
> > > custom format, but today I noticed I could get the same result with
N0.
> > > Anyway, N0 format will not show empty numbers, it just leaves the cell
> > > blank. But my client now wants to have a 0 instead of blank. Is it
> > > possible?
> > >
> > > Kaisa M. Lindahl
> > >
> > >
> >
> >
>

number format to 2 decimals

How can I format my data to 2 decimal numbers in sql ?
select numericColumn from table1
ex :-
numericColumn
10.22
20.00
30.45
12.02
regards
ypul
ypul wrote:
> How can I format my data to 2 decimal numbers in sql ?
> select numericColumn from table1
> ex :-
> numericColumn
> --
> 10.22
> 20.00
> 30.45
> 12.02
> regards
> ypul
What data type are you using in the table?
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||numericcolumn datatype is float
ypul
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:%23cf2O3PnFHA.2472@.TK2MSFTNGP15.phx.gbl...
> ypul wrote:
> What data type are you using in the table?
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
|||ypul wrote:
> numericcolumn datatype is float
> ypul
>
Probably using the wrong data type. Why have you chosen to use an
approximate data type like float/real instead of DECIMAL/NUMERIC which
stores an exact represenation of a number? Do you really need to store.
From BOL:
"Approximate number data types for use with floating point numeric data.
Floating point data is approximate; not all values in the data type
range can be precisely represented."
If you either must use a float or cannot change the data type to
something more appropriate, you have two options:
1- Format the numeric data on the client - client formatting is
preferred over using SQL Server to do the same
2- Use the CAST function, but you may have to deal with rounding issues
For example:
Declare @.f real
Set @.f = .05
Select @.f -- Returns 5.5500001E-2
Select CAST(@.f as NUMERIC(10, 2)) -- Returns .06
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||Thanks Buddy
that was very very .....helpful !!
ypul
"David Gugick" <david.gugick-nospam@.quest.com> wrote in message
news:e8NGR%23SnFHA.2860@.TK2MSFTNGP15.phx.gbl...
> ypul wrote:
> Probably using the wrong data type. Why have you chosen to use an
> approximate data type like float/real instead of DECIMAL/NUMERIC which
> stores an exact represenation of a number? Do you really need to store.
> From BOL:
> "Approximate number data types for use with floating point numeric data.
> Floating point data is approximate; not all values in the data type
> range can be precisely represented."
> If you either must use a float or cannot change the data type to
> something more appropriate, you have two options:
> 1- Format the numeric data on the client - client formatting is
> preferred over using SQL Server to do the same
> 2- Use the CAST function, but you may have to deal with rounding issues
> For example:
> Declare @.f real
> Set @.f = .05
> Select @.f -- Returns 5.5500001E-2
> Select CAST(@.f as NUMERIC(10, 2)) -- Returns .06
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>