Monday, March 12, 2012

pls help with expression question

I am converting reports from business objects to reporting services. In
business objects they have a variable called ERRORS created with the
expression
= If (<Value> InList (12 , 500 , 501 , 502 , 503 , 504 , 505 , 530 , 550))
Then 1 Else 0
<value> is a field returned from a stored procedure (so cant do this in the
sql) ... how can I create this field in reporting services? I know I can
create a calculated field and was thinking about IIF(Fields!Value.value
InList( .... ), 1, 0) but I cant use InList and I am not that good with VB
so looking for suggestions. Thanks!MJT, Here's some vb code that I think will work for that.
Public Function InKnownErrors(ByVal ErrorNumber As Int32)
Dim ReturnVal As Int32 = 0
Dim ErrorList() As Int32 = {12, 500, 501, 502, 503, 504, 505, 530,
550}
If Array.BinarySearch(ErrorList, ErrorNumber) >= 0 Then
ReturnVal = 1
End If
Return ReturnVal
End Function
Expression:
=Code.InKnownErrors(450)
"MJT" <MJT@.discussions.microsoft.com> wrote in message
news:6000B282-6685-4FC1-ABE7-B1F59EAE7544@.microsoft.com...
>I am converting reports from business objects to reporting services. In
> business objects they have a variable called ERRORS created with the
> expression
> = If (<Value> InList (12 , 500 , 501 , 502 , 503 , 504 , 505 , 530 ,
> 550))
> Then 1 Else 0
> <value> is a field returned from a stored procedure (so cant do this in
> the
> sql) ... how can I create this field in reporting services? I know I can
> create a calculated field and was thinking about IIF(Fields!Value.value
> InList( .... ), 1, 0) but I cant use InList and I am not that good with
> VB
> so looking for suggestions. Thanks!
>|||Thanks Steve for the code example. I wish I could come up with those that
quickly ... someday ...
I was able to get the InStr function to work this way in the textbox:
=IIF(Instr("12 , 500 , 501, 502, 503, 504, 505, 530, 550",
Fields!Value.Value ), 1, 0)
it seems to be working so far. I am checking out the accuracy of the result
now...
so I am grateful to have a backup plan ... thanks!
"Steve MunLeeuw" wrote:
> MJT, Here's some vb code that I think will work for that.
> Public Function InKnownErrors(ByVal ErrorNumber As Int32)
> Dim ReturnVal As Int32 = 0
> Dim ErrorList() As Int32 = {12, 500, 501, 502, 503, 504, 505, 530,
> 550}
> If Array.BinarySearch(ErrorList, ErrorNumber) >= 0 Then
> ReturnVal = 1
> End If
> Return ReturnVal
> End Function
> Expression:
> =Code.InKnownErrors(450)
>
> "MJT" <MJT@.discussions.microsoft.com> wrote in message
> news:6000B282-6685-4FC1-ABE7-B1F59EAE7544@.microsoft.com...
> >I am converting reports from business objects to reporting services. In
> > business objects they have a variable called ERRORS created with the
> > expression
> > = If (<Value> InList (12 , 500 , 501 , 502 , 503 , 504 , 505 , 530 ,
> > 550))
> > Then 1 Else 0
> >
> > <value> is a field returned from a stored procedure (so cant do this in
> > the
> > sql) ... how can I create this field in reporting services? I know I can
> > create a calculated field and was thinking about IIF(Fields!Value.value
> > InList( .... ), 1, 0) but I cant use InList and I am not that good with
> > VB
> > so looking for suggestions. Thanks!
> >
>
>

No comments:

Post a Comment