using functions within an open query where clause

ingie

New Member
Hi All,

Assuming:
1) function myResult always returns the value 'Passed' in this example - so I could test where the bug was
2) t-Trx is a temp-table

Can anyone tell me why this works fine :

OPEN QUERY {&SELF-NAME}
FOR EACH t-Trx WHERE t-Trx.transferDirection <> "Out"
AND
myResult( 'AnyValue' ) = 'Passed'
NO-LOCK.

.. yet this doesn't ( i.e. no values are returned in the query ) :

OPEN QUERY {&SELF-NAME}
FOR EACH t-Trx WHERE t-Trx.transferDirection <> "Out"
AND
myResult( t-Trx.Status ) = 'Passed'
NO-LOCK.


.. also if I put a MESSAGE 'Hi' into the function block, in the first ( working ) example the message appears, in the second broken example, the message doesn't appear, implying that progress isn't bothering running the function - yet no error is reported.

Cheers,

Ingie.
 

M-HT

Member
Hi,
the reason is quite simple:
1) the function gets called before the open query statement and only the result is used in it
2) in your program the buffer t-Trx is empty but progress doesn't raise an error and returns no values in the query
 

ingie

New Member
Cheers, I (and my team) had eventually worked it out as you have identified, although we were still a little confused as to why no error was reported at run time, when the function is obviously not running....

thanks for your input,

Ingie.
 
Top