Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cycle though tables in DataEnviornment
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00314653
Message ID:
00316026
Vues:
16
>Is there a way to programaticily cycle though all the tables in the DataEnvironment of a form? Seems like there should be a way I can have a For-Next loop that just goes though all the cursors in the DE (I'll know how many of them are there)
>
>Thanks....


Here is another solution - scenario,
If you have an public array (even better property array)
with multiple database mappings
e.g

declare DBC_MAPP(NnumberOfDatabasesInvolved,nPathMappings)

Somewhere at start of system (login let say)
you will assign exact run time positionings of databases
(fill up the array)

dbc_mapp(i,1)='MYDATABASE.DBC' &&name
dbc_mapp(i,2)='F:\RUN_TIME_PATH_TO_IT\' &&exact path
etc.
.
.
.

Now, here is method of a class 'public_object'
Class LIbrary - \libs\mypublicmethods.vch
based on custom with different public methods
(simillar to UDF's & set procedure to ...)

public_object.apply_relative_paths() &&method

*****************************method begin
lparameters oDataenvironment
local i,j,k,db_name,arr_obj
external array dbc_mapp
declare arr_obj(1)
amembers(arr_obj,oDataenvironment,2)
for i = 1 to alen(arr_obj)
j = oDataenvironment.&arr_obj(i) .baseclass
if upper(alltrim(j)) = 'CURSOR'
db_name=justfname(upper(allt(oDataenvironment.&arr_obj(i) .database )))
k=ascan(dbc_mapp,db_name)
if k > 0
k=asubscript(dbc_mapp,k,1)
else
messagebox('Database ' + db_name + ' Not recognized by system')
return .f.
endif
if file(upper(dbc_mapp(k,2))+upper(dbc_mapp(k,1)))
oDataenvironment.&arr_obj(i) .database=upper(dbc_mapp(k,2))+upper(dbc_mapp(k,1))
else
messagebox('['+upper(dbc_mapp(k,2))+upper(dbc_mapp(k,1))+']'+chr(13)+' Database/Path does not exist!')
return .f.
endif
endif
endfor
return .t.
**********end of method

and then in
'BeforeOpenTables' method of a yourform.databaseenvironment (DE)
you can now call this method like:

public_object.apply_relative_paths(this) && whole DE passed as parameter

(asuming that 'public_object' has been instantiated before)
This will redirect your cursors towards right run time paths
(if they are properly stored in array dbc_mapp)
and then without any further interventions
DE.OpenTables() by itself (by default)
will bring up propper tables into cursors.

Free tables are not concerned by this method but this
can be easy upgraded to do so.

I hope this or something simillar will help you to resolve your
(FAQ) RUN_TIME_PATHS problem.
Regards

Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

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

Click here to load this message in the networking platform