1 2 Previous Next 17 Replies Latest reply on Aug 17, 2010 11:38 AM by philmodjunk

    HELP! Set field script



      HELP! Set field script



      I am using Filemaker Pro 11. I created a database that contains a number of forms. It is for personal evaluation/testing purposes of our products.

      The customer will navigate through two pages, here's what will happen:

      1) they will enter the home page (there is drop down menu and a button)

      2) they will select the product they wish to evaluate fro the drop down (eg. ipod touch, ipod nano, canon camera, etc.)

      3) they will click the button "Evaluate now", which will lead them to the evaluation form.

      Note: the specifications of the product (memory, size, battery life, etc) is already entered in another table called products and it shares a relationship with the Evaluation form. In this form, once the product name is entered the relationship populates all other fields.

      Now what I want is to eliminate this step for the customer, I want them to just select the product from the drop-down list on the home page and once they click "evaluate now" it populates the field "product name" with the selection.

      I wrote a script, but for some reason it's not working, can someone tell me if what im doing is right or wrong? here it is:

      Go to Layout ["Evaluation Form" (Evaluation Form)]

      New Record/Request

      Set Field [Evaluation Form::Product Name;GetField(Home::Product)]

      --->"Home" is the Layout name of my home page and "Product" is the drop down

      ---> "Evaluation Form" is the Layout name of the evaluation form and "Product name" is the field I want to populate with the drop-down selection.

      Please let me know if any of this sounds confusing. Thanks!!

        • 1. Re: HELP! Set field script

          First off, when you use the expression Evaluation Form::Product Name, "Evaluation Form" is the name of a box in Manage | Database | Relationships--which in turn refers to a table listed in the tables tab of Manage| Database. Your table, table occurrence "box" and layout likely have the same name so this worked for you this time, but be aware that you are referring to a table here, not a layout.

          GetField is used to get to data in a field whose name, in your example, is stored in Home::Product so that's not what you need here either.

          You need to put the contents of Home::Product in a "bucket" so that when you switch layouts, you can take the information out of this "bucket" and put it in Evaluation Form::Product Name.

          We'll use a variable as our bucket for this job:

          Set Variable [$ProductName ; value: Home::Product]
          Go To Layout [Evaluation Form]
          New Record/Request
          Set Field [Evaluation Form::Product Name ; $ProductName]

          • 2. Re: HELP! Set field script

            OOH! It worked!!! Thank you sooo much!! :D

            • 3. Re: HELP! Set field script

              I have another question: Is there a way to keep the product name in the header?

              I want only the body of the layout to change when the button is pressed. I would like for the logo as well as the drop down menu to stay in the header. When the user presses "Evaluate Now" the form replaces the body of the layout and They can then change the name of the product they are evaluating from the drop-down that will remain there at all times.

              Is there a way to do that?

              • 4. Re: HELP! Set field script

                Certainly, that can be done, but I'm working a bit blind here as to how you've set up your database.

                You can set up two layouts so that they have identical headers. Then, when you switch layouts, the body appears to change while the header remains the same. There are some details that depend on how your database is designed that can affect how this works though...

                • 5. Re: HELP! Set field script

                  Making two layouts identical, I know I can do. Im just afraid when they change the product name in the drop down (that appears to have been stayed there), how will taht change the related product information?


                  I think I mentioned everything regarding the set up of the database in my first post. Let me know what other information you would liek and I would pass it on.

                  • 6. Re: HELP! Set field script

                    What tables have you defined in your file? You appear to have two: Home and Evaluation form. What fields have you defined in Home? Why do you need the Home table?

                    How are Home and Evaluation Form related? (Open Manage | Database | Relationships, is there a line linking the two tables and if so, what fields are connected by this line?)

                    Is the data you want to see in the header in fields that are part of Home or Evaluation form?

                    When you switch layouts will you be changing from Home to Evaluation or will they both be layouts that refer to the Evaluation Form?

                    • 7. Re: HELP! Set field script

                      I have three tables:

                      1) Product Information [fields: product name, ID, price, battery life, memory, dimentions]

                      2) Home [fields: product (drop down menu with values specified from "product information" table)]

                                     Also has a button "Evaluate Now" running the script

                      3) Evaluation form [fields: product name, ID, price, battery life, memory, dimentions, rating scale(radio buttons 1-5), comments box]

                      -Home and evaluation form are related through the name of the product (Home::product id connected to Evaluation::Product name)

                      -Also Products Inforamtion::Product name is related to Evaluation Form::Product name

                      The date i want to REMAIN (If possible/or appear to remain) in the header is the Product drop-down menu, this is part of Home.

                      Yes,I will be changing from home to evaluation, but once they are at the Evaluation form, if they want to evaluate another product, they just select it from the drop-down and a new record is created with that information.

                      Does this make sense? 


                      • 8. Re: HELP! Set field script

                        You should be able to place fields from Product Information in the header to identify and describe the product being evaluated. When the user starts a new evaluation and selects a different product, the information for that product should then appear in the header.

                        Incidentally, I don't see a need for the home table at all. Seems like you could just go to the evaluation form, start a new record and have the user simply select a product from a field that's part of the Evaluation form table as their first step.

                        • 9. Re: HELP! Set field script

                          The only problem, is i am considering implementng more forms. This is just a trial version. So there is a list of buttons on the home page that leads to various forms. I need them to select the product from the drop down and then once they select a form, the product info is populated (which i've done).

                          Now I just need to keep the drop down in the header, that once they select a new product, its info is popualetd instead. Do you know what I mean?

                          So now I wrote a script for the buttons after selecting the product from teh home page. How do I do it taht once they select a different product, its info is populated (if i do not want to have a "go" button)

                          • 10. Re: HELP! Set field script

                            What do you want to happen to your data when they select a different product? Should this create a new record? If so, in what table? (This could be the same table for all your different layouts or a different table for each layout or somewhere in between.)

                            Generally, "populating" fields after selecting a value from a drop down involves ethier looked up value settings on fields to copy data from a table such as your Product Information table or you can just place the actual fields from Product Information on your layout. Which is the right approach depends on what you will do with this information. With Looked up data, you are working with a copy of the data and you can further edit it after you copy it over. Also, changes to data in your Product Information Table won't automatically update the copied data in your Looked Up Value fields. If you just place the fields from the related table on your layout you are viewing/working with the actual data in that table. Any updates to the Product Information fields will automatically appear on your layouts. You can even edit the data directly from these layouts if you permit access to the fields on your layouts.

                            • 11. Re: HELP! Set field script

                              I want it to create a new record and populate the fields for that record. Actually a new record might not be needed now. I can place a button that allows them to create a new record. what i want is for a field (let's say battery life) to be populated upon selection of an item from the drop down menu. I related the tables and the fields and did the whole "looked-up" value thing. I just can't get it to populate on select.

                              Also I have a couple of more things I have been trying to figure out the past couple of days but cannot properly address:

                              1) I have four buttons on my home page now, "Form 1" "Form 2" "Form 3" and "Form 4". Form 3 is the same as Form 1, but the user fills it out after they've physically examined the device. I want to be able to show them what their answer was in form 1. in other words (beside each line I want to say [your answer in form 1 was: _______]). 

                              How can I pull out their answer from Form 1 and place it there?

                              2) Every time the user clicks form 1, it creates a new record form them. Now I do not want a user to input multiple ratings for one product. So I want the script on my button to first look up if there is already an existing record (and pull it up and display it if there was); if not THEN it creates a new record.

                              Thanks a loooot! :))

                              • 12. Re: HELP! Set field script

                                I suggest you look into acquiring a book on FileMaker or some tutorials. I'll keep doing my best to answer your questions, but if you enhance your own understanding of how FileMaker works it'll help my suggestions and questions make more sense to you.

                                Whether you use looked up values or just place the fields from your product information table on the layout, the correct relationship between tables must be set up in Manage | Database | Relationships.

                                If you have something like this:

                                YourTable::ProductID = Product Information::ProductID

                                Then you can format The ProductID from YourTable with a drop down list of ProductID numbers (and their names can be in column 2). Select a value from this drop down and any field in YourTable defined with a Looked Up value setting to copy a value from a field in Product Information will copy that data from the matching record in Product Information. If you instead just place a field from the Product Information table on a layout based on YourTable, you'll get a result that looks the same, (the matching Product Data appears when you make a selection), but doesn't actually copy data into a field in YourTable.

                                • 13. Re: HELP! Set field script

                                  I actually have been reading the Filemaker pro 11 guides, tutorial, script steps and am looking into purchasing a book. I actually post my questions after intensively looking for the answer. I do appreciate all the help!

                                  I was just wondering if you have any idea about the other two questions? The" lookup" feature?

                                  • 14. Re: HELP! Set field script

                                    The look up feature is what I've replied to. Let's make sure that works for you before tackling the other questions.

                                    1 2 Previous Next