Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 To: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 Tags
Subject: RE: Two conditions in IF Statement
Thread ID: 345461 Message ID: 345470 # Views: 43 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 4:43:26 PM         
   


> >
> > 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.

Hi Cecil

Please keep in mind the really good advice to use the IN clause in any replace command. Further you could have used REPLACE WHILE after the seek.

Mike Yearwood
Microsoft MVP Visual FoxPro 2008, 2009
We have enough youth. We need a fountain of smart!
There may be many ways to skin a cat, but there are very few right ways to do it.

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