Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mustapha Bihmouten
  Where is Mustapha Bihmouten?
 Casablanca
 Morocco
 Mustapha Bihmouten
 To: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 Tags
Subject: RE: SCAN WHILE not working with conditions
Thread ID: 331077 Message ID: 331142 # Views: 27 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Tuesday, December 27, 2011 11:34:01 AM         
   


> >
> >
> > be aware that evaluate() is "evaluated" once and only once in the scan : "scan while evaluate( ...)"
> > with you modification it is evaluated at each loop ...
> >
> > Regards
> > Mustapha Bihmouten
>
> I really didn't know that. I didn't read that in the documentation anywhere, but I believe you, which might explain why it would only give me one of the children dependents from the loop. Thanks Mustapha.
>
> I can see by the remarks that EVALUATE() is not any good for SQL statements either:
>
> Remarks
>
> EVALUATE( ) is similar to TYPE( ) but returns the result of an expression instead of the expression type. An expression containing EVALUATE( ) cannot be optimized by Rushmore Query Optimization.
>
> Including the EVALUATE( ) function in the WHERE clause of a SQL query can return incorrect data.
>
> Cecil Champenois, Jr.

Hello Cecil

look at Tushar suggestion : you avoid the use of Evaluate() and it is more clear

Evaluate( Expression) return a boolean .T./.F.
if the Expression reference a field it use the actual record to evaluate the expression and return .T. or .F.
so it depends on the first record because by default Scan without a scope clause use ALL records

then the statement may look like this : Scan While .T. or Scan While .F.
and it is never evaluated again

with you modification : using If evaluate( ...) inside the loop,
the expression is evaluated at each loop and that what you want
but Tushar code is lighter and efficient


Regards
Mustapha Bihmouten

ENTIRE THREAD

SCAN WHILE not working with conditions Posted by Cecil Champenois @ 12/26/2011 4:35:13 PM
RE: SCAN WHILE not working with conditions Posted by Mustapha Bihmouten @ 12/26/2011 4:57:18 PM
RE: SCAN WHILE not working with conditions Posted by Cecil Champenois @ 12/26/2011 5:04:12 PM
RE: SCAN WHILE not working with conditions Posted by Mustapha Bihmouten @ 12/26/2011 5:34:11 PM
RE: SCAN WHILE not working with conditions Posted by Cecil Champenois @ 12/26/2011 5:46:57 PM
RE: SCAN WHILE not working with conditions Posted by Mustapha Bihmouten @ 12/27/2011 11:34:01 AM
RE: SCAN WHILE not working with conditions Posted by Martin Krivka @ 12/27/2011 12:57:21 PM
RE: SCAN WHILE not working with conditions Posted by Mustapha Bihmouten @ 12/27/2011 1:41:37 PM
RE: SCAN WHILE not working with conditions Posted by Martin Krivka @ 12/27/2011 1:56:58 PM
RE: SCAN WHILE not working with conditions Posted by Anil Sharma @ 12/27/2011 1:59:29 PM
RE: SCAN WHILE not working with conditions Posted by Mustapha Bihmouten @ 12/27/2011 2:27:28 PM
RE: SCAN WHILE not working with conditions Posted by tushar @ 12/27/2011 2:40:27 PM
RE: SCAN WHILE not working with conditions Posted by Martin Krivka @ 12/27/2011 4:41:41 PM
RE: SCAN WHILE not working with conditions Posted by tushar @ 12/26/2011 7:42:37 PM
RE: SCAN WHILE not working with conditions Posted by Anil Sharma @ 12/26/2011 8:19:52 PM