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,053 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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

18 Experts available now in Live!

Get 1:1 Help Now