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,080 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

821 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