https://issues.apache.org/bugzilla/show_bug.cgi?id=57475
Bug ID: 57475
Summary: The Match function does not perform implicit
conversion
Product: POI
Version: 3.9-FINAL
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: SS Common
Assignee: [email protected]
Reporter: [email protected]
If I call MATCH (EQUIV) with a SearchCriterion whose type is different from the
type of the elements of the LookupArray, the function returns N/A even if the
types are convertable.
if SearchCriterion is of type string whose value is convertable to a number
('1' for example) and LookupArray contains elements whose type is Number
({1,2,3} for example) then Match returns N/A while Excel and LibreOffice find a
match.
public final class Match extends Var2or3ArgFunction {
...
private static int findIndexOfValue(ValueEval lookupValue, ValueVector
lookupRange,
boolean matchExact, boolean findLargestLessThanOrEqual) throws
EvaluationException {
...
// Next line return false when classes dont match
if(lookupComparer.compareTo(lookupRange.getItem(i)).isEqual()) {
Because ...
public final CompareResult compareTo(ValueEval other) {
...
// Next line does not convert
if (_targetClass != other.getClass()) {
return CompareResult.TYPE_MISMATCH;
}
return compareSameType(other);
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]