Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
192
Добавлен:
11.05.2015
Размер:
4.96 Mб
Скачать

Data Type

Integer

Availability

Runtime

Related Report Engine Functions

PESetNthTableSessionInfo, Volume 2, Chapter 1

SortFields

SortFields specifies the field(s) that are to be used to sort your data when the report is printed.

Syntax

[form.]Report.SortFields(ArrayIndex)[= “{+|-} SortField”]

Enter the fields on which you want the data in your report to be sorted.

For example, to sort an order database alphabetically by customer, and then by order date, you can enter code similar to the following:

CrystalReport1.SortFields(0) = “+{orders.CUSTOMER}”

CrystalReport1.SortFields(1) = “+{orders.ORDERDATE}”

Remarks

SortFields is an array property available only at runtime.

Use a separate line of code to specify each sort field.

Enter sort fields in the order that you want them to sort your report. For example, if you want your report to be sorted first on field A and then on field B, specify sort field A in your first line of code and sort field B in your second line of code.

The sort field you specify must be assigned array index 0, the second sort field must be assigned array index 1, etc.

The index values you assign must be continuous; no gaps are allowed (0, 1, 2 = OK, 0, 1, 3 = wrong).

Array index values must be subscripted in the code immediately after the property name (i.e., CrystalReport1.SortFields(0) =).

If you have specified sort fields for your report at Design Time, any sort fields you enter here will replace the sort fields in your report.

If you do not use this property, the program will use the sorting instructions that you specified in the report.

Crystal ActiveX Control Reference

243

If you want to clear the sort fields in your report, use an empty string (i.e., CrystalReport1.SortFields(0) = “”).

Enclose field names in braces.

Sort fields can be database fields or formula fields. If you sort on a formula field, use the @ sign before the formula name (i.e., {@FORMULANAME}).

NOTE: If you are currently using the VBX control in your application, you will not be able to print individual subreports.

Data Type

Array of strings

Availability

Runtime

Related Report Engine Functions

PESetNthSortField, Volume 2, Chapter 1

SQLQuery

SQLQuery specifies the SQL query string used by the specified report.

Syntax

[form.]Report.SQLQuery[=SQLQuery$]

For example:

CrystalReport1.SQLQuery = “SELECT authors.au_id, authors.au_lname, authors.au_fname FROM pubs2.dbo.authors authors WHERE authors.au_lname > ‘Madison’"

«Queries the SQL database to return only the records where the authors last name falls after Madison alphabetically.»

Remarks

You may only change the WHERE, FROM, and ORDER BY sections of an SQL query. Although the property requires that you enter the entire SQL query, the SELECT section must not be different from the original query in the report.

Crystal ActiveX Control Reference

244

To change the ORDER BY clause, you must place a carriage return and linefeed characters after the WHERE clause and before the ORDER BY clause in this way:

CrystalReport1.SQLQuery=”SELECT...FROM...

WHERE...” + CHR$(13) + CHR$(10) + “ORDER BY...”

This property is active only if you are using an SQL or ODBC data source in your report.

NOTE: If you are currently using the VBX control in your application, you will not be able to print individual subreports.

Data Type

String

Availability

Design Time; Runtime

Related Report Engine Functions

PEGetSQLQuery, Volume 2, Chapter 1

Status

Status indicates the print status for the specified report.

Syntax

[form.]Report.Status

For example:

Status% = CrystalReport1.Status

«Fetches the print status and saves it to the Status variable.»

Remarks

The Status property will return one of the following values:

"0" if PEOpenEngine or PEOpenPrintJob has not been called successfully.

"1" if the job has not started yet (PE_JOBNOTSTARTED).

"2" if the job is in progress (PE_JOBINPROGRESS).

"3" if the job has completed successfully (PE_JOBCOMPLETED).

"4" if the job has failed (PE_JOBFAILED).

Crystal ActiveX Control Reference

245

"5" if the job has been canceled by the user (PE_JOBCANCELLED).

"6" if the job has been halted (PE_JOBHALETED).

This property/method is available for subreports.

Data Type

Integer

Availability

Runtime

Related Report Engine Functions

PEGetSQLQuery, Volume 2, Chapter 1

StoredProcParam

StoredProcParam specifies the stored procedure parameters when using a report based on SQL stored procedures.

Syntax

[form.]Report.StoredProcParam(Parameter Array Index%)[= newParameter$]

For example:

CrystalReport1.StoredProcParam(0)=”06/14/1989”

«Sets the first stored procedure parameter to the date June 14, 1989.»

Remarks

StoredProcParam sets the value of the specified parameter in an SQL database table that is based on a stored procedure. Pass the value you wish to set the parameter to as a string. If the parameter expects a different data type, you still must pass the value as a string. For example, to pass the integer value 396, use the string “396”. The Crystal Report Engine will handle converting the value into integer format.

NOTE: If you are currently using the VBX control in your application, you will not be able to print individual subreports.

NOTE: Under the native driver for MS SQL Server, stored procedure input parameters are limited to 64 characters rather than 255.

Data Type

Arrays of strings

Crystal ActiveX Control Reference

246

Соседние файлы в папке crystal