7 Replies Latest reply on Jan 7, 2010 12:14 PM by ninja

    Only allow a single record creation? possible?

    thumper

      Title

      Only allow a single record creation? possible?

      Post

      Hey guys!

       

      Another questions i got, ive been trying to set up a section on my database to allow entry of a few fields such as company name, address, phone number and website info, these fields i want to have displayed on every footer on all my layouts, but im not sure how to do this, see when i make a table for these fields users would be able to add new records of this table and there should only be allowed one record for this info. is there a way to only allow creation of a single record and is it possible to show this on every layout footer even if each layout is set to show records from different tables?

       

       

      Thanks in advanced

        • 1. Re: Only allow a single record creation? possible?
          ninja
            

          Howdy thumper,

           


          thumper wrote:

          when i make a table for these fields users would be able to add new records of this table


           

          Not if they can't go to a layout based on that table.  Restrict users from going to this layout via Accounts&Privileges.  Then they can't create records on that table.

           

          Make the fields for your company info global so you can tag them to whatever layout you wish.


          • 2. Re: Only allow a single record creation? possible?
            philmodjunk
               Here's another option: Use a portal to display the record and set the portal up so that there's now scroll bar and only one row visible. Using this layout, the users can edit the record or even delete the record and then create a new one, but won't be able to create 2 or more such records.
            • 3. Re: Only allow a single record creation? possible?
              shudder
                

              I don't want to overcomplicate, but you might also be able to do this with a Global Field (yeah, I know... everyone HATES global fields nowadays... jeez).  

               

              Serve the DB with the g field empty (so it always comes up empty when a user logs into the dbms), and then use scripting to create new records (you might want to disable the ability to create new records from the menus using Custom Menus...).  The first step of the script would be an If step that checks for a value in that g field.  If it does not see a value in the g field (because the user just opened the system up), a new record will be created in the target table and the rest of the script will run -- IMPORTANT: include a step in the script to write some sort of data into the g field before the scripts finishes up (doesn't matter what the data is, as long as there is something placed into the g field).  Then, if the new record script runs again (either via button or some other trigger) it will see the g field now does have a value in it and will not create a new record in the target table during that session (if the user closes the file and reopens it, the g field comes up empty again and they could create another record -- if you needed the user to only create ONE record per DAY or something, you'd have to install some logic in the script that checks by date along with checking if the g field is populated).

               

              hth

               

              - Michael

              • 4. Re: Only allow a single record creation? possible?
                philmodjunk
                  

                "yeah, I know... everyone HATES global fields nowadays... "

                Not everyone. I find them extremely useful, especially in multi-user environments.

                • 5. Re: Only allow a single record creation? possible?
                  ninja
                    

                  "yeah, I know... everyone HATES global fields nowadays... "

                   

                  The only thing I don't like about globals is that they aren't global.  I use "local" globals often...I just wish there was such a thing as "global globals" so I wouldn't have to build work-arounds to attain them.

                   

                  With globals, you can use the values on unrelated tables.  That's why I recommended them as a solution to the footer problem in the OP.

                  • 6. Re: Only allow a single record creation? possible?
                    philmodjunk
                       Ninja, are you referring to global fields or global variables? "local globals" appears to refer to a variable rather than a field.
                    • 7. Re: Only allow a single record creation? possible?
                      ninja
                        

                      Hiey Phil,

                       

                      A global field (not variable) that, when set, holds the value for all users from that point until it is changed again.

                       

                      Today's currency exchange rates, Status fields set to "Active" for use in portal filtering, etc.

                      Note that there are well documented work-arounds for this type of use and this is not a current problem.  I'm not even sure that they'd be considered work-arounds as much as techniques at this point.

                       

                      My point in mentioning it was simply that I don't hate global fields, and that I even wish there were more than one kind.

                       

                      Enjoy the day!