Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding quotes to a string
Message
 
To
01/11/2006 11:33:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01165777
Message ID:
01166212
Views:
18
John,
Your code could be:
lcFilter = FILTER([YourAliasHere])
TEXT TO lcFilt NOSHOW PRETEXT 15 TEXTMERGE
     <<lcFilter>> <<IIF(EMPTY(lcFilter),[],[ AND ])>>
     INLIST(<<this.lcfield>>,'<<lcValue>>')
ENDTEXT
SET FILTER TO &lcFilt IN YourAliasHere
>Thanks Terry i appreciate your help. Now i want to show the full code that uses the solution provided by Sergey. some misunderstanding by others.
>
>*lcInst <== this is the var that keeps filter
>*this.lcfield name of the field
>*lcvalue value to filter
>IF EMPTY(lcInst) &&no previous filter
> lcInst = "set filter to INLIST("+ THIS.lcField +",'"+lcValue+"')   "
> ** 3 spaces to the end ...
>ELSE
> CAD1=ATC("INLIST("+this.lcfield,lcInst) &&find the inlist for field
> IF cad1 != 0 &&found inlist, add lcvalue to it
>  CAD0=SUBSTR(lcInst,1,CAD1-1) &&get the start of filter
>  CAD2=SUBSTR(lcInst,CAD1,LEN(lcInst)) &&get second part of filter
>  CAD3=SUBSTR(CAD2,1,AT("   ",CAD2)-2) &&get inlist code to be updated
>  CAD4=SUBSTR(CAD2,AT("   ",CAD2),LEN(CAD2)) &&get after inlist code
>  CAD=CAD3+",'"+lcValue+"')" &&merge
>  lcInst=CAD0+CAD+CAD4 &&new filter ok ;)
> ELSE &&create a new inlist
>  **if is a new inlist, note that 3 spaces are added to the end
>  lcInst=lcInst+" AND INLIST("+this.lcfield+",'"+lcValue+"')   "
> endif
>ENDIF
>**this works perfectly with previous instructions that uses and so, this **solution helps to add new filter by mixing "and" with "or"
>**and.. i needed to use filters due to this form opens readonly any table to **let user be able to send to excel or whatever... Thank all.
>
>I never used before the button that specifies wich message is the solution, i found it today but i mark wrong message. Sorry about that.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform