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.
Author |
Topic |
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2004-10-18 : 16:30:38
|
Anyone know if this is possible. Do calculation from 2 or more fields in the Custom code section and then put it into a field. Here's the example.Public Function Gross(Value As String) As String Dim Sale = Field!Sale.Value Dim Gross = Field!Gross.Value If IsNumber(Value) Then Value = (Gross/Sale) * 100 Else Value = "Invalid" End IFEnd FunctionThis code doesn't work, because I'm not sure if it's possible to call values from different fields to do calculation. Can anyone shed some light here. Thanks. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-10-18 : 16:37:38
|
Just create a custom field for this. So you would create a calculated field. This would use an expression that uses an IIF statement to get the Invalid part. So in the fields section of your data set in VS, click Add, click calculated field, then type in your expression.Tara |
 |
|
chriskhan2000
Aged Yak Warrior
544 Posts |
Posted - 2004-10-18 : 16:47:07
|
Wow. I'm learning so much from you Tara. Didn't know I can just do that. Just gotta figure out the logic in this little conditional expression. Thanks. |
 |
|
|
|
|