Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Ilya Rabyy
  Where is Ilya Rabyy?
 Fountain Valley
 California - United States
 Ilya Rabyy
 To: Christian Tabligan
  Where is Christian Tabligan?
 Bacolod City, Neg. Occ.
 Philippines
 Christian Tabligan
 Tags
Subject: RE: Best Coding Practices for Newbies
Thread ID: 160033 Message ID: 160310 # Views: 92 # Ratings: 2
Version: Visual FoxPro 8 Category: General VFP Topics
Date: Wednesday, February 13, 2008 8:28:26 PM         
   


> >
> > I wouldn't give the & such a high praise, not anymore. It worked great in FPD and early versions of VFP, but lately I switched to using ( ) instead. For instance, you need to append certain records from some table to the currently selected one:
> >
> >
&& The old way:
> > LOCAL lcDBF
> > 
> > lcDBF = DBF("SourceTableAlias")
> > APPEND FROM &lcDBF FOR RECNO(("SourceTableAlias") >= 1000
> > 
> > && The new way:
> > APPEND FROM (DBF("SourceTableAlias")) FOR RECNO(("SourceTableAlias") >= 1000

> >
> > That is not mentioning that, when you have long path/file names with spaces in the middle (notoriously - C:\Documents And Settings\Christian\My Documents, and everything else off the Docs&Sets directory) - ( ) works better, IMHO, than & .
> > So, I reserved the & for complex, built-on-the-fly SELECT statements, and use ( ) everywhere else.
> >
> > Regards,
> >
> > Ilya
> Hi,
>
> There's a lot of alternative techniques in VFP. And that's what the so-called "flexibility". I also tried to used your given example.
>
>
lcAppend = [APPEND FROM (DBF("SourceTableAlias")) FOR RECNO(("SourceTableAlias") >= 1000]
> &lcAppend
> 

> ... =)
>
> Christian M. Tabligan
>
> Visual FoxPro is like a game...need to explore until you reach your goal to success!!!

Of course, colleague, if you need to build a command with unknown values - macro is the tool of choice. For instance, in a function/method manipulating a given table/alias, in order to leave the everything as it was in the beginning when exiting, I do

LPARAMETERS tcAlias
LOCAL lcPrevArea, lcPrevRecNo

lcPrevArea = [SELECT ] + TRANSFORM(SELECT(ALIAS))
lcPrevRecNo = [GO ] + TRANSFORM(RECNO(tcAlias)) + [ IN ] + tcAlias
&& Whatever the code needed to be executed; and on exiting
&lcPrevRecNo
&lcPrevArea
RETURN luRet

But then - again, I found out (after introducing Win9.xx and WinNT4, with the long folder names containing spaces, ampersands, etc.) that macro often got confused. I switched to implicit EVAL() (what in fact "()" is) - and it worked. I tried to use () wherever I could and it worked in most of the cases where I needed.

Again, it's the matter of choice, mostly.

Regards,

Ilya



COMPLETE THREAD
Best Coding Practices for Newbies Posted by Dan Baker @ 2/11/2008 9:45:47 PM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 2/11/2008 10:20:17 PM
RE: Best Coding Practices for Newbies Posted by Marcia Akins @ 2/11/2008 10:37:35 PM
RE: Best Coding Practices for Newbies Posted by Bernard Bout @ 2/12/2008 3:13:39 AM
RE: Best Coding Practices for Newbies Posted by tushar @ 2/12/2008 3:44:07 PM
RE: Best Coding Practices for Newbies Posted by Glenn Villar @ 4/26/2008 8:44:34 AM
RE: Best Coding Practices for Newbies Posted by Cetin Basoz @ 2/12/2008 3:52:43 PM
RE: Best Coding Practices for Newbies Posted by Leslie Botchway @ 2/12/2008 11:12:49 PM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 2/13/2008 2:12:32 AM
RE: Best Coding Practices for Newbies Posted by Leslie Botchway @ 4/28/2008 1:38:57 PM
RE: Best Coding Practices for Newbies Posted by Jun Tangunan @ 4/28/2008 3:02:59 PM
RE: Best Coding Practices for Newbies Posted by Lyrad Bangoy @ 4/29/2008 9:33:26 AM
RE: Best Coding Practices for Newbies Posted by Christian Tabligan @ 4/29/2008 10:05:09 AM
RE: Best Coding Practices for Newbies Posted by Lyrad Bangoy @ 4/29/2008 10:19:00 AM
RE: Best Coding Practices for Newbies Posted by Cetin Basoz @ 4/29/2008 10:49:48 AM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/29/2008 7:31:25 PM
RE: Best Coding Practices for Newbies Posted by Cetin Basoz @ 2/13/2008 11:15:28 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 2/14/2008 7:20:53 PM
RE: Best Coding Practices for Newbies Posted by Pamela Thalacker @ 2/12/2008 9:17:58 PM
RE: Best Coding Practices for Newbies Posted by Tamar Granor @ 2/12/2008 11:13:57 PM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 2/13/2008 2:17:48 AM
RE: Best Coding Practices for Newbies Posted by Bernard Bout @ 2/13/2008 5:55:54 AM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 2/13/2008 10:28:13 AM
RE: Best Coding Practices for Newbies Posted by Christian Tabligan @ 2/13/2008 2:37:30 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/13/2008 7:14:07 PM
RE: Best Coding Practices for Newbies Posted by Andy Kramek @ 2/13/2008 7:39:02 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/13/2008 8:12:51 PM
RE: Best Coding Practices for Newbies Posted by Christian Tabligan @ 2/13/2008 7:46:29 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/13/2008 8:28:26 PM
RE: Best Coding Practices for Newbies Posted by Christian Tabligan @ 2/13/2008 8:48:11 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/13/2008 9:01:18 PM
RE: Best Coding Practices for Newbies Posted by Juan Antonio Santana @ 2/13/2008 3:46:59 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/13/2008 7:28:57 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 2/14/2008 7:31:37 PM
RE: Best Coding Practices for Newbies Posted by Ilya Rabyy @ 2/14/2008 8:45:29 PM
RE: Best Coding Practices for Newbies Posted by Sandeep Misra @ 4/26/2008 4:16:39 AM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 4/26/2008 2:36:22 PM
RE: Best Coding Practices for Newbies Posted by Sandeep Misra @ 4/28/2008 5:12:22 PM
RE: Best Coding Practices for Newbies Posted by Tamar Granor @ 4/28/2008 10:51:51 PM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/27/2008 1:18:05 AM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/27/2008 7:39:42 AM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/27/2008 12:59:24 PM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/27/2008 2:04:48 PM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 4/27/2008 2:21:02 PM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/28/2008 12:56:54 AM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/28/2008 7:02:40 AM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/28/2008 1:33:37 PM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/28/2008 9:06:34 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/28/2008 9:40:31 PM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/28/2008 9:54:04 PM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/29/2008 12:38:25 AM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/29/2008 6:23:59 AM
RE: Best Coding Practices for Newbies Posted by Jun Tangunan @ 4/29/2008 7:33:02 AM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/29/2008 3:43:15 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/29/2008 7:39:47 PM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/29/2008 8:54:01 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/30/2008 1:08:53 AM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/30/2008 6:51:25 AM
RE: Best Coding Practices for Newbies Posted by Kevin @ 4/26/2008 6:47:17 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/26/2008 10:09:55 PM
RE: Best Coding Practices for Newbies Posted by Kevin @ 4/27/2008 1:19:56 AM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 4/27/2008 1:35:13 AM
RE: Best Coding Practices for Newbies Posted by Kevin @ 4/27/2008 1:45:30 AM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 4/27/2008 2:49:46 AM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/27/2008 5:09:04 AM
RE: Best Coding Practices for Newbies Posted by Ken Murphy @ 4/27/2008 2:29:00 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/27/2008 4:54:49 PM
RE: Best Coding Practices for Newbies Posted by anton d @ 4/26/2008 7:47:01 PM
RE: Best Coding Practices for Newbies Posted by Garth Groft @ 4/28/2008 8:59:33 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/28/2008 9:41:17 PM
RE: Best Coding Practices for Newbies Posted by tushar @ 4/28/2008 10:00:24 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/28/2008 11:14:16 PM
RE: Best Coding Practices for Newbies Posted by Tamar Granor @ 4/28/2008 10:56:38 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/29/2008 12:14:37 AM
RE: Best Coding Practices for Newbies Posted by Anders Altberg @ 4/29/2008 12:50:06 AM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/29/2008 7:41:24 PM
RE: Best Coding Practices for Newbies Posted by Garth Groft @ 4/29/2008 9:32:04 PM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/30/2008 1:11:06 AM
RE: Best Coding Practices for Newbies Posted by Tamar Granor @ 4/30/2008 1:53:41 AM
RE: Best Coding Practices for Newbies Posted by Garth Groft @ 4/30/2008 2:10:22 AM
RE: Best Coding Practices for Newbies Posted by Tamar Granor @ 4/30/2008 1:50:36 AM
RE: Best Coding Practices for Newbies Posted by Bernard Bout @ 4/30/2008 2:43:38 AM
RE: Best Coding Practices for Newbies Posted by Mike Yearwood @ 4/30/2008 3:45:10 PM
RE: Best Coding Practices for Newbies Posted by Lyrad Bangoy @ 4/29/2008 9:37:22 AM