• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

MS Reporting Services Currency Variable Type


Hello,

I've put a function in the report parameters code section where I want to set the value of some currency to 0.00 depending on the value from another field which has been passed in. It's wrapped inside a sum function in the expression so that only my revenues from product are calulated within the headers in each of my groups. Why can't I use the currency variable type inside of here? Next best thing is Double, but I'd rather show the exact amounts, plus i'd like to understand what's going on here. Here is there error I get when I try to use Currency:

There is an error on line 1 of custom code: [BC30389] 'System.Currency' is not accessible in this context because it is 'Private'.

Here is the function I'm trying to use, double works no problem but rounds it off

Public Function getDollarValue(ByVal Value As String, ByVal Dollar As Double) As Double
  Dim rtnVal As Double
      
  If Value = "Discount" Then
    rtnVal = 0.00
  ElseIf Value = "Freight" Then
    rtnVal = 0.00
  ElseIf Value = "Tax" Then
    rtnVal = 0.00
  Else
    rtnVal = Dollar
  End if

  Return rtnVal
End Function


thanks in advance
0
animated405
Asked:
animated405
  • 2
  • 2
1 Solution
 
simon_kirkCommented:
Not sure on the error message, but couldn't you use an expression within the textbox to determine what value is displayed?

Something like:

=IIF(Fields!MYFIELD.Value="Discount",0,IIF(Fields!MYFIELD.Value="Freight",0,IIF(Fields!MYFIELD.Value="Tax",0,Fields!MYFIELD2.Value)))

Or you could use the SWITCH function (http://msdn.microsoft.com/libr­ary/en-us/vblr7/html/vafctswit­ch.asp )
0
 
animated405Author Commented:

I figured you could but I wasn't getting the syntax correct for multiple statements because I didn't think you could just put several iif's together like that. I'm going to give that a shot
0
 
animated405Author Commented:

thanks, that works for a field where the value is a number, but I'm getting this error when I try to do it with the currency

The value expression for the textbox ‘textbox16’ uses an aggregate function on data of varying data types.  Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type.

my field is returned is money, why would it think that the rows contain varying data types?? I've tried changing the properties of the field in the report but to no avail
0
 
simon_kirkCommented:
Can you post the expression your using within the textbox?

MS stated this with regard to the error your getting:

" It is up to the data provider (e.g. managed SQL provider) how it translates database types into .NET datatypes. Generally, you can determine the runtime datatype of fields by temporarily adding a textbox to the report which shows the runtime datatype:
=First(Fields!SomeFieldName.Va­lue, "DataSetName").GetType.ToStrin­g "

0
 
mlmccCommented:
Thanks  animated405 for closing this question

mlmcc
Reporting Tools Page Editor
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now