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