Information générale
Titre:
Confusion over dataSessions
I must be making a mistake in assuming how * I * think things should work here - I need help!
I have a StartUp form that runs in the Default DataSession; it opens all the files that will be used in reports, etc. in it's Data environment. Users can launch other forms from this StartUp form or from the menu.
Every other non-modal form in the system uses Private DataSessions.
My reports are called from the REPORT menu, and all call ReportIt.Prg, w/a parameter that specifies what report should be run.
I want all my reports to run in THE Default DataSession (1), no matter what other forms are open. If other forms are open, I thought, that to allow reports to run in DS 1, what I'd have to do is:
- at the beginning of ReportIt, do the following:
nSaveDataSessionID = SET( "DataSession" ) && save the current data session
Set DataSession to 1 && the default data session, used by the StartUP form
- at the end of ReportIt, to restore to the previous DS:
Set DataSession to ( nSaveDataSessionID ) && restore current data session before RETURNing
This doesn't work for me...looking at the debugger, and using a WAIT WINDOW to display values, the DS does not get changed. I tried, at the beginning of ReportIT:
nSaveDataSessionID = SET( "DataSession" ) && save the current data session
Set DataSession to 1 && the default data session, used by the StartUP form
nt = SET( "DataSession" )
wait window alltrim( str( nt ) ) + " is the datasession"
The results of the wait window display is 2! I feel like I'm missing something obvious, can anyone help point it out?
TIA J
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement