mjcmkrsr
Technical User
- Nov 30, 2010
- 840
Hi,
I'm confused with a strange behaviour of views. I'm working with one test dataset and one real dataset. I switch from one set to the other with this code in the BEFOREOPENTABLES event of the form's dataenvironment.
Local cObjClass, cObjName, cOldDatabase, cNewDatabase, oReference
Local Array aCursors[1]
If Not (Empty(gcDrive) Or Empty(gcPath)) && two general variables from main program
= AMEMBERS(aCursors, THISFORM.Dataenvironment, 1)
For i = 1 to ALEN(aCursors,1)
If aCursors(i,2) = "Object"
cObjClass = "THISFORM.DATAENVIRONMENT." + aCursors(i,1) + ".Class"
If EVAL(cObjClass) = "Cursor"
cObjName = "THISFORM.DATAENVIRONMENT." + aCursors(i,1) + ".DATABASE"
cOldDatabase = EVAL(cObjName)
cNewDatabase = AllTrim(gcDrive) + AllTrim(gcPath) + AllTrim(Substr(cOldDatabase, RAT("\",cOldDatabase) + 1))
oReference = EVAL("THISFORM.DATAENVIRONMENT." + aCursors(i,1))
oReference.Database = cNewDatabase
Endif
Endif
EndFor
_Screen.Caption = gcCaption + " - " + gcDrive + gcPath
Endif
The views are opened with NODATAONLOAD = .T. and are REQUERYd after being opened.
When I switch from one dataset to the other, the data in the tables are correctly displayed whereas the views do not display the correct data and seem to stick to some temporary file.
Any hints are appreciated.
Mark
I'm confused with a strange behaviour of views. I'm working with one test dataset and one real dataset. I switch from one set to the other with this code in the BEFOREOPENTABLES event of the form's dataenvironment.
Local cObjClass, cObjName, cOldDatabase, cNewDatabase, oReference
Local Array aCursors[1]
If Not (Empty(gcDrive) Or Empty(gcPath)) && two general variables from main program
= AMEMBERS(aCursors, THISFORM.Dataenvironment, 1)
For i = 1 to ALEN(aCursors,1)
If aCursors(i,2) = "Object"
cObjClass = "THISFORM.DATAENVIRONMENT." + aCursors(i,1) + ".Class"
If EVAL(cObjClass) = "Cursor"
cObjName = "THISFORM.DATAENVIRONMENT." + aCursors(i,1) + ".DATABASE"
cOldDatabase = EVAL(cObjName)
cNewDatabase = AllTrim(gcDrive) + AllTrim(gcPath) + AllTrim(Substr(cOldDatabase, RAT("\",cOldDatabase) + 1))
oReference = EVAL("THISFORM.DATAENVIRONMENT." + aCursors(i,1))
oReference.Database = cNewDatabase
Endif
Endif
EndFor
_Screen.Caption = gcCaption + " - " + gcDrive + gcPath
Endif
The views are opened with NODATAONLOAD = .T. and are REQUERYd after being opened.
When I switch from one dataset to the other, the data in the tables are correctly displayed whereas the views do not display the correct data and seem to stick to some temporary file.
Any hints are appreciated.
Mark