>*I'm trying to create a View for a Grid in a Form, but the View must show diferent types of information depending on option's chosen by user in another page of a pageframe.
>*Depending of the option, the view show's only data between dates and or from some departments, and so on.
>*The best way I found is to use macro substitution for the where clause in SQL.
>
>*I cant make it work because it return's the following message, Alias not Found, in this case the own View or column z not found.
>
>*But if I try it in an program just like an SQL statement it works fine, but I need a view to use it in a grid, and the same grid cant have different views.
>
A view won't do what you want, because the macro expansion occurs when the CREATE VIEW is executed; the macro is not resolved at the time the view is accessed. If you absolutely must have view access-time resolution of the WHERE or HAVING clauses, you'll have to rely on EVAL() for it.
An alternative might be to create the view you need in a temporary DBC just before it is needed; you'd use a temporary DBC because the DBC would bloat over time from multiple CREATE VIEW and DELETE VIEW sequences, and to allow several people to work with their own unique view definition at any given moment.