Query Operations

This topic discusses the query operations in alphabetical order.

Syntax

int FAR PASCAL PsfGetFieldCount(HSESSIONhSession, LPPSFFORMDEFNlpFormData);

Description

PsfGetFieldCount gives the number of fields in a form by entering an integer in the wNumFields field of the lpFormData structure. The name of the desired form is in the Name field of the structure form.

The PeopleSoft system uses the field count to allocate an array large enough to hold all the fields. It passes a pointer to this array to PsfGetFieldList.

Parameters

Parameter

Description

hSession

The session handle assigned by PsfOpenSession.

lpFormData

A pointer to a structure that contains form information. The form of the structure is:

typedef struct
{
   PSFDEFNKEY formName;   // Name of the form
   WORD wNumFields;  // Number of fields
   char cSep;    // Separator character
   LPPSFFIELDVAL lpFields;  // Pointer to field array
} PSFFORMDEFN;

Returns

This operation returns the following values:

Value

Code

Meaning

PSF_OK

0

The function ran successfully.

PSF_NOMAIL

2

Mail system failed.

PSF_NOFORM

3

The specified form is not accessible.

PSF_NODB

5

The forms database is not accessible.

Syntax

int FAR PASCAL PsfGetFieldList(HSESSIONhSession, LPPFSFORMDEFNlpFormData);

Description

Provides a list of the fields on a form.

PsfGetFieldList provides the PeopleSoft application with information about the fields on a form. The name of the desired form is in the Name field of the structure form. The lpFields field of the structure points to the array of structures that PsfGetFieldList updates. Each item in the array has this structure:

typedef struct
{
   char szFldName[PSF_FORMNAMELEN + 1];    // Field name
   WORD wFldSize;    // Field size
   LPSTR lpszStrVal;    // Field value
} PSFFIELDVAL;

PsfGetFieldList enters data into the szFldName and wFldSize fields. The PeopleSoft system provides the field values before passing the structure to PsfSendForm.

PsfGetFieldList includes all fields required to send forms using the forms product, regardless of whether they appear on the user’s form. For example, if a user’s form contains a TO field but no CC field, then PsfGetFieldList includes both fields because a CC field is required to transmit a mail message. If the forms mail system supports and requires attributes such as sensitivity, return receipt, and priority, then PsfGetFieldList also returns these items as fields.

Parameters

Parameter

Description

hSession

The session handle assigned by PsfOpenSession when the PeopleSoft application connected to PSFORMS.DLL.

lpFormData

A pointer to a structure that contains form information. The form is:

typedef struct
{
   PSFDEFNKEY formName;   // Name of the form
   WORD wNumFields;  // Number of fields
   char cSep;    // Separator character
   LPPSFFIELDVAL lpFields;  // Pointer to array
} PSFFORMDEFN;

Returns

This operation returns the following values:

Value

Code

Meaning

PSF_OK

0

The function ran successfully.

PSF_NOMAIL

2

Mail system failed.

PSF_NOFORM

3

The form is not accessible.

PSF_NODB

5

The forms database is not accessible.

Syntax

int FAR PASCAL PsfGetFormCount(HSESSIONhSession, LPINTlpnCount);

Description

Counts the available forms.

PsfGetFormCount sets lpnCount to a pointer to the number of forms available in the forms database. The PeopleSoft system uses the count to allocate an array large enough to hold all the forms. It passes a pointer to this array to PsfGetFormList.

Parameters

Parameter

Description

hSession

The session handle assigned by PsfOpenSession when PeopleSoft connected to PSFORMS.DLL.

lpnCount

A pointer to an integer that will receive the count.

Returns

This operation returns the following values:

Value

Code

Meaning

PSF_OK

0

The function ran successfully; lpnCount is set to the number of forms.

PSF_NOMAIL

2

Mail system failed.

PSF_NODB

5

The forms database is not accessible.

Syntax

int FAR PASCAL PsfGetFormList(HSESSIONhSession, LPPFSFORMLISTlpFormList);

Description

Lists the available forms.

PsfGetFormList provides a list of the available forms in the forms database. The lpForms field of the structure points to the array of structures that PsfGetFieldList updates. Each item in the form name array has this structure:

typedef struct
{
   char name[PSF_FIELDNAMELEN + 1];
} PSFDEFNKEY;

Parameters

Parameter

Description

hSession

The session handle assigned by PsfOpenSession when the PeopleSoft application connected to PSFORMS.DLL.

lpFormList

A pointer to a structure to hold the list of form names. The form of the structure is:

typedef struct
{
   UINT nNumForms;  // The number of forms
   LPPSFDEFNKEY lpForms;  // Form name array
} PSFFORMLIST;

Returns

This operation returns the following values:

Value

Code

Meaning

PSF_OK

0

The function ran successfully.

PSF_NOMAIL

2

Mail system failed.

PSF_NODB

5

The forms database is not accessible.

Syntax

int FAR PASCAL PsfGetLastError(HSESSIONhSession, LPSTRlpszErrText, UINTuBufSize, UINTuErrCode);

Description

PsfGetLastError gets the text of an error message based on an error code. The PeopleSoft system passes it the error code that it received and a pointer to a text buffer. PsfGetLastError copies the corresponding error text into the buffer, up to the size specified by uBufSize.

Parameters

Parameter

Description

hSession

The session handle assigned by PsfOpenSession when the PeopleSoft application connected to PSFORMS.DLL.

lpszErrText

A pointer to a buffer where the function places the error text.

uBufSize

The size of the buffer to which lpszErrText points.

uErrCode

The error code for which to retrieve the error text.

Returns

This operation returns the following values:

Value

Code

Meaning

PSF_OK

0

The function ran successfully.

PSF_NOERR

9

No message was found for the specified error code.