Showing posts with label dates. Show all posts
Showing posts with label dates. Show all posts

Sunday, March 25, 2012

Customising Date Picker

O Great Beings of MSDN,

After much fruitless search I am requesting help on whether there's any way to disable some of the dates in SSRS date picker control.

I have a date parameter in which I want users only be able to select the Fridays. I could show a drop down list of Fridays but that doesn't look too flash, especially when the list has about 2K Fridays.

Any help would be appreciated.

The parameter controls on the standard toolbar cannot be customized. If this is a must have requirement, you need to implement a custom application front end and use the ASP.NET Report Viewer (which is what the Report Manager uses).|||

Thanks Teo,

I think I will have to give up on this one as we already have a custom report protal on which all the RS reports and other reports are displayed. Having another application fire up to collect parameters is not an option for me so that's a bit of bugger.

Hope microsoft can utilise the dataset section in order to provide this in the next service pack. Ie, it would be so much easier if we could have the option of having a list of dates defined in a data set and hence when connected to the datetime parameter, it could use this list to limit the date picker dates that could be chosen by user (having dates that were not in the dataset disabled).

Fortunately the data for this particular report for my company is valid since June 2006 so have implemented the datetime as a drop down list for now (only showing fridays dates after 2006) without the datepicker so the list of Fridays isn't too big just yet.

Totally unsatisfactory from my point of view but that's the best that I could come up with.

Custome code not working in Report manager

Hi all,
I have Written the Custom code to compare two different dates and
show a message Box depending on their values .It was Working Fine in
preview tab.But it is not working when i deploy to web.Only rhe message
box part is not working in Web
I do have the Custom code like this
Public Function Errorbox(ByVal s as Date,ByVal s1 as Date) As String
If s>s1 Then
System.Windows.Forms.MessageBox.Show("From Date is greater than
To Date,Please Click Ok" )
End if
Return "a"
End Function
and i gave a text box (Just a text box)
To call this custome code and i gave the expression
=Code.Errorbox(Parameters!FROM_DATE.Value,Parameters!TO_DATE.Value)
i added this Assembly also
"System.Windows.Forms"
Its not working in Report manager(web) .Can any body help me out to
knowwhat would be the Problem.i am very new to this VB Coding
Thank you
Raj Deep.AYou need to add the assembly to the following folders:
C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer
C:\Program Files\Microsoft SQL Server\MSSQL\Reporting
Services\ReportServer\bin
Hope this helps.
"RajDeep" wrote:
> Hi all,
> I have Written the Custom code to compare two different dates and
> show a message Box depending on their values .It was Working Fine in
> preview tab.But it is not working when i deploy to web.Only rhe message
> box part is not working in Web
> I do have the Custom code like this
> Public Function Errorbox(ByVal s as Date,ByVal s1 as Date) As String
> If s>s1 Then
> System.Windows.Forms.MessageBox.Show("From Date is greater than
> To Date,Please Click Ok" )
> End if
> Return "a"
> End Function
> and i gave a text box (Just a text box)
> To call this custome code and i gave the expression
> =Code.Errorbox(Parameters!FROM_DATE.Value,Parameters!TO_DATE.Value)
> i added this Assembly also
> "System.Windows.Forms"
> Its not working in Report manager(web) .Can any body help me out to
> knowwhat would be the Problem.i am very new to this VB Coding
> Thank you
> Raj Deep.A
>

Thursday, March 22, 2012

custom view according to date

I want to add custom view so that it show the records that their date
is less than a specific field like "2007/12/25". Dates are saved in DB like "2006/08/29 12:00:00 A.M" nad
smalldatetime format in MSSQL.
what should I do?

The easiest way to achieve that using SQL statement.

Did you try it?

|||

I did it but It has no results.could you pu the sql query code here

thanks,

|||

Whatever you are binding the field to, probably has a DataFormatString property, and a HtmlEncode property. Set the DataFormatString property to {0:d} and set the HtmlEncode property to false and see if that is what you are looking for. If that isn't it (Which uses whatever format you have set in your control panel's short date format), you can force it to a specific format by setting the DataFormatString to {0:yyyy/MM/dd}

PS. Please read up on data types. The database can not both store dates like "2006/01/01 12:00:00 PM" and also store them in a smalldatetime. It's one or the other. If it's storing them into a smalldatetime, then it's stored as a smalldatetime which is not a string format. If you are storing them as a varchar/char/nchar in YYYY/MM/DD HH:MM:SS format, then they aren't stored as a smalldatetime.

|||

If you write VB.NET you have two DateDiff functions to use. Try the links below for details. Hope this helps.

http://blogs.msdn.com/vbfaq/

http://www.stanford.edu/~bsuter/sql-datecomputations.html