cknight Posted March 4, 2007 Posted March 4, 2007 I have my solution almost finished and i have created a User settings table but i must admit i have never created a Multi user solution so i am ignorant on how i load these into globals at start up (so i can use them without relationships). Can someone give me a heads up on this or a real simple example. I am stuck and wasting time any help would be appreciated
Genx Posted March 4, 2007 Posted March 4, 2007 Well, your User Settings table should have an account name field (i.e. the account name of that particular user)... When the user log's in, you have access to their account name using Get(AccountName). So all we do is a search via that field, using Get(AccountName) to identify who's logged in. Freeze Window Allow User Abort[off] Set Error Capture[on] Go To Layout[ User Settings Layout ] Enter Find Mode[] Set Field[ UserSettings::AccountName ; Get(AccountName) ] Perform Find[] If[ Get(LastError) <> 0] Go To Layout[ Home ] Show Custom Dialog[ "Error" ; "You do not have an account in the user settings table. Please request that admin set one up for you" ] Halt Script End If Set Field[ Globals::g_PersonName ; UserSettings::PersonName ] Set Field[ Globals::g_PersonStartLayoutPref ; UserSettings::g_PersonStartLayoutPref ] Go To Layout[ Home ]
Søren Dyhr Posted March 4, 2007 Posted March 4, 2007 I would perhaps call the table global'ish but using real global definitions gives me the creeps, use say Get(username) or the login as primary key for a relation. If a solution is iwp'ed isn't the session "specificness" particular reliable. Perhaps were there other problems in a huge solution we perhaps havn't debugged propperly, but expirience have shown us not to trust globals too much in that kind of environment. I use this practice with relations and as many TO's as required to get the functionality required in an anchor bouy setup - as perhaps an too precautions measure. But it gives me data stored in real fields, in case of freezes etc. --sd
Genx Posted March 4, 2007 Posted March 4, 2007 If a solution is iwp'ed isn't the session "specificness" particular reliable. Where is that written?
Søren Dyhr Posted March 4, 2007 Posted March 4, 2007 Well here by me! We might be fooled by something else, but I would still suggest the other practice - in order to be on the safe side. --sd
Genx Posted March 4, 2007 Posted March 4, 2007 Seems to work exactly the same for me, I just logged in with two browsers and FMP and compared the value of a global field. Each session retains global values specific to that session until the session timer is reached or the file is closed...
Søren Dyhr Posted March 4, 2007 Posted March 4, 2007 Yes, it might be the sessiontimer kicking in, anyway we lost a customer on it which was very bad indeed. --sd
Søren Dyhr Posted March 4, 2007 Posted March 4, 2007 On something we thought could be globally stored, in global fields ...well it wasn't me who dealt with the customer I'm just the subcontractor, but it seemed like we couldn't provide the required reliability with "user settings" ...the complaints could be something else burried deep deep down in a hardly anchor bouyied solution, my part of it was only to provide CF's and optimized relational structures ...I can't really tell how many of my dealings went into the solution over time ...I can only tell that the well dried out due to unreliable "user settings" - This is why I now fear too substantially relying on global fields - which pretty much is in thread with this point: mutual dependencies increases complexity ...which originate to a present version of this wiki: http://en.wikipedia.org/wiki/Global_variable --sd
bcooney Posted March 4, 2007 Posted March 4, 2007 Create a script, "Open System." Go to Layout "User Prefs" Set Field "gPref1", "Pref1" etc. Use File Options to have this script run on Open.
Genx Posted April 13, 2007 Posted April 13, 2007 ... I don't know, session specific variables are session specific variables... They don't loose their specificity unless the session expires and if the session expires then the actual db session expires i.e. it closes. I suspect your issue lay more in the setting of the globals than the apparent "erratic" behavior of the globals themselves.
fabriceN Posted April 13, 2007 Posted April 13, 2007 Have a look to this: VariablesLoad. The advantage of this technique (is that you don't have to bother with data type: calculated fields, related fields, global fields, or not-a-field-at-all...) everything on a layout is loaded into named global variables. There are two methods, of which one requires FM 8.5, but is more powerful. If your solution has more than one file, look at the other demo file (just underneeth), VariablesLog, which allows to take your settings from a file to another. Hope this helps.
Recommended Posts
This topic is 6493 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now