Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best and fastest way for making a cursor
Message
De
25/06/2007 10:38:06
 
 
À
21/06/2007 10:26:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP1
Divers
Thread ID:
01234669
Message ID:
01235337
Vues:
16
>>dear all
>>I want to make an empty cursor based on one of my free table structure.
>
>In addition to Sylvain suggestion
>
>
>AFIELDS(laFields, "MyTable")
>CREATE CURSOR MyCursor FROM ARRAY laFields
>
>
>Additional few lines my come usefull to add extra fields
>and index cursor;
>
>alter table alias() add column pick  L
>alter table alias() add column rec_no N(6)
>index on myCursor.keyfield  tag mykey
>
>
>Beware of long field names when applied on dbc tables.
>
>HTH

Update:

Hi Reza,
(Sorry for accidentaly drifting this thread)
Before I forget; Next to long field names there is also issue
with afields() creating full structure array of 16 columns worth of
table info which includes update triggers, captions etc.

You might not need all that for memory cursors, while update/delete.. triggers might get you even in trouble if original alias is part of RI enriched/secred VFP database (DBC).

There4, in addition to what was said before here is also solution
including workarround function.
select YourAlias  

local aa(1)
=afields4(@aa)   &&Call to workarround function  
create cursor myEmptyCursor from array aa

*
*
*Add some Columns/Order it via Index key

alter table alias() add column bb c(1)
alter table alias() add column cc c(1)
index on bb tag bb   
Function below will fill up array already created / passed as parameter
with fat-free table fields structure (4 out of 16 columns) convinient for creating tmp cursors
As original Afields it also returns back number of fields
function afields4
    lparameters lArray
    local lArrStru(1) , i , j
    declare lArray(afields(lArrStru), 4 )
    for i=1 to alen(lArrStru,1)
        for j = 1 to 4
            lArray(i,j) = lArrStru(i,j)
        next
    next
    return alen(lArray,1)
HTH
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform