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
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 Custom Code - For Numeric Filter

Author  Topic 

tech2
Yak Posting Veteran

51 Posts

Posted - 2014-11-24 : 10:03:28
I'm trying to modify the Custom Code below to identify all values equal too or less than '2', to be 'True' otherwise 'False'

Public Function NotLike(ByVal val As String, ByVal filter As String)As Boolean

If val.Contains(filter) Then

Return False

Else

Return True

End If

End Function

Calling with - =code.NotLike(ReportItems!DaysDiff.Value, “ld”)

Thanks You!

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-24 : 11:18:30
Something like this (untested):

Public Function NotLike(ByVal val As String, ByVal filter As String)As Boolean

If val.Contains(filter) Then

Return False

End If

Dim intVal as Integer

If Not Integer.TryParse(val, intVal) Then
Return False
End If

If IntVal <= 2 Then
Return True
End If

Return False

End Function
Go to Top of Page

tech2
Yak Posting Veteran

51 Posts

Posted - 2014-11-24 : 12:29:50
Thanks for the reply.

Unfortunately, the code is not working.

I get a message 'End of statement expected'
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-24 : 20:38:40
Told you it was untested! However, I loaded the function into Visual Studio and it runs fine. So, it's not the function. Must be something else in your report. Or, you didn't copy the function exactly.
Go to Top of Page
   

- Advertisement -