Solved

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

Posted on 2014-01-05
2
1,072 Views
Last Modified: 2014-01-06
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
0
Comment
Question by:Papa1NZ
  • 2
2 Comments
 
LVL 13

Accepted Solution

by:
Jesus Rodriguez earned 500 total points
ID: 39760614
You can use List.Sort for it...This is the example on vb.net

        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(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


On the first element you will have the smallest and on the last you will have the greatest
0
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 39760627
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

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Time Corrections for Reports Working with a report, we made some interesting discoveries about the time corrections/updates We are using the following Parameters: Starting Entered Date (Date) formatted as Data type: "Date/Time" Ending Entered …
Hi All, I am here to write a simple article to move SSRS (SQL Server Reporting Services) reports from one server to another. When I have faced the same issue to move reports those were developed by developer on development server and now need to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question