|
pfc_sort
|
|
Full name
|
pfc_n_cst_lvsrv_sort.pfc_sort
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
event long pfc_sort(integer,integer,integer)
|
Name
|
Datatype
|
ld_item1
|
date
|
ld_item2
|
date
|
ldc_item1
|
decimal
|
ldc_item2
|
decimal
|
ldt_item1
|
datetime
|
ldt_item2
|
datetime
|
li_returnmodifier
|
Integer
|
ll_item1
|
long
|
ll_item2
|
long
|
lnv_columnattrib
|
n_cst_columnattrib
|
lr_item1
|
real
|
lr_item2
|
real
|
ls_value1
|
string
|
ls_value2
|
string
|
lt_item1
|
time
|
lt_item2
|
time
|
event pfc_sort;//////////////////////////////////////////////////////////////////////////////
//
// Event: PFC_Sort
//
// Arguments:
// ai_index1 The index of one item being compared during a sorting operation
// ai_index2 The index of a second item being compared during a sorting operation
// ai_column The number of the column containing the items being sorted
//
// Returns: Integer
// 1 Index1 is greater than index2
// 0 Index1 is equal to index2
// -1 Index1 is less than index2
//
// Description: Perform the sort comparison on the column whose heading
// was clicked.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
// 7.0 Added "char" datatype to case statement
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_returnmodifier
string ls_value1, ls_value2
n_cst_columnattrib lnv_columnattrib
// check arguments and references. Must return 0 if nothing done
If Not IsValid(ilv_requestor) Then Return 0
If IsNull(ai_index1) or IsNull(ai_index2) or IsNull(ai_column) Then Return 0
If (ai_index1 < 1) or (ai_index2 < 1) or (ai_column < 1) Then Return 0
// change the return value based on sort we are performing
If ie_currentsort = Ascending! Then
li_returnmodifier = 1
Else
li_returnmodifier = -1
End If
// get the values to be compared
ilv_requestor.GetItem(ai_index1, ai_column, ls_value1)
ilv_requestor.GetItem(ai_index2, ai_column, ls_value2)
// Determine the datatype of the column and then call the appropriate Sort Mechanism
ilv_requestor.of_getcolumninfo(ai_column, lnv_columnattrib)
Choose Case lower(left(lnv_columnattrib.is_ColType, 5))
CASE "char(", "char" // CHARACTER DATATYPE
If ls_value1 > ls_value2 Then
Return (1 * li_returnmodifier)
ElseIf ls_value1 < ls_value2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "date" // DATE DATATYPE
date ld_item1, ld_item2
ld_item1 = date(ls_value1)
ld_item2 = date(ls_value2)
If ld_item1 > ld_item2 Then
Return (1 * li_returnmodifier)
ElseIf ld_item1 < ld_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "datet" // DATETIME DATATYPE
datetime ldt_item1, ldt_item2
ldt_item1 = datetime(ls_value1)
ldt_item2 = datetime(ls_value2)
If ldt_item1 > ldt_item2 Then
Return (1 * li_returnmodifier)
ElseIf ldt_item1 < ldt_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "decim" // DECIMAL DATATYPE
decimal ldc_item1, ldc_item2
ldc_item1 = dec(ls_value1)
ldc_item2 = dec(ls_value2)
If ldc_item1 > ldc_item2 Then
Return (1 * li_returnmodifier)
ElseIf ldc_item1 < ldc_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "numbe", "long", "ulong" // NUMBER = Integer DATATYPE
long ll_item1, ll_item2
ll_item1 = long(ls_value1)
ll_item2 = long(ls_value2)
If ll_item1 > ll_item2 Then
Return (1 * li_returnmodifier)
ElseIf ll_item1 < ll_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "real" // Real DATATYPE
real lr_item1, lr_item2
lr_item1 = real(ls_value1)
lr_item2 = real(ls_value2)
If lr_item1 > lr_item2 Then
Return (1 * li_returnmodifier)
ElseIf lr_item1 < lr_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE "time", "times" // TIME DATATYPE
time lt_item1, lt_item2
lt_item1 = time(ls_value1)
lt_item2 = time(ls_value2)
If lt_item1 > lt_item2 Then
Return (1 * li_returnmodifier)
ElseIf lt_item1 < lt_item2 Then
Return (-1 * li_returnmodifier)
Else
Return 0
End If
CASE ELSE
Return 0
End Choose
Return 0
end event
Name
|
Owner
|
listview.getitem |
listview
|
systemfunctions.date |
systemfunctions
|
systemfunctions.datetime |
systemfunctions
|
systemfunctions.dec |
systemfunctions
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.long |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.real |
systemfunctions
|
systemfunctions.time |
systemfunctions
|
pfc_u_lvs.of_getcolumninfo |
pfc_u_lvs
|