August 29, 2009 at 8:43 am
Hi Friends ,
I need to hide a columns based on a value.
The report has multivalued prameter StudentName the values say "Anil" ,"Anil Kumar" , "Nithin" ,"Riju" etc
Now in the report I have the columns which shows some details of these student names ,say the column names are Anil_Details ,Anil_Kumar_Details , Nithin_Details etc .
The requirement is I need to show those students details which are selected by the multi select parameter .
ie If I select "Anill" alone the report need to show Anil_Detils column only , If I select "Anil" and "Anil Kumar" the report need to show the corresponding two columns .
The way I tried : In the column hide property I gave the expresion as
=not(join(Prameter!StudentName .Values,",") like "*Anil*") -- for the column Anil_details ,
=not(join(Prameter!StudentName .Values,",") like "*Anil Kumar*) -- for the column Anil_Kumar_Details etc..
But because of this like "**" the report was not hiding the columns correctly , I also tried with like"*Anil" but still it was not working as expected.
Can any one help me to get it resolved...? Is there is any option to check a string within the given string ..?
Or something like patindex , but I think the patindex wont work since the name Anil and Anil Kumar both will give patindex > 0 if I serach with string Anil.
Please help.
Regards,
MC
Thanks & Regards,
MC
August 31, 2009 at 1:35 am
Hi,
Use the below VB.Net code in Report ? Report Properties ? Code
Public Function TestFunction(ByVal Names() As Object, ByVal CompareString As String)
Dim i As Integer
Dim Matched As Boolean = False
For i = 0 To Names.Length - 1
If Names(i) = CompareString Then
Matched = True
End If
Next
If Matched = True Then
Return False
Else
Return True
End If
End Function
Use the below expression in the visibility property of Anil column
=Code.TestFunction(Parameters!Multivalueparam.Value,"Anil")
Use the below expression in the visibility property of Anil kumarcolumn
=Code.TestFunction(Parameters!Multivalueparam.Value,"Anil kumar")
If you feel this is big process, you can use Id for each name and check id instead of name in your own function
August 31, 2009 at 10:57 am
Hi Arun, Thanks..
Thanks a lot.., I just tried it works..
Regards,
MC
Thanks & Regards,
MC
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply