Kbase P125250: Why does a FIND statement with a CAN-DO function in its WHERE clause fail to return an existing reco
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  8/3/2007 |
|
Status: Unverified
GOAL:
Why does a FIND statement with a CAN-DO function in its WHERE clause fail to return an existing record?
GOAL:
Why is the Customer record is not made AVAILABLE after the execution of the following FIND statement?
FIND FIRST customer NO-LOCK WHERE CAN-DO("hoops", NAME) NO-ERROR.
MESSAGE AVAILABLE(Customer)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FACT(s) (Environment):
All Supported Operating Systems
FIX:
The CAN-DO function was designed to authenticate a user name within a user list. It does not ignore blanks. Hence CAN-DO(cVariable,cField) would return FALSE if either the variable of the field have leading or trailing blanks. If the Name field in the above statement has a leading or a trailing blank, the above FIND will fail.
The equality caparison operator ignores trailing blanks while the CAN-DO function does not. That is why the above FIND statement fails to retrieve the record. And that is why the following modified FIND statement succeeds:
FIND FIRST customer NO-LOCK WHERE Name = "hoops" NO-ERROR.
MESSAGE AVAILABLE(Customer)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
It is strongly suggested NOT to use the CAN-DO function in the WHERE clause of a FIND, FOR or OPEN QUERY statements and to restrict its use for the purpose it was designed for. Not only because this function does not ignore blanks but also because it interprets special characters like "!" and "*" in a special way. Furthermore, it does not use table INDEXes in its search but it performs the far less efficient table scan access.