Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Need Help putting negative values in between(-12)

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-02-04 : 12:04:03
Hi Group:

I need help on using the following expression. I need a report that put parenthesis around a negative amount for example (-2,398).

Here is what I have done so far, but is giving me this error

=IIF(Fields!Imbalance.Value)>"0", "BLACK","((Fields!Imbalance.Value))")
or
=IIF(Fields!Imbalance.Value)> 0, "BLACK","((Fields!Imbalance.Value))")


contains an error: [BC30455] Argument not specified for parameter 'FalsePart' of 'Public Function IIf(Expression As Boolean, TruePart As Object,
The value expression for the textbox ‘Imbalance’ contains an error: [BC30205] End of statement expected. or this other Error

And if I try to write this in Report Properties Code. I get this error
There is an error on line 0 of custom code: [BC30035] Syntax error.
IF (Fields!Imbalance.Value)> 0
Then "BLACK"
Else "((Fields!Imbalance.Value))"
End IF

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-04 : 12:07:32
Right click the cell containing this value and define a custom format for it in format tab as

"#,##0;(-#,##0)"
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-02-04 : 12:20:02
Thank so much visakh16....Looks like it work. Thanks, let me try running the report. To be continue....:):):):)
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-02-04 : 12:23:23
Visakh16---OOOoopppss, not quite, here are the results after running the report. Any other idea :) Thanks,


1 299,353.00 12,738.00 286,615.00 2,778.00 #,##0;(-#,##0)
2 270,193.00 11,528.00 258,665.00 1,524.00 #,##0;(-#,##0)
3 269,356.00 11,477.00 257,879.00 1,535.00 #,##0;(-#,##0)
4 269,356.00 11,477.00 257,879.00 1,534.00 #,##0;(-#,##0)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-04 : 12:50:36
Try this too:-
give
IIF(Me.Value>=0,"#,##0","(-#,##0)")
inside format input box
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2008-02-04 : 15:14:30
Hi Group:

To help others and to be thankful for all your help. Here is how you write Negative numbers using parenthesis. Just like Accounting terms.

You put this formula inside the expresion cell or textbox that you are using in your Report.

=IIF((Fields!Imbalance.Value )> 0, (Fields!Imbalance.Value), "(" + cstr( Fields!Imbalance.Value) + ")")

Good Luck !!!!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-05 : 00:03:49
"#,##0;(-#,##0)" format code is working for me. I've checked it now.
Go to Top of Page
   

- Advertisement -