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.