Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSessions and the control thereof
Message
From
22/05/2009 12:05:01
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
DataSessions and the control thereof
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01401547
Message ID:
01401547
Views:
104
Hello Gentle Peoples

Got an error cropping up from a form "DataSession is not valid" and it's occuring out of the following code that runs on refresh of the toolbar
*-- Override the parent class method so that it returns
*-- .F. when the lAllowDelete property doesn't exist.

LOCAL llRetVal, lnThisDataSession, lcAlias

llRetVal = .F.
IF TYPE("_screen.ActiveForm.lAllowDelete") <> "U" 

** llRetVal is set to .T. here

  llRetVal = _screen.ActiveForm.lAllowDelete AND ;
      NOT _SCREEN.ActiveForm.lReadOnly
ENDIF

IF llRetVal
  lnThisDataSession = SET('DATASESSION')
  =messagebox("In allowdelete, lnThisDatasession is " + str(lnThisDataSession))
  SET DATASESSION TO _screen.ActiveForm.DataSessionID
  =messagebox("In allowdelete, Datasession set to " + str(SET('DATASESSION')))

  IF TYPE("_screen.ActiveForm.oBizObj") == "O" AND ;
      !ISNULL(_screen.ActiveForm.oBizObj)
    *-- Get the alias for the primary business object on
    *-- the active form
    lcAlias = _screen.ActiveForm.oBizObj.GetAlias()
  ELSE
    *-- Use the current alias
    lcAlias = ALIAS()
  ENDIF

  *-- The intention is to disable the delete option if the user
  *-- is currently adding a new record.
  IF !EMPTY(lcAlias) 
    llRetVal = !IsAdding(lcAlias)
  ENDIF
  =messagebox("Exiting allowdelete, Datasession set back to " + str(lnThisDataSession))
  SET DATASESSION TO lnThisDataSession        && Errors on this Line
ENDIF

RETURN llRetVal
The form moves/copies patients between caregivers and when moving one client, everything works fine. It's when there are multiple 'uses' that this error comes up.

From the messageboxes I've got the following:
Entering:  1
               6
               1
1st move/copy
               1
               6
               1
2nd
               6
               6
               6
Exit form
               6
               5
               6
Is there some reason to be setting/resetting datasession?
Can I simply 'set' the original value to 1 and not kill anything?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Next
Reply
Map
View

Click here to load this message in the networking platform