Curious why this query results on a WHOLE-INDEX search on customer.cust-num?
find first customer where customer.name = if can-find( invoice whereinvoice.invoice-num = 2 ) then "Jazz Futis Kauppa" else "Joe Customer" no-lockno-error.
./fc.p ./fc.p 1 SEARCH sports.Customer Cust-Num WHOLE-INDEX
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).
if can-find() then
name = "Jazz".
name = "Joe"
find first customer where customer.name = name no-lock no-error.
Should give you a different index usage.