NetTalk Central

Author Topic: Xfiles question  (Read 3062 times)

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Xfiles question
« on: December 25, 2011, 03:31:06 AM »
I know - it's Xmas - but I have some deadlines and thought I would post this just before I go out for the day.

I am trying to use xFles to save Preferences but finding the global values are missing when needed. The Global outer group name in the dictionary has been set to threaded because the actual preference fields cannot be set to threaded within the group. However, setting the group name to threaded clearly does not work.

Does this mean that it is better to use a tps file for the preferences and/or set session variables?

Shame because xfiles works great in standard clarion applications but the theading issue here I think is probably breaking the functionality in web applications.

At the moment I only have 5 preference values so no big deal but as time goes on this could become a bit of a hassle, having to load the tps file and set the session variables, and of course save them again. XFiles was perfect.

Hope that makes sense and Merry Xmas to one and all.

John

Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Re: Xfiles question
« Reply #1 on: December 25, 2011, 05:44:37 AM »
John,

Are these for Global app settings such as web server port number etc.?  If so, do you need them threaded?  You should be able to set them to non threaded, then read them using X-Files upon app startup to set the Global variables that will affect the app as a whole.

But if you are talking about user preference setting for each person that logs into your web app, then that is far better handled as extra fields within your user table.

Cheers,
Devan

John Fligg

  • Sr. Member
  • ****
  • Posts: 361
    • View Profile
    • Ambrit Software
    • Email
Re: Xfiles question
« Reply #2 on: December 25, 2011, 02:23:52 PM »
Yes -these are for individual user settings. Shame as XFiles made it easy. No worries. Thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Xfiles question
« Reply #3 on: December 25, 2011, 10:30:50 PM »
>> these are for individual user settings.

Because your program has lots of threads,
and multiple users at the same time,
a global variable is not useful.

I think what you want to do is
at the moment of login (when a login is accepted) load the xml file into a local group (using xFiles) and immediately copy the contents of the group into session variables.
While it's possible to use a global, threaded group, it too would need to immediately be copied into session variables, so it serves no purpose for it to be declared globally.

cheers
Bruce