5 Replies Latest reply on Nov 15, 2011 9:34 AM by philmodjunk

    Scripting Help. Maybe a set field script would work?

    JoshGriffin

      Title

      Scripting Help. Maybe a set field script would work?

      Post

      I'm a filemaker pro newbie. I took the invoices starter solution and have been slowly customizing it and making it my company's POS system. I have been able to muddle through most things but this one has me stumped. If you look at the started solution, you will see where you input the customer's information and then have to click the invoices tab and then select a drop down box before you can start entering in items for the customer. I'm building this for a group of computer illiterate folks so I have been trying to dumb done the processes. I have a button that already navigates to the invoices tab after the person inputs the customer's information. I want to save the step of clicking on the dropdown list and have it where when my employee presses the button it automatically enters it into that dropdown list and they can start inputting items to check out.

      The easiest thing to do might be to open up the invoices starter solution and see how it all relates. This script would probably have to include a set field function but also includes a value lists and a number of tables.

      Please help!

        • 1. Re: Scripting Help. Maybe a set field script would work?
          philmodjunk

          Set Variable [$CustID ; value: customers::Customer ID ]
          Go to Layout ["Record Detial-Invoices" (Invoices)]
          New Record/Request
          Set Field [Invoices::Bill To Customer ID ; $CustID ]

          • 2. Re: Scripting Help. Maybe a set field script would work?

            I haven't looked at the invoice starter package (is that available online somewhere?) but there are a few ways you can achieve what you are describing.  I am something of a newbie myself, so someone else might be able to provide better directions, but I will try.  :)

             

            Two primary methods I can think of:  a variable, or a global field. 

                For a variable, you could set the variable to the value of the customer ID or name, and then when you switch tabs with your script (I am assuming that your script is doing the tab switching) your variable can be used to set the value in the field used for the drop down list.

                ...

            set variable ($cust_Name; value:Customers::Customer_Name)

            ...

            Go to Object [Object Name: "Invoice Tab"]

            set field (Invoices::Customer_Name ; $cust_Name)

                ...

             

                For a global field, you set the global field in the first tab to equal the customer ID/name (whatever is used in your drop down list) and then when the tab is loaded set a trigger to read that global field and then set the field that your drop down list uses to the value of the global.  The benefit of a global is that it doesn't lose scope when your script ends; it will always be set and can always be read.  Drawback is that you have to create an additional field in one of your tables.

               ...

            # field "Customers::global_CustName" gets set as part of the UI on the first tab.

            Go to Object [Object Name: "Invoice Tab"]

            set field (Invoices::Customer_Name ; Customers::global_CustName)

                ...

             

            There are probably many more details that I am missing but this should hopefully get you started.

             

            --  Justin

            • 3. Re: Scripting Help. Maybe a set field script would work?
              philmodjunk

              I haven't looked at the invoice starter package (is that available online somewhere?)

              Select "New from Starter Solution" in the File menu.

              • 4. Re: Scripting Help. Maybe a set field script would work?

                Hmmm...I took a lot longer to type mine up, and yours is much more succinct and specific.  And I swear there weren't any responses yet when I started.  :)

                • 5. Re: Scripting Help. Maybe a set field script would work?
                  philmodjunk

                  Well, I knew how to open the starter solution so I had it open to get all the layout, table occurrence and field names correct...Wink