I encounter a can-find issue

Posted by michael_han on 28-May-2013 22:16

Hi,In a progress .p file, we have a logic using can-find function like below:can-find(tablename where field1 = xxx and field2 = xxx)Issue is this can-find always return false since yesterday, it works fine (return true) for a long time.I tried to add the first keyword befor the table name, then it works ok (return true).Question is why it works after added the "first" keyword? Why it works before but not today? What happens may cause this issu?Thank you!

All Replies

Posted by Admin on 28-May-2013 23:08

When you don't specify the FIRST opiton, it's a CAN-FIND UNIQUE.

That is supposed to fail, when there is a second record matching the criteria. I guess that's happening.

You should never use the FIND without FIRST (or LAST) when there is no UNIQUE index supporting the search. The AVM needs to search for the FIRST record and then also for a second record, to know if there's only a single record. That's a performance issue.

Posted by michael_han on 28-May-2013 23:20
Hi Mike,Thank you for your fast reply.That table has a primary unique index and the can-find use it also.Any other reason may cause this issue?Btw, only one record meets the searching criterion.Thank you.
Posted by michael_han on 29-May-2013 00:54
Hi Mike,Thank you. we found the reason it's the index issue.
This thread is closed