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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defaulting parameters!!

Status
Not open for further replies.

sheridan101

Programmer
Dec 31, 2003
29
US
I am using Crystal Reports.NET. I need to set specific defaults for parameter fields on reports. These values should be calculated internally in the report BEFORE the parameter input box is presented.

For example, I need to set a report start date/time to be "today at 8:00 am". This means it needs to get todays date but set the time to 8:00 am. Then set a report end time to be @ 7:59:59 tomorrow. It has to be a parameter because I need to allow the person running the report to change these defaults. Is there any way to do this "on the fly" as the report runs????
 
Crystal doesn't do this, you need to pass values to the report.

Not sure if you can then have the report prompt with those values though, you might consider prompting from your app.

-k
 
That is what I was hoping to avoid. I am very new to CR and don't know how to pass values to/from the report. The above article helped but am still having difficulty.
 
Well, if it's a known datetime, set the default values in the report to:

1/1/1970 1:1:1

If the user wants something else then the default (which we'll set based on this be9ing 1970), change them.

Otherwise use formulas to determine the datetime:

@startdate // assumes a datetime range parameter
If minimum({?Datetimeparm}) = cdatetime(1970,1,1,1,1,1) then
cdatetime(year(currentdate),month(currentdate),day(currentdate),8,0,0)
else
minimum({?Datetimeparm})

@enddate
If minimum({?Datetimeparm}) = cdatetime(1970,1,1,1,1,1) then
cdatetime(year(currentdate+1),month(currentdate+1),day(currentdate+1),8,0,0)
else
minimum({?Datetimeparm})

Now in the record selection formula use:

{table.date} >= @startdate
and
{table.date} < @enddate

-k
 
I already knew about that. What I am questioning is how to set an &quot;initial&quot; default datetime value for display in the dialog box when CR presents the prompt requestor. The available choices for &quot;defaults&quot; in the configuration for the prompt are useless to me. I need to be able to have some initialization WITHIN the report COMPUTE a default (for example by taking todays date and setting the time to 8:00 am which would produce a new &quot;default&quot; each day) and then assign that value to the report's datetime date range parameter for display when the prompt dialog pops up. And, if possible, I would prefer to do it within the report itself rather than creating my own dialog within the viewer program and then setting the CR parameters from there. I am very new to CR and have not been able to find any documentation on this process in C#.

The reason for this is that I have written one generic viewer for multiple reports. To have to put custom prompt dialogs in for each report would be a big undertaking. Further, it would make the task of making sure the dialogs stay in sync with each corresponding report in the future more difficult.
 
Thanks anyway but that is not acceptable. These reports are for businesses. I am attempting to convert reports from Microsoft XL to Crystal Reports. The reports worked that way before and we are getting complaints that this is no longer the case. Are you telling me that Microsoft XL can do something that CR can't where reporting is concerned?

The default prompts in CR are CRAP where setting defaults are concerned. The available options for setting default values are completely useless and far too limited. This is especially the case with setting default datetime parameter values!!
 
Yeah, that's the age old complaint (I have much worse rants on here about this topic), and Crystal has impolitely ignored the people's outcry to make them dynamic and configurable.

BO does a better job of this, so in a couple of years...

Hence the workarounds offered, 3rd party viewers, or the suggestion that parameters be collected in external code.

-k
 
Something I've been grumbling about lately as well... paricularly that there are properties and methods that are exposed using the Delphi VCL that aren't accessible through the Crysal Print Engine, namely the browse field from the default parameters window. That sure would be handy for developers to update parameter lists dynamically without any goofy hardcoding.

That's been driving me batty for a few weeks now.


-dave
 
Hmmm. Guess I have a few things &quot;to look forward to&quot;.... (aarrrgggghhhh!!!). If I hit the roof trying to get this to work, I guess the company will have to set aside money to fix the roof when I start needing to work with some of these other things.... and I thought that Microsoft was bad!
(Geeezzzzeeee!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top