Is This a Bug?

GregTomkins

Active Member
Code:
FUNCTION getstat RETURNS LOGICAL (p_acct AS CHAR):
   RETURN TRUE.
END.


 FIND FIRST foo
  WHERE foo.acct = "8"
  AND getstat(foo.acct) = TRUE
  NO-ERROR.


 DISP AVAIL foo.

Assuming there is a 'foo' with a 'acct' value of '8', the DISP should return YES. For me, it returns NO. If I remove the 'getstat' call, it works properly. Any thoughts?
 

GregTomkins

Active Member
Mmm, I wondered if that might be the case. We're stuck in 9.1D land, near as I can tell, more-or-less permanently (despite the fact we are 100% up to date on maintenance and spend 100's of 1000's per year for it). Thanks for replying.
 

UncleNel

New Member
As I understand it, In a "for each" loop, user defined function are evaluated "only once". With that assumption and with your "find first", I imagine the same is true. Try the function test after the "find first" and you will be ok.
 

tamhas

ProgressTalk.com Sponsor
You've probably been told this before, but "stuck" is really not something that should happen if you are on maintenance, especially if you have source. I don't doubt that your vendor is telling you that this is the only option, but many people have argued the point before and won, so maybe you just haven't argued enough.
 

andre42

Member
That's documented behavior. You shouldn't use user defined functions in where clauses.
There are several knowledge base entries regarding this problem, try searching for the keywords: udf where clause
Entry P77953 is very similar to your code.

The behavior has not changed in OpenEdge. What has changed is that there now is a startup parameter -noudfinwhere which makes this a compile error (could be from 10.1A an up).

HTH, André
 

GregTomkins

Active Member
1. Thomas: we are the vendor. We have been working on it, slowly migrating customers to v10, for 2-3 years and have spent a fortune on it. Another reason why I've come to be a stalwart believer in web apps, though of course, that does not entirely solve the problem. (Mostly, though!).

2. Andrew: Thanks!, that is interesting, good to know. I've been writing WHERE's and UDF's for eons and didn't know that. No wonder my code never works ;)
 

tamhas

ProgressTalk.com Sponsor
How can you possibly take 2-3 years to move from 9.1D to 10.x? For most applications it is load and go.

Now, actually modernizing the application is a different issue (see sig!), but no reason not to get on the modern version first.
 

GregTomkins

Active Member
Changing our code is a minor issue, it's the logistics of dozens of servers all over the country, thousands of PC's with a variety of software upgrade scenarios, and unforgiving SLA's. Plus, we have at least one example where we spent weeks figuring out some problem in the v10 AIA. That was about a year ago.
 
Top