9 Replies Latest reply on Apr 28, 2016 1:15 PM by rgordon

    Limit The Number of Records that can be created

    moderndesigns9

      I would like to start selling my real estate management software but i would like to set up different types of versions of the app for different sized businesses, and different types of accounting..

       

      My problem is i don't know how to limit the amount of records the user is allowed to create

       

       

      To under stand the current set of the program

       

       

      Creating property page

       

      on the property page there is a tab folder layout

       

      the first tab is "Properties"

      inside this tab you have a portal that have 2 container fields for home pictures, Address, property Name, (Advance program will have purchase price), Date Purchased, and then theres property Details button

       

      So one this page within the Tab properties i have that portal inside that tab to have limited amount of records to be created

       

       

       

      Examples:

       

      Basic Program : Property Owners of 1-5 Homes they will only be able to create a max of 5 homes in the homes portal.

      if the user tries to add a new home it will pop up a dialog box with your current databases only allows you to you have a max number of 5 homes. Please Upgrade to a large database @Website name or delete a current home listed

       

      Medium Program: 1-15 Homes

       

       

       

      Large Program: 1-25 Homes

       

       

      X-Large Program: Unlimited (which is just the current program with out limitations)

        • 1. Re: Limit The Number of Records that can be created
          vavo

          you can use

           

          count ()

           

          in the way that you point it to the ID of the child records (I think  it is properties). This will return the number of related records. If it is more that what you allow you can react to it.

           

          Example:

           

          count (owner_properties::id)

           

          Hope that helps,

           

          Valentin

          1 of 1 people found this helpful
          • 2. Re: Limit The Number of Records that can be created
            moderndesigns9

            So would i need to make an add new property button to run this script

            • 3. Re: Limit The Number of Records that can be created
              rgordon

              There are multiple ways to accomplish this. Get(totalRecordCount) Will give you the total number of records in a table. If you script your creation of new records, you can test against Get(totalrecordcount) To determine if a new record can be created.

              1 of 1 people found this helpful
              • 4. Re: Limit The Number of Records that can be created
                moderndesigns9

                Thank you all... i will try this

                • 5. Re: Limit The Number of Records that can be created
                  coherentkris

                  Set a validation on the primary key of the table where homes are recorded such that the max value can not exceed 15 for small 25 for medium and drop the constraint altogether for unlimited.

                   

                  Of course this assumes that the primary key is an auto serial integer with increment of 1 and starts at 0. If your primary key is NOT set up as this then implement it on a surrogate key field set up as auto create serial.

                  The only thing you will have to implement is resetting of the next serial value on deletion of a home record to max serial + 1.

                   

                  If it were me i would use the preemptive strike method recommended by RGordon AND the data layer validation herein.

                  • 6. Re: Limit The Number of Records that can be created
                    Mike_Mitchell

                    Not sure the serial number is a good idea. If the user deletes a record, he'll still be under his license limit, but won't be able to create any more records at all.

                     

                    That's assuming, of course, that the limitation is "no more than 5 records at a time" and not "no more than 5 records period unless you pay more". I got the impression it was the former, based on this:

                     

                         Please Upgrade to a large database @Website name or delete a current home listed

                    • 7. Re: Limit The Number of Records that can be created
                      vavo

                      yes, either use a button to create the record or, if records can be created in a portal, you can use a scriptTrigger on Record commit to test for it.

                      • 8. Re: Limit The Number of Records that can be created
                        siplus

                        Should I want to abuse you, I'd make 10 copies of your database, rename them 1 to 10 and handle 10 times the amount of data you want to allow me to.

                         

                        I would also use LittleSnitch to block any communication to the internet.

                         

                        Solutions ?

                         

                        - a preference file (but you might need plugins to work with it)

                        - a License Manager Database which your solution hardcodedly accesses and looks things up

                        - ...

                        • 9. Re: Limit The Number of Records that can be created
                          rgordon

                          Just for kicks I might store the name of the file, the location of the file, the persistent ID and a few other secret things that I'll use to create my registration number.  Using Getcontainerattribute gives me great options for creating registration numbers. Might even put a period in front of a file name to make it hidden so I can store relevant data in it. Or I could disable the file if the file name has been changed. Can I make it tamper proof? No, but I can stop a vast vast majority of users from being evil.  Most real estate managers want to spend time getting their work done instead of trying to fool your solution. Sometimes paying to see data in one place is much more important that seeing it scattered throughout multiple files with different names and locations. Having ten different files on your FileMaker server that all do the same thing and have data spread across the files would be fun.