FoxInCloud
Custom object changing data session
Gravatar is a globally recognized avatar based on your email address. Custom object changing data session
  Paul
  All
  Feb 20, 2019 @ 03:22pm

Hi,

I am running V 2.28.1-beta.2

Situation : public object - DefaultsObject has a property - Object2

DefaultsObject.Object2 = createobject("SomeClass")

The class SomeClass is based on sficcst (custom) and has some methods on it.

Problem :
Following on from my previous post the methods on the object now work, but the datasession is changing whenever a method is run on the object - but only if I log on for the second time.

Symptom :

  1. navigate to login form (default datasession)
  2. from inside the form, create the object and run a method on it - all fine
  3. close the browser tab
  4. new tab, navigate to login form (default datasession)
  5. log in
  6. from inside the form, create the object and run a method on it - crash - the datasession is different so the database set("database") is not set

The first time through the datasession = 2, Awapphost.
The first time through the datasession = 9, Awappuserenv.

Any ideas?

Thanks
Paul

Gravatar is a globally recognized avatar based on your email address. re: Custom object changing data session
  FoxInCloud Support - Thierry N.
  Paul
  Feb 21, 2019 @ 02:23am

Hi Paul,

1- I would create the object once for all in xxxSets.Init(), and set it up for the user after .wUserLogIn() and cleanup after .wUserLogOff(); it'd be simpler and faster when restoring the user's state than discarding the object and re-creating it when user logs back in; in short I would keep all public objects (and child objects) alive across the life of the application.

You get the rationale behind: while in a desktop application dealing with a single user you can create and discard resources for a single use, FoxInCloud shares resources across users and saves and restores their state upon each action (except when the same user hits the same server twice in a row).

Not sure how much change it would imply for you, you may just use thisForm.wlLAN or wlLAN() as a condition to discard Object2

2- However I don't understand how your object's code can run in the dataSession of the object that restores the application environment for the user (awAppUserEnv).
Even if awAppUserEnv has (re)created Object2, the code in a custom object always executes in the dataSession of the caller; in your case the login form running in the default datasession, which should be the awAppHost dataSession (unless it runs in the awAppUserEnv dataSession, and I don't see any reason for this to happen).

Would you mind trying to understand this dataSession switching mystery?

3- Anyway, before restoring a public variable of type Object, awAppUserEnv should switch to the application's dataSession (awAppHost) where public variables are created initially, so that .Init() and/or *_assign() code executes in the application's datasession.

We've implemented this change in a experimental aw.app that you can download from ftp://foxincloud.com/aw.app and save to home(1) + "tools\ab\aw\aw.app" (updated: removed _source\)

Please feedback if this fixes this issue.

Gravatar is a globally recognized avatar based on your email address. re: Custom object changing data session
  Paul
  FoxInCloud Support - Thierry N.
  Mar 26, 2019 @ 08:13pm

I have finally returned to looking at FiC!

I do not know why the data session switched, it made no sense.
Anyway, your latest aw.app fixed the problem for me 😃 Thank you.

Paul

Gravatar is a globally recognized avatar based on your email address. re: Custom object changing data session
  FoxInCloud Support - Thierry N.
  Paul
  Mar 26, 2019 @ 10:59pm

Hi Paul,

Welcome back…

Did this enhancement of 2.28.1-beta.3 fix your issue?

Gravatar is a globally recognized avatar based on your email address. re: Custom object changing data session
  Paul
  FoxInCloud Support - Thierry N.
  Mar 27, 2019 @ 01:53pm

Yes, the problem with custom objects and their properties and methods has gone away.

Gravatar is a globally recognized avatar based on your email address. re: Custom object changing data session
  FoxInCloud Support - Thierry N.
  Paul
  Mar 28, 2019 @ 04:53am

cool thanks for the FB

© 1996-2024