* Description.......: Creates a private datasession and an object by which you can control it. * Calling Samples...: DO CREATEPRIVATEDATASESSION WITH "oReportData" * : Use "RELEASE <object name> to close (i.e. RELEASE oReportData). * Parameter List....: tcclassname = Name of datasession object created. * Returns...........: Nothing * How to use : After creating the object (passed parameter). Change your datasession to the one ; * : created by typing SET DATASESSION TO oReportData.datasessionid. * : Then open any tables you need and process. * : When your done, you need to move back to your previous work area like: * : "SET DATASESSION TO oReportData.ppriordatasession". Then release the object ; * : "RELEASE oReportData * : * Properties : ppriordatasession = Holds the datasession id of the datasession you were in ; * : at the time of creating the object. ************************************************************ procedure CREATEPRIVATEDATASESSION parameter tcClassName *--- Check if already exists. if type(tcClassName)="O" return endif public &tcClassName &tcClassName = createobject('privatedata',set('DATASESSION')) define class privatedata as session ppriordatasession = set('DATASESSION') procedure init parameter tnpriordatasession *--- scoped to data session... set deleted on set century on set talk off set multilocks on set exact on set ansi on set near off * -- this.ppriordatasession = tnpriordatasession endproc *!* PROCEDURE setdatasession *!* PARAMETER tndatasession *!* This.ppriordatasession = SET('DATASESSION') && Save current datasession. *!* SET DATASESSION TO tndatasession && Change datasessions *!* ENDPROC enddefineThis idea works, but I prefer to just use session class directly, if I need a separate DS for some programs...