5 Replies Latest reply on May 26, 2010 9:27 AM by Frinholp

    Conditional layout fields

    Frinholp

      Title

      Conditional layout fields

      Post

      Hi all

       

      I would like to create a layout where a field is only editable if a condition is met.

       

      The scenerio is:

       

      I have an inventory database. A stock item is of one of two types, a 'one-off' or a an item that many copies can be ordered. I would like to create an 'Order' layout that allows me to enter a purchase quantity if an item is not a 'one-off' or automatically sets the quantity as 1 if it is a 'one-off' and prevents the field from being editable.

       

      I'm sure these conditions need to be set in 'manage database'. How do I go about this? It would be nice to block data entry into the quantity field on the layout by means of ghosting or something similar. 

       

      Thanks in advance 

       

      Lee    

        • 1. Re: Conditional layout fields
          philmodjunk

          What version of filemaker are you using?

           

          You can use security settings to conditionally lock a record against editing.

           

          If you are using filemaker 10 or 11 you can set a OnObjectEnter script trigger on the field to deny entry to the field. That's not as secure an approach as setting up record level access privileges, but it's also easier.

          • 2. Re: Conditional layout fields
            ryan

            If not in v10, you can also validate the Order Quantity field (or whatever you want to call it) by doing the following:

             

            Manage Database, select the field and click on options. then the VALIDATION tab.

            Select Validation by Calculation.  you can enter a formula such as "Self" ≤ "Items_Table::Item_inventory" (whatever the name of your related table and inventory field is....)  This will return a Boolean result.

             

            then you can enter the message you'd like your users to see/read:  "sorry, we don't have that quantity available, etc."

            • 3. Re: Conditional layout fields
              Frinholp

              Thanks for your responses.

               


              PhilModJunk wrote:

               

              If you are using filemaker 10 or 11 you can set a OnObjectEnter script trigger on the field to deny entry to the field.


              I'm using Filemaker Pro 11. I have managed to automatically set the quantity to 1 for 'one-off' items using OnObjectExit on 'ItemType' field. What function do I use in my script to deny entry to the quantity field.

               

              Thanks again

               

              Lee

              • 4. Re: Conditional layout fields
                philmodjunk

                OnObjectEnter for that field.

                 

                You write a script that checks to see if entry is permitted, if not, use go to field to place the cursor in a different field.

                 

                Note that this approach is not as secure as setting up record level access permissions in Manage | Security 

                • 5. Re: Conditional layout fields
                  Frinholp

                  Cheers Phil

                   

                  I will use the script technique for now and build something more robust later. Didn't occur to me just to go to next field. I feel a little embarassed now.

                   

                  Thanks again