Link to home
Start Free TrialLog in
Avatar of Papa1NZ
Papa1NZ

asked on

ssrs - How do I pass multi-value Date parameter to the VB.net 'code' section and return the earliest date selected?

Hi Experts,

I have a muti-value selection list where I want to find the earliest and latest date of the selection list. I believe I will need to do this by passing parameters to the VB.Net "code" to return the two values to me expression.

There is a maximum of 4 dates in this selection list.  
The selections are 'Today', '-1month', '-2months', '>-3months'.
E.g. Parameters will send the actual date. ('07/01/2014', '07/12/2013', '07/11/2013')

As it is a multi-select the parameter can contain 1 to 4 date items.

Is there a VB.net function I could use to do this. I am not a VB.Net programmer so this part is a little difficult to do for me.

Let me know how I should do this I expect I will need to use a loop to read the items into an array? How should I declare etc?

Many thanks for your help.
2FilterTab.PNG
ASKER CERTIFIED SOLUTION
Avatar of Jesus Rodriguez
Jesus Rodriguez
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just in case that you use the apostrophes on your list
 Dim WholeParameters As String = "'07/01/2014','07/12/2013','07/11/2013'"
        Dim List As New List(Of Date)
        For Each DayDate As String In WholeParameters.Split(",")
            List.Add(CDate(Replace(DayDate, "'", "")))
        Next
        List.Sort()
        MsgBox(List(0).ToString("MM/dd/yyyy") + " " + List(1).ToString("MM/dd/yyyy") + " " + List(2).ToString("MM/dd/yyyy"))

Open in new window