Consultor Eletrônico



Kbase P146428: Can't call a function from a query WHERE clause
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/13/2010
Status: Verified

SYMPTOM(s):

Can't call a function from a query WHERE clause

Calling a user defined function from a where clause doesn't fire the function

Functions only fire once when used in a WHERE clause

UDF doesn't fire when used in query predicate

Function not firing in WHERE Clause

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

CAUSE:

This is expected behavior and will only return a value if that value is available at compile time.

When an ABL predicate (such as a WHERE clause) contains a user-defined function, the AVM evaluates the function once-when it opens the query or enters the FOR EACH block.

For example; if the function returns a hard coded value like TRUE or 1, the WHERE clause will resolve to <field-name> = TRUE|1, otherwise the query will not be resolved and no records will be returned.

FIX:

Resolve the value of the function prior to using it in the query predicate.