Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dynamic View
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00540559
Message ID:
00541924
Vues:
18
>Hi Larry - thanks for replying. I was hoping to provide a way in which users could pre-define criteria and then select the criteria whilst viewing their customer table.
>They open the customer form and all the records are showing. Previously they set a filters, one could be called "Above 50,000". Once they select that filter the view requery's the table with the filter cu_turnover > 50,000 etc. They may want to filter on anything though which make it a bit tricky!
>At the moment (with Kev's help) I have a filter in the view which I can define the field I want and the value (but I can't change the operator!) and I have to be wary about what field type it is. It's very limited...
>What's the idea with the object recieving the SQL?
define class CusSQLView as Custom
procedure Requery
lparameters tcSQL, tcAlias
local llretval, lcsql
llretval = .T.
lcsql = space(0)

if vartype(tcSQL) <> "C" ;
   or empty(tcSQL) then
   llretval = .F.
   * generate error
endif

if llretval ;
   and (vartype(tcSQL) <> "C" ;
   or empty(tcSQL)) then
   llretval = .F.
   * generate error
endif

if llretval then
   lcsql = tcSQL + [ into cursor ] + tcAlias
   &lcsql
endif
return llretval
endproc
enddefine
You could modify this so that only the filter criteria (WHERE clause) is passed.

tcAlias would be the name of the view. If you need it writable , you can use the old VFP 6 technique and select it into a temporary cursor and open it again making it writable. If using VFP 7, simply add the new READWRITE keyword to the INTO CURSOR clause.

You would need to drop one of these objects on your form in order for it to participate in the same datasession. In this way, you wouldn't need to pass the datasession of the form along with the other information. You could also make this a program/procedure and it would alwyas participate in the datasession that called it.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform