Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Re-defining local views on the fly
Message
De
15/09/1999 09:51:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/09/1999 08:55:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00264881
Message ID:
00264900
Vues:
17
>I have a read only grid whose recordsource is local view
>it displays also information from relate tables.
>
>When user presses find button, a list of query names is presented.
>After selection, a create view command is created according to selected query and executed.
>New view having differeng where condition is created.
>Records returned by this new view needs to be show in grid.
>However, after creating new view, grid is empty and relations are lost
>seting temporarily grid.recordsource='' before create view doesnt help.
>
>How to switch views?


After creating your view are you using it in 0 ? If columns are different also set columncount = -1 before assigning recordsource.

OTOH if that's readonly why are you using views ? You could just use SQL as recordsource :
RecordSourceType = 4
RecordSource = "select * from mytable where lSomeExpression"

To change :
RecordSource = ""
RecordSource = "select * from mytable where lNewExpression"

Even the expression could be parametric so you don't need to change "recordsource" too. Just supply parameter and refresh the grid.

RecordSource = "select * from mytable where SomeField = thisform.SomeProperty"

thisform.Someproperty = "New Value"
thisform.myGrid.refresh

But if you use this approach be sure you have an index on field(s) used in where clause.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform