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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now