Compare Method for LCField
This method compares data values between two fields and returns the relationship.
Defined In
LCField
Syntax
result = thisField.Compare (thisIndex, baseField, baseIndex, valueCount, compareFlags)
Parameters
All parameters are required.
Parameter |
Description |
---|---|
thisIndex |
Long, >= 1. Index identifying the first value to be compared from thisField. |
baseField |
LCField. Base field for comparison. |
baseIndex |
Long, >= 1. Index identifying the first base value in baseField. |
valueCount |
Long. Number of field values to be compared. Starting at the indicated index in each field, ValueCount consecutive values from each field will be compared until all are compared or until there is a mismatch. |
compareFlags |
Long. Zero or more of the following values, ORed together: |
LCCOMPAREF_NO_ZONE -- Do not consider time zone or daylight savings time information in datetime comparisons. |
|
LCCOMPAREF _SECOND -- Do not consider fractions of seconds in datetime comparisons. |
|
LCCOMPAREF_FLOAT_PREC -- Compare floating point values to only ten digits of precision. |
|
In addition, the following composite flag is supplied: LCCOMPAREF_LOW_PREC -- Composite of all low-precision LCCOMPAREF flags. |
Return Value
Value |
Description |
---|---|
Result |
Long. Result of the comparison: |
Result > 0 (positive): The first mismatch that the function encountered in thisField is greater than the corresponding value in baseField. For datetime fields, greater means later. |
|
Result < 0 (negative): The first mismatch that the function encountered in thisField is less than the corresponding value in baseField. |
|
Result = 0: Each compared value in thisField is equal to the corresponding value in baseField. |
Example
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim field1 As New LCField (LCTYPE_INT, 3)
Dim field2 As New LCField (LCTYPE_INT, 2)
Call field1.SetInt (1, 100)
Call field1.SetInt (2, 300)
Call field1.SetInt (3, 400)
Call field2.SetInt (1, 300)
Call field2.SetInt (2, 400)
If (field1.Compare(2, field2, 1, 2, 0) <> 0) Then
Print "the 2nd and 3rd values of field1 " & _
"do not match the 1st and 2nd values of field2."
Else
Print "the 2nd and 3rd values of field1 " & _
"match the 1st and 2nd values of field2."
End If
End Sub
Example Output
The 2nd and 3rd values of field1 match the 1st and 2nd values of field2.