Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Date to Subreport 3

Status
Not open for further replies.

dunkyn

Technical User
Apr 30, 2001
194
US
I am trying to pass a string field date to a subreport with a date formatted as a date.

Is there anyway to change the string in the stored procedure to a date field before it links to the subreport?
 
Perhaps if you convert it in a formula, as in (not sure if you have a date or datetime string in the SP, nor if the subreport has a date or datetime field, your post was a bit sparse), one of these might work:

cdate({table.stringdate})

or

cdatetime(year({table.stringdate}),month({table.stringdate}),day({table.stringdate}),0,0,0))

Now join this formula to your date or datetime field in your subreport, if it's a datetime field, you'll have to adjust the record selection formula..

In future posts, please post examples of the data and what version and type of database/Crystal so that you might get an answer tailored to your environment.

Hopefully this will work for you.

-k
 
It depends which version of Crystal you are using. Crystal 8.0 and later have a string to date conversion function.

In the Formula Editor under Functions, select Type Conversion. Under that select CDate and expand it to see the correct format.

Roz

 
Thanks for your help.

By way of details....

We are using a SQL database and stored procedures as the data source, with Crystal 8.5.

This was my first attempt at a subreport link, and I found that by linking the stored procedure datefield (not datetime field) (which is text) to the subreport date parameter, that the links work.

Now, however, I am recognizing that the user will input the account number and date in the browser application, and then the subreport will prompt them for the same info again.

Let me take another look at your suggestions and see if I can make that work.

If I understand your comments, if I create a formula in the "shell" report linked to the stored procedure to change the stored procedure date to a date, then I should be able to link that date (CDate) to the date in the subreport table.


Thx.
 
You are linking your parameters to {?Pm-?ParameterName}, which is why you are getting prompted more than once.

If you use the very small scroll bar in the bottom left window of Change Subreport links, you should scroll so that you link to the actual parameter name, rather than the {?Pm-?...} counterpart.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top