4 Replies Latest reply on Jun 24, 2015 7:15 AM by hanstrager

    Fill in fields with button

    hanstrager

      Title

      Fill in fields with button

      Post

      I have a database dealing with receipts.

      I have a master layout where I type different type of information about the specific receipt such as date, Seller, paye, price, category etc.

      Every month I have quite a lot of small outgoings for similar things which takes alot of time to type into my master layout when it's more or less same info I'm putting into the different fields.

      I thought i would make a button with a script attached to it, so when I press the button It will automatically put standard information into some different boxes. I just have no idea how to go about this.

      Could anyone help me in the right direction?

        • 1. Re: Fill in fields with button
          SteveMartino

          What's 'standard information'. In each field, you could go into options, in layout mode , auto enter tab.  You can put in a static value in 'Data' (which I use for the State field, because almost all my transactions are in the same state), or you could use the Looked-up Value or Calculated Value options.

          If you don't know all the shortcuts, you can right click on a field and click the insert menu option to insert Current Date, Current Time or From Index (which if the field has indexing turned on will show you a list of all entries in that field).

          Also you can set the option in the inspector, where applicable,  'Auto complete using existing values' if that helps.

          As far as scripting you can just have a script that sets fields, one by one with static values.  But what happens if you change the values on the fields, and someone clicks the button, and changes the values again?  You could attach the script to a button for a new record, so it only runs the script when you create a new record.

          • 2. Re: Fill in fields with button
            hanstrager

            The reason I want the button is so with one click, I can fill out 4 fields at the same time, without having to go into them and start typing or changing things around.

            I've tried to use the set field.

            Set Field [ Transactions::DESCRIPTION; Transactions::DESCRIPTION = "test" ]

            But my description field comes out with '0'

            • 3. Re: Fill in fields with button
              philmodjunk

              Set Field[Transactions::DESCRIPTION;  "test"]

              Is what to use.

              Transactions::DESCRIPTION = "test"

              is a Boolean expression comparing the value of Description to the value "Test" if they are equal, the value returned is True or the number 1. If they are not equal, the value returned is False or the number 0.

              • 4. Re: Fill in fields with button
                hanstrager

                perfect - thank you both