PESetNthSortField

Use PESetNthSortField to set one of the sort fields in the specified report. This function can be used by itself to set a sort field/direction when there is not one already set, or to change a sort field/direction when the number and name of the sort field are known.

The function can also be used as one of a series of functions (PEGetNSortFields, called once; var reportAlertInfo : PEReportAlertInfo) : boolean stdcall;, or PEGetHandleString, called together as many times as needed to identify the correct sort field; and PESetNthSortField, called once when the correct sort field is identified). The series can be used in a Custom-Print Link to identify and then change an existing sort field and/or sort order in response to a user selection at print time. When you give the user the ability to specify sort field(s) and/or direction at print time, your link must include code to replace name and/or sort direction with user-generated values.

C Syntax
BOOL CRPE_API PESetNthSortField (
        short printJob,
        short sortFieldN,
        const char FAR *name,
        short direction );
Parameters

printJob

Specifies the print job for which you want to set sort field information.

sortFieldN

Specifies the 0-based number of the sort fields that you want to set. The first sort field is field 0. If the report has N sort fields, the function can be called with sortFieldN between 0 and N-1 to replace an existing sort field. If the report has N sort fields, you can call the function with sortFieldN = N to add a new sort field to the end of the list of existing sort fields. If N=0, the function will add the first sort field.

name

Specifies a pointer to the null-terminated string that contains the name of the sort field.

direction

Specifies the sort direction. Use one of the PE_SF_XXX Sort Order Constants.

Returns
Remarks

This function should be called before PEStartPrintJob or the results may be inconsistent or unexpected.

VB Syntax

VB Sample Code for sorting records

Declare Function PESetNthSortField Lib "crpe32.dll" ( _
    ByVal printJob As Integer, ByVal sortNumber As Integer, _
    ByVal SortFieldName As String, ByVal Direction As Integer ) As Integer
Delphi Syntax
function PESetNthSortField (
    printJob: Word;
    sortFieldN: smallint;
    name: PChar;
    direction: smallint
    ): Bool stdcall;
dBASE for Windows Syntax

EXTERN CLOGICAL PESetNthSortField (CWORD, CWORD, CSTRING, CWORD) CRPE.DLL



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com