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


> > SCAN WHILE seems to be unable to do the job with conditions added to it. This is part of a previous posting where I was using LOCATE WHILE which wasn't cutting it either. The below SCAN WHILE is never true, although the data says it should be.
> >
> > Is there some known bug, or deficiency, with SCAN WHILE?
> >
> >
> > IF m.CHILD AND SEEK(m.GrpID+m.GrpNum, "GRPEXTDP", "FULL_KEY")
> > 	SELECT GRPEXTDP
> > 	SCAN WHILE GrpExtDP.GrpID+GrpExtDP.GrpNum=m.GrpID+m.GrpNum AND ;
> > 		EVALUATE([LEFT(RelateCd, 1) $ "C,D"] + lcCondition)
> > 

> > Cecil Champenois, Jr.
>
> Hello Cecil
>
> if it's related to your previous post "locate while"
> you may try "&lcCondition" instead of "+ lcCondition"
>
>
> Regards
> Mustapha Bihmouten

I may do that, since it appears to not be working. What I am seeing is that the SCAN doesn't move, or doesn't seem to move.

...a little later...
I decided to make a few changes and the program is now working properly. I removed part of the scan conditions and just put them into an IF condition. This seems to work better. I could not "overload" scan because it could not seem to handle the load.
IF m.CHILD AND SEEK(m.GrpID+m.GrpNum, "GRPEXTDP", "FULL_KEY")
	SELECT GRPEXTDP
	SCAN WHILE GrpExtDP.GrpID+GrpExtDP.GrpNum=m.GrpID+m.GrpNum
		*IF EVALUATE([LEFT(RelateCd, 1) $ "C,D"] + lcCondition)
		IF LEFT(RelateCd,1) $ 'C,D' &lcCondition
		* List variables and their sources.
			m.Seq=GRPEXTDP.Seq			&& Dependent's Sequence #
			IF .chk9DigitSSN.Value = 1	&& Show all 9-digits of Dependent's SSN.
				m.SSN=tmpResults.SS_Number	&& Employee's SSN
			ELSE
				* Employee's Last 4-digits of SSN.
				m.SSN=SUBSTR(tmpResults.SS_Number, 6, 4)
			ENDIF
			*m.SSN      =tmpResults.SS_Number	&& Employee's SSN
			m.LastName =tmpResults.LastName	&& Employee's Surname
			m.FirstName=tmpResults.FirstName	&& Employee's First Name
			m.DepLName =GRPEXTDP.LastName		&& Dependent's Surname
			m.DepFName =GRPEXTDP.FirstName		&& Dependent's First Name
			m.Eff_Date =GRPEXTDP.EffDate		&& Dependent's Effective Date
			m.TermDate =GRPEXTDP.TermDate		&& Dependent's Term Date.
			m.Relation =GRPEXTDP.Relation		&& Daughter, Son, Child
			INSERT INTO cDetail FROM MEMVAR
		ENDIF
	ENDSCAN
ENDIF	&& child

Cecil Champenois, Jr.

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