7 Replies Latest reply on Dec 22, 2014 6:27 AM by Mike_Mitchell

    Can I switch the "Allow User Abort" per script?

      Hi there,

       

      can I use a variable to switch the "Allow User Abort" status in a scrpt? I want to "allow" this in a developer environment and "not allow" it on a live system.

       

      Kind regards,

      Luna

        • 1. Re: Can I switch the "Allow User Abort" per script?
          sabau

          Use if Get(AccountName) = "Admin"

          • 2. Re: Can I switch the "Allow User Abort" per script?
            Mike_Mitchell

            Luna -

            It depends on what you mean by "developer environment" and "live system". If you have a particular server in mind for each, you can use Get ( HostName ) to extract the name of the server hosting the file. From there, you can use If - Else If - End If conditional branching to set up the Allow User Abort script steps.

            OTOH, if you want to use a flag, such as stored in a variable, then you would need to set the flag in a script during the OnFirstWindowOpen script. Then use the flag for the same purpose.

            As an aside, you're probably better, should you choose the second route, to store the flag in a global field, fed by an actual field in a single-record "settings" table, than to change it in your code.

            HTH

            Mike

            • 3. Re: Can I switch the "Allow User Abort" per script?

              This is what I like in this forum - fast replies, and - not only to the questions itself but also a step further. Thanks to all. First your helped me with the if-then... approach. This surely will do it. And in addition to thas you reminded me to update my actual approach from setting some "$$variables" to do this through an administrative table, I think for being able to set values more conveniently...

               

              One question to Mike:

               

              you recommended a single-record table with "normal" (non-global) fields. I think this is to really have these fields set. If I would use a global field I would have to set them initially each time a new user is added, correct? And as the table only has one record - its behaves like a global field...

               

              But then you mentioned to store the value(s) from this 1-record-table in "global fields"? Why that? I need the value(s) systemwide to be the same. Therefore I can read them into a "$$variable" while opening the database-file and use this. Do you recommend the storing in a global field for the idea if this initially set variable might be re-set per user later on?

               

              Kind regards,

              Luna

              • 4. Re: Can I switch the "Allow User Abort" per script?
                Mike_Mitchell

                Yes, you will need to set the global field when each user logs in (hence the use of the OnFirstWindowOpen trigger).

                 

                A global field can be addressed from anywhere in the solution, regardless of context, without requiring a relationship. If you use the normal field, you'd either have to switch context or draw a relationship to the settings table to use it from anywhere.

                 

                The reason for using a global field instead of a variable is for security. A user with FileMaker Advanced can override the value in a global variable by using the Data Viewer. You probably don't want that.

                • 5. Re: Can I switch the "Allow User Abort" per script?

                  Thanks. Not to have to relate to the central table is surely minimizing my TO-overview.But this does mean that I double my fields?

                   

                  Because I need a "store"-field where I can set a central value once (for all users) and a second global field that will be loaded on OnFirstWindowOpen for each user when logging in?

                  • 7. Re: Can I switch the "Allow User Abort" per script?
                    Mike_Mitchell

                    Which is why, if you can extract the value using the environment functions, you should do that instead (e.g., Get ( HostName )).