Hi Romano,
i think the Problem is within your parameter, the SELECT SQL is Ok.
Thats what I do
lcWhere=''
CREATE SQL VIEW 'prean' AS SELECT blah, blah INNER JOIN;
pre ON blah, blah &?lcWhere
if needWhere THEN
cLista = '0'
lcWhere = 'ALLTRIM(STR(pre.p,20,0))$cLista'
lcWhere = 'ALLTRIM(STR(pre.p,20,0))$"'+cLista+'"'
ELSE
lcWhere =' '
ENDIF
use prean
important is to miss "?" in lcWhere
Agnes
>>If the parameter variable exists before you create the view then it should not have to ask you for it.
>>
>
>Other people have suggested me you answer too, but it hasn't worked yet.
>Here is a example of what I'm trying to do:
>
>cLista='0'
>cExpr='ALLTRIM(STR(pre.p,20,0))$?cLista=.T.'
>
>
>CREATE SQL VIEW 'prean' AS SELECT blah, blah INNER JOIN;
> pre ON blah, blah where &?cExpr
>
>I even tried this:
>
>cLista='0'
>
>CREATE SQL VIEW 'prean' AS SELECT blah, blah INNER JOIN;
> pre ON blah, blah where ALLTRIM(STR(pre.p,20,0))$?cLista
>
>
>Before I added the 'where &?cExpr' the view worked well. Moreover I
>had used the same expression in a view before and it had worked
>too, but now I don't know why the combination isn't working.
>
>what could be wrong?
>Could be that I'm using a cursor?
>
>The error message I get says something about a key word is not being recognized in a command.
>
>
>Thanks for your answer.
>
>
>>As far as pre creating the view is concerned I think you can do that, as a view can use a free table so why not a cursor? Just create the cursor before you create the view and don't forget to create the cursor before you try to edit the view later on.
>>
>>HTH
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]