>Create Database myTest >for ix = 1 to 100 > If Indbc('v1',"VIEW") > drop view v1 > endif > create sql view v1 as ; > select * from (lccustomer) ; > where cust_id = ?lcCustID >endforeach time I need to change me view definition. As you say it would bloat the view and it would be worth nothing for me, because I need to USE one view and bound it to control's ControlSource property. Later I do REQUERY the view to get actual records from the underlaying structure.
*with version < 8.00 lcMacro = '' create sql view v1 as ; select * from (lccustomer) ; &?lcMacro *notice the macroexpansion &?lcWhere USE V1 *this gives all Data in (lccustomer) ?CURSORGETPROP("SQL",ALIAS()) *you will see the unexpanded <i>&?lcMacro</i> in the SQL string lcMacro = "where cust_id = lcCustID" lcCustID = 'SomeString' Requery() *this gives all Records with cust_id = lcCustID lcMacro = '' Requery() *this again gives all Records, but without to run a where clause in the requery *imagin I do TEXT TO lcMacro WHERE cust_ID IN (SELECT Customer FROM otherTable; WHERE SomeStatement) ENDTEXT lcMacro = STRTRAN(STRTRAN(lcMacro,CHR(13),' '),CHR(10),'') REQUERY() *this will produce a differnt result, but it keeps the same View and holds all controlsources open.>OTOH a cursoradapter might simply change the SelectCmd and CursorFill.
THIS.SelectCMD = THIS.SelectCMD+'&'+'lcMacro' *notice the use '&'+'lcMacro', this is different to '&lcMacro' if lcMacro existsThis again will use in a macroexpansion that run in CursorFill and in Cursorrefresh()