473,382 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Crystal Reports Date/Time Issue

2
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to select time also. But i don't want to choose time, I only need the date component. Is there any way i can supress/remove the time field in crystal.
Sep 6 '07 #1
5 11904
Jim Doherty
897 Expert 512MB
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to select time also. But i don't want to choose time, I only need the date component. Is there any way i can supress/remove the time field in crystal.
Can you not in a position to cast or convert your date to varchar as part of the select or where clause?

CONVERT(varchar(10),@YourDateParameter,103)

Regards
Jim
Sep 7 '07 #2
rammy
2
Jim,

I thought about that idea, but crystal will not show the calender when i use varchar as input parameter. The user may have to type the date in the text box and there will be no validation for the date. The calender gives user ablity to select the date they wanted. Is there any other way to hide the time component?

Thanks,
Rammy
Sep 7 '07 #3
Jim Doherty
897 Expert 512MB
Jim,

I thought about that idea, but crystal will not show the calender when i use varchar as input parameter. The user may have to type the date in the text box and there will be no validation for the date. The calender gives user ablity to select the date they wanted. Is there any other way to hide the time component?

Thanks,
Rammy

Rammy

SQL Server is going to return a date and time together as is its datatype

try this conversion to see how it effects you select cast(convert(varchar, getdate(),101) as datetime) you can amend the 101 to 102 or 103 or whatever your localisation needs demand

I take your point about the Crystal calendar but if you look at the item thread 5896

at this link

[HTML]http://technicalsupport.businessobjects.com/cs/forums/thread/5678.aspx[/HTML]

In addition to that look at this link thread discussion both of which seem to conclude that overall it seems there is no real issue with CR accepting a conversion as I outlined earlier and above

[HTML]http://forums.databasejournal.com/showthread.php?t=35083[/HTML]


Regards

Jim
Sep 7 '07 #4
I agree. The date calendar prompt thinggummyjig is a damned nuisance. And the convert function supplied by a previous post puts the date in mm/dd/yyyy which is US not UK version.
select convert(varchar, getdate(),101)
06/17/2010


I'm sure there is another format code to get it in the UK version but personally I normally select the date in my stored procedure using one of these user-friendly formats listed below to retrieve the date in varchar (i.e. SQL Server equivalent of string )format and then simply get the CR user to type in the date in that format e.g. 2008-08-17 also, make the CR parameter a string also and then you're comparing like with like.

Too bad you can't use the funky date picker calendar - you probably can if you set the input parameter to Date and play around with CR formulas for a bit.

User Friendly Format 1
=====================
Select TOP 15 CAST(DATEPART(yyyy, M.mopendt) as varchar(4))+ '-'
+ RIGHT ('00' + CAST(DATEPART(mm, M.mopendt) as varchar(2)),2) + '-'
+ RIGHT ('00' + CAST(DATEPART(dd, M.mopendt) as varchar(2)),2)
from matter M
1981-12-17
1985-08-21
1998-05-26
1981-09-21


User Friendly Format 2
=======================
Select TOP 15
RIGHT ('00' + CAST(DATEPART(dd, M.mopendt) as varchar(2)),2) + '/'
+ RIGHT ('00' + CAST(DATEPART(mm, M.mopendt) as varchar(2)),2) + '/'
+ CAST(DATEPART(yyyy, M.mopendt) as varchar(4))
from matter M
17/12/1981
21/08/1985
26/05/1998
21/09/1981


User Friendly Format 3 (for display on the CR report)
========================
select top 15
CASE
WHEN datepart(dd,M.mopendt) IN (1, 21, 31) then RIGHT('0' + CAST(datepart(dd,M.mopendt) as varchar(2)),2) + 'st ' + DATENAME(month,M.mopendt)+ ' ' + CAST(datepart(yyyy,M.mopendt) as varchar(4))
WHEN datepart(dd,M.mopendt) IN (2, 22) then RIGHT('0' + CAST(datepart(dd,M.mopendt) as varchar(2)),2) + 'nd ' + DATENAME(month,M.mopendt)+ ' ' + CAST(datepart(yyyy,M.mopendt) as varchar(4))
WHEN datepart(dd,M.mopendt) IN (3, 23) then RIGHT('0' + CAST(datepart(dd,M.mopendt) as varchar(2)),2) + 'rd ' + DATENAME(month,M.mopendt)+ ' ' + CAST(datepart(yyyy,M.mopendt) as varchar(4))
ELSE RIGHT('0' + CAST(datepart(dd,M.mopendt) as varchar(2)),2) + 'th ' + DATENAME(month,M.mopendt)+ ' ' + CAST(datepart(yyyy,M.mopendt) as varchar(4))
END
as friendly_mopendt_ver1 from Matter M
--sample
17th December 1981
21st August 1985
26th May 1998
21st September 1981
Jun 17 '10 #5
Hi,

As an update to the last post, here is how it is done.
No need for user friendly columns although these can be very useful for displaying on the report itself.

You bring in the column from the database (fopen DateTime) and you create a parameter of type Date called DatePicker. Then you click on the filter shaped icon to open the Select Expert and add the below line as a condition.
CDATE({vwLabelsDailyNewFolders.fopen}) = {?DatePicker}

CDATE converts DateTime to Date so you are now comparing like to like and can use the Calendar prompt datepicker supplied by Crystal.


Thanks, Seán
Jun 17 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
14
by: LP | last post by:
Hi, I will be taking on a new project developing a web-based "reporting system". The first requirement I got from BI group is "we just want to look at the data". Basically, there is a huge...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
1
by: =?Utf-8?B?VGVycnk=?= | last post by:
I am brand new to using Crystal Reports and am trying to generate a report based on a custom object - in another project. I have a layered design, with all my business objects in a seperate...
11
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.