Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-07-2009
Member
 
Join Date: Mar 2009
Posts: 49
SSRS formatting numbers

I am making a report where i have to put numbers for showing profit & loss... I am using SQL Server Reporting Services(SSRS). For example : 224308.81 Does anyone know how to do it..???? Please Help....!
Reply With Quote
  #2  
Old 06-07-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: SSRS formatting numbers

I have made a code for it just put it in the CODE Window... For going into the ODE Windows Firstly go to REPORT then go to REPORT PROPERTIES & then go to CODE Window....!

Code:
ADD this code there :

Public Function FormatIndian(ByVal Amount As decimal) As String  
Dim strAmount As String
Dim strGrpsArr() As String
Dim lngPos As Long
Dim lngIndex As Long

   strAmount = Format$(Amount, "#")
   If Len(strAmount) < 4 Then
      FormatIndian = strAmount
   Else
      lngIndex = (Len(strAmount) - 2) \ 2
      ReDim strGrpsArr(lngIndex)
     
      strGrpsArr(lngIndex) = Mid$(strAmount, Len(strAmount) - 2)
     
      lngPos = Len(strAmount) - 4:  lngIndex = lngIndex - 1
      Do
         strGrpsArr(lngIndex) = Mid$(strAmount, lngPos, 2)
         lngPos = lngPos - 2:       lngIndex = lngIndex - 1
         If lngPos = 0 Then strGrpsArr(0) = Left$(strAmount, 1)
      Loop Until lngPos <= 0
     
      FormatIndian = Join(strGrpsArr, ",")
      Erase strGrpsArr
   End If
End Function

After that you need to add the following expression in the text box :

Code:
=code.FormatIndian(Fields!AMOUNT.Value)
Reply With Quote
  #3  
Old 06-07-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: SSRS formatting numbers

I think firstly you need to know how to tell the formatting for negative numbers and positive numbers. The formula becomes to be #,##0;(#,##0). The Main key here is semicolon that differentiate positive from negative. It is that the left is positive & right is negative.
Reply With Quote
  #4  
Old 06-07-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: SSRS formatting numbers

Try this which may help you..... Just try to put the following Expression in Text box :

Code:
=IIF(Rownumber(Nothing) = 1, N, P2)
See if it works for you....!
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "SSRS formatting numbers"
Thread Thread Starter Forum Replies Last Post
How to change negative numbers to positive numbers in Excel Shaina Na Microsoft Project 3 08-01-2012 05:35 PM
Project Server 2007 and SSRS Poonam_YC Networking & Security 1 13-09-2010 06:45 PM
Implementing SSRS in Silverlight 4 Obama P Software Development 5 05-08-2010 09:29 AM
Need C program code to count numbers of negative & positive numbers Sarfaraj Khan Software Development 5 16-01-2010 02:00 PM
SQL Query for Searching Missing Numbers from Sequence of Numbers Bhagwandas Software Development 3 18-02-2009 01:47 PM


All times are GMT +5.5. The time now is 08:14 PM.