Author | Topic: Local Variables In Filters? | |
---|---|---|
Al Wimberly | Local Variables In Filters? on Tue, 06 Apr 2010 11:23:48 -0400 Am I correct in assuming that using locally defined variables in filters is legal? It's working, but I'm a worrier and I remember the issues with Clipper/Advantage requiring the use of aofVarToString to convert a local variable to a pseudo constant. Example: nVar := 12345 myDBF->(dbSetFilter( { || myDBF->linknum == nVar }, "myDBF->linknum == nVar ")) I getting to be a very happy camper with this Xbase++ stuff! Thanks | |
James Loughner | Re: Local Variables In Filters? on Tue, 06 Apr 2010 13:46:01 -0400 Depends. Locals in codeblocks become "detached" locals. So your expression would work but if you later change nVar that change would not be seen in the codeblock since that variable has been detached. Use a private/public if you need to change the variable at a later time. Jim On 04/06/2010 11:23 AM, Al Wimberly wrote: > Am I correct in assuming that using locally defined variables in filters is > legal? It's working, but I'm a worrier and I remember the issues with > Clipper/Advantage requiring the use of aofVarToString to convert a local > variable to a pseudo constant. > > Example: > nVar := 12345 > myDBF->(dbSetFilter( { || myDBF->linknum == nVar }, "myDBF->linknum == nVar > ")) > > I getting to be a very happy camper with this Xbase++ stuff! > > Thanks > > > > |