You are not logged in.
Hello AB,
using TDocVariantData.SearchItemByValue with values string (varOleStr)
I get error "Could not convert variant of type (OleStr) into type (Double)"
When debug I see function SortDynArrayVariantComp compare as string "CMP" only when value is type varString, all other values compared as "ICMP"
I change code as bellow and work, but I do not know if it safe (what if value type is any)
Can you check it please?
function SortDynArrayVariantComp(const A,B: TVarData; caseInsensitive: boolean): integer;
...
if (AT<=varNull) or (BT<=varNull) then
result := ord(AT>varNull)-ord(BT>varNull) else
[ins] if (AT = varOleStr) or (BT = varOleStr) or (AT = varString) or (BT = varString) then
result := CMP[caseInsensitive](variant(A),variant(B))
else
result := ICMP[VarCompareValue(variant(A),variant(B))][/ins]
[del]{ if (AT<varString) and (BT<varString) then
result := ICMP[VarCompareValue(variant(A),variant(B))] else
result := CMP[caseInsensitive](variant(A),variant(B));}[/del]
end;
Offline
Please try https://synopse.info/fossil/info/a37bab0324
I used mORMot 2 code as reference, which seems more correct here - and also faster.
Offline
It works ,
thank you AB.
Offline