Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substituion in views
Message
De
11/05/2000 13:50:03
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Macro substituion in views
Divers
Thread ID:
00368677
Message ID:
00368677
Vues:
64
*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.

*Could someone help me please.

* TIA
* p.wagner@zaz.com.br

* Original View ************************************************************
* CREATE SQL VIEW "V_DESPESAS2" ;
* AS SELECT Despesas.data, Despesas.valor, Loteamentos.nome, ;
* Despesas.descricao, Despesas.loteamento, Despesas.cod_banco, ;
* Despesas.cheque_num, Despesas.codigo, Despesas.cod_custo FROM ;
* data1!despesas RIGHT OUTER JOIN data1!loteamentos ON ;
* Despesas.loteamento = Loteamentos.codigo ;
* WHERE &xx.
**********************************************************************

*This part of an prg works

set date to british
SET STRICTDATE TO 0
open database c:\aa\atuante\dados\data1.dbc && open database


*data1 = {01/05/2000} && variable 1
*data2 = {30/05/2000} && variable 2
&& Only Dates
*xx = 'Despesas.data BETWEEN data1 and data2 and DELETED() <> .T.'

&& Only Department ( CODE )
*loteamentox = "1 "
*xx = 'Despesas.loteamento = loteamentox and DELETED() <> .T. '

&& Department and Dates
*data1 = {01/03/2000}
*data2 = {30/05/2000}
*loteamentox = "2 "
*xx = 'Despesas.loteamento = loteamentox and Despesas.data BETWEEN data1 and data2 and DELETED() <> .T.'

&& Department and Cost unit
loteamentox = "2 " && variable 3
Custox = "2" && variable 4
xx = 'Despesas.loteamento = loteamentox and Despesas.cod_custo = Custox and DELETED() <> .T.'


SELECT Despesas.data, Despesas.valor, Loteamentos.nome, ;
Despesas.descricao, Despesas.loteamento, Despesas.cod_banco, ;
Despesas.cheque_num, Despesas.codigo, Despesas.cod_custo FROM ;
data1!despesas RIGHT OUTER JOIN data1!loteamentos ON ;
Despesas.loteamento = Loteamentos.codigo ;
WHERE &xx. into cursor CurDespesas


* =REQUERY("V_DESPESAS2") && doesnt work if used with View

browse

WHY ?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform