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

Printing Parameters Passed by A program.

Status
Not open for further replies.

jbopgaf

Technical User
Feb 20, 2001
13
AU
Is it possible to write a formula to retrieve date values passed into a date field via VB program?(builds the Crystal SQL statement) That is, a programmer calls my report via his program which prompts a user to enter in a date range (Start date and End date). These values are passed onto the appropriate date field.
(Example field: Customer.QueryDate)

Is it possible to pick up the dates entered and passed to Customer.QueryDate so that they can be printed on the report? (Showing the user what date ranges where entered) FROM:__ / __ /__ TO: ___ / ___ /___

Using minimum(Customer.QueryDate) and maximum(Customer.QueryDate) over the field is not good enough as the report must display the dates that were entered by the user.

I have successfully written reports where I've created parameters for date fields and printed those values (IE Date Ranges on the report) but in this situation I haven’t got a parameter to work with.

I hope I've explained myself...

Thanks in advance.
 
Here's what I have done with my reports.

Create the following formula and place it in either the report header or page header.

"FROM: "+ totext(minimum({?DateRange}),"MM/dd/yy") + " TO: " + totext(maximum({?DateRange}),"MM/dd/yy")

Cheers,

-Larry
 
Thanks Larry,

This formula is ok if you enter parameters values via crystal but unfortunately it does not solve my problem.

I also use this method when I create date parameters in my reports.

This situation is different in that the programmer is passing the values directly to the date field in the SQL database.

I need to print the values getting passed. As mentioned in my first post, if I use minimum and maximum over the field I only get the first occurrence and the last occurrence of the record.

EG: If the user enters (via the program)

10/10/04 to 10/15/04

I would need to print in the header:

FROM: 10/10/04 TO: 10/15/04.

If I use minimum and maximum, I may only get something like

FROM: 10/12/04 TO: 10/14/04

because minimum and maximum only displays the first and last record in the selected range.

Thanks Larry.
 
What do the following mean in technical terms?:
"These values are passed onto the appropriate date field."
and
"This situation is different in that the programmer is passing the values directly to the date field in the SQL database."

Larry correctly responded since you hadn't described your environment.

One can't pass a value to a date field. One can create a query which filters data, or use Stored Procedures, set parms in a report to a value, amongst other means.

Do you mean that they are querying the database and creating a recordset and passing it to the database?

You could set a text object to a value, or a formula, here are the sample apps which include such examples:


Any idea what version of Crystal? How are the developers using Crystal (RDC, or?)?

-k
 
I have talked to the programmer and he has given me the following VB6 code that runs my report:

-------------------------------------------------
Dim Cr As New CRAXDRT.Application
Dim CrxReport As CRAXDRT.Report
Dim strParameters As String

strParameters = "StartDate >= '1/10/2001' AND EndDate <= '19/11/2004'"

Set Cr = CreateObject("CrystalRuntime.Application")
Set CrxReport = Cr.OpenReport("c:\Report1.rpt")

CrxReport.ExportOptions.DestinationType = crEDTDiskFile
CrxReport.ExportOptions.DiskFileName = "C:\ReportName.pdf"
CrxReport.ExportOptions.FormatType = crEFTPortableDocFormat

CrxReport.RecordSelectionFormula = strParameters[/color red]

CrxReport.Export False

Set Cr = Nothing
Set CrxReport = Nothing
------------------------------------------------------

The problem is extracting the ReportSelectionFormaula parameters in my report to display them. Is this possible?
The version of Crystal we are using is 8.5.

Thanks in advance for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top