Curious why this query results on a WHOLE-INDEX search on customer.cust-num?
find first customer where customer.name = if can-find( invoice where
invoice.invoice-num = 2 ) then "Jazz Futis Kauppa" else "Joe Customer" no-lock
no-error.
./fc.p ./fc.p 1 SEARCH sports.Customer Cust-Num WHOLE-INDEX
Thanks.
Because ABL does not have anything like "previous function evaluation".
The result of the function is unknown to ABL up to the evaluation, so it has to be evaluated for each customer. (can-find is a function).
Doing:
if can-find() then
name = "Jazz".
else
name = "Joe"
find first customer where customer.name = name no-lock no-error.
Should give you a different index usage.
Because ABL does not have anything like "previous function evaluation".
The result of the function is unknown to ABL up to the evaluation, so it has to be evaluated for each customer. (can-find is a function).
Doing:
if can-find() then
name = "Jazz".
else
name = "Joe"
find first customer where customer.name = name no-lock no-error.
Should give you a different index usage.