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: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: Two conditions in IF Statement
Thread ID: 345461 Message ID: 345464 # Views: 47 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 3:19:33 PM         
   


> > The second part of the IF condition doesn't seem to ever work. The "S" represents a SPOUSE.
> >
> > SELECT tmpCursorABQ
> > SCAN
> > 	* If there is a Spouse, get the Name and Date of Birth and put this data
> > 	* into the above cursor.
> > 	lcID=tmpCursorABQ.GrpID+tmpCursorABQ.GrpNum
> > 	IF SEEK(lcID, "GRPEXTDP", "FULL_KEY") AND LEFT(GRPEXTDP.Relatecd,1)="S"
> > 		REPLACE ;
> > 			tmpCursorABQ.SpouseFN  WITH GRPEXTDP.FirstName, ;
> > 			tmpCursorABQ.SpouseIn  WITH GRPEXTDP.Initial, ;
> > 			tmpCursorABQ.SpouseLN  WITH GRPEXTDP.LastName, ;
> > 			tmpCursorABQ.SpouseDOB WITH DTOS(GRPEXTDP.DOB)
> > 	ENDIF
> > ENDSCAN
> > 

> > Cecil Champenois, Jr.
>
> What does it do?
>
> PS: You can also write that as an update (replace with the key expression instead of full_key):
>
>
Update tmpCursorABQ ;
>  set SpouseFN = GRPEXTDP.FirstName, ;
> 	SpouseIn  = GRPEXTDP.Initial, ;
> 	SpouseLN  = GRPEXTDP.LastName, ;
> 	SpouseDOB = DTOS(GRPEXTDP.DOB) ;
>  from GRPEXTDP ;
>  where tmpCursorABQ.GrpID+tmpCursorABQ.GrpNum = GRPEXTDP.Full_Key

>
I do like that since you have control over the WHERE clause of the update. I'll try that. I came up with an alternative that does work also:
Thanks Cetin!
Cecil
SELECT tmpCursorABQ
SCAN
	* If there is a Spouse, get the Name and Date of Birth and put this data
	* into the above cursor.
	lcID=tmpCursorABQ.GrpID+tmpCursorABQ.GrpNum
	IF SEEK(lcID, "GRPEXTDP", "FULL_KEY")
		SELECT GRPEXTDP
		LOCATE WHILE GRPEXTDP.GRPID+GRPEXTDP.GRPNUM=lcID FOR LEFT(GRPEXTDP.Relatecd,1)="S"
		IF FOUND()
			REPLACE ;
				tmpCursorABQ.SpouseFN  WITH GRPEXTDP.FirstName, ;
				tmpCursorABQ.SpouseIn  WITH GRPEXTDP.Initial, ;
				tmpCursorABQ.SpouseLN  WITH GRPEXTDP.LastName, ;
				tmpCursorABQ.SpouseDOB WITH DTOS(GRPEXTDP.DOB)
		ENDIF
	ENDIF
ENDSCAN



>

> Cetin Basoz
>
> .Net has got better.Think about moving - check my blog:
> My Blog
> Blog (mirror) - sounds to be down
>

> Support Wikipedia


Cecil Champenois, Jr.

ENTIRE THREAD

Two conditions in IF Statement Posted by Cecil Champenois @ 5/23/2012 3:01:21 PM
RE: Two conditions in IF Statement Posted by Cetin Basoz @ 5/23/2012 3:15:26 PM
RE: Two conditions in IF Statement Posted by Cecil Champenois @ 5/23/2012 3:19:33 PM
RE: Two conditions in IF Statement Posted by Cetin Basoz @ 5/23/2012 3:31:29 PM
RE: Two conditions in IF Statement Posted by Mike Yearwood @ 5/23/2012 4:43:26 PM