Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create index on Local Views...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00938374
Message ID:
00939996
Vues:
21
Yep, that should work. I certainly understand why you'd want an index on a view. I do the same thing myself. I always just make sure I open them with NODATAONLOAD = .T., index them empty, and then requery after the indexing is complete.

Alan

>Well in my case I need indexes because I do large query on the view.
>The View result is about 10000 records from a .DBF.
>
>To make sure the code do not get executed more then once I do this:
>
>PROCEDURE dbc_AfterOpenTable(cTableName)
>*After a table or view is opened.
>
>IF UPPER(cTableName)="VIEWPCKD_ALT"
>   INDEX ON sku TAG sku
>   INDEX ON pickno TAG pickno additive
>   INDEX ON numero TAG numero additive
>ENDIF
>
>ENDPROC
>
>
>That work fine for me.
>
>>I just did a check on the help. Are you aware that when you open a view, if the table(s) are not already open, the dbc_AfterOpenTable event occurs twice? Once for the opening of the table and once for the opening of the view. That means you're doing the index procedure twice in that case.
>>
>>In fact, if the view uses more than one table, then I suppose it will happen once for each table, and once for the view.
>>
>>Alan
>>
>>>What I am using is the DBC Event AfterOpenTable to create the index.
>>>
>>>This is a store prcedure call automaticaly when the view is open.
>>>It work fine form me.
>>>
>>>>If you're using a Form's DataEnvironment to open the views automatically, then probably the simplest thing to do is to set the cursor's NoDataOnLoad to .T., and then in the form's init, do an INDEX ON for the view and then REQUERY the view.
>>>>
>>>>If any controls rely on it for source data then you'll have to requery or refresh them too.
>>>>
>>>>If you're opening them manually, then open then NODATA, and index them at that point.
>>>>
>>>>Alan
>>>>
>>>>>When you use a local updatable view there is no index on the table.
>>>>>
>>>>>I need to large query on the data and to speed it up I need indexs on the table.
>>>>>
>>>>>What is the best way to have index on the Local Updatable view?
>>>>>Where do I store the creation of index? (Store Procedure)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform