4 Replies Latest reply on Jan 13, 2010 8:39 AM by mrvodka

    Suggestion needed on a survey application

    mwtse

      Title

      Suggestion needed on a survey application

      Post

      Dear all,

       

        I'm going to do a survey by FMP but could not figure out how I should proceed.

       

        The database table I have on hand is like the following:

       

        The fields are: icecream, cake, chocolate, candy ... , firstname, choice1, choice2, choice3

       

        The icecream etc. fields are numbers from 1 to 3 or empty, indicating the favorite choice. I want to automatically fill in the fields choice1, choice2 and choice3 with the field names. i.e. if Mary like cake the most, there will be a "1" in her "cake" field, and I want to fill her "choice1" field with the word "cake".

       

        I've tried to use object triggered scripts, but could not figure out how to get the content of the triggering field. It always said that "self" function could not be used.

       

        I'm also considering to write a script to loop through all the records to examine each field, but do not know how to handle the list of fields except hardcode all the field names.

       

       I'll be very appreciated if anyone could tell me the name of function I needed to study or point me to some similar cases (where loop through some fields of a record is used). 

       

        Thank you! 

        • 1. Re: Suggestion needed on a survey application
          philmodjunk
            

          A different design approach will make life much simpler for you.

           

          Here's a very simple approach, more sophisticated setups are possible and may be better yet, but let's keep it simple to start:

           

          Set up a table, Questions, with fields such as:

          Question, Response, RespondantID

           

          Set up a second table, Respondants, with the fields: Name, (any other fields you need to identify one person responding to your survey), RespondantID (auto-entered serial number)

           

          Link the two tables:

          Respondant::RespondantID = Questions::RespondantID

           

          In your Questions table, you'd enter text such as "icecream, cake, chocolate, candy ... " in separate records of the questions table for a given respondant. (Here's where you may want your final database to have even more tables, so you don't have to do so much to set up a survey for a new respondant)

          Your survey takers would then enter a number in the Response field to rank their responses for each item. You can format the response field with radio buttons, check boxes or a dropdown/pop up  menu if you want.

           

          This is just a simple outline of the basic idea. There are many threads in the forum that already discuss using filemaker to manage surveys. Click the advanced search link at the top of your screen and use "survey" to search the forum. You should find several good examples that take this idea into much more detail.

           

           

          • 2. Re: Suggestion needed on a survey application
            mwtse
              

            Many thanks.

             

             I realized that there must be something wrong deeply rooted, thanks for telling me the correct implementation for database applications, as I was coming from a procedure programming background. Your suggested database structure is just much more reasonable and I've beat my head for unable to figuring it out. However, the problem some how shifted to how to build a layout for data entry. I'll do the search to see how others solved the problem. I have been very frustrated when trying to use database to provide a solution, I always could not figure out how to do and even do not know how to ask!

            • 3. Re: Suggestion needed on a survey application
              mwtse
                

              Now I have follow your advice and have made some progress:

               

              I've created

              a Survey table containing three fields: PersonID, FoodID, Priority

              a Food table containing FoodID, FoodName

              a Person table containing PersonID, FirstName

               

              and the three tables are related.

               

              When I add a record in the Person table,  a few records will be created in the Survey table (one record for one kind of food) by triggering a script. More work have to be done in the script to handle different situation, but it serve my purpose at the moment. However, I still have to figure out how to input data into the "Survey::Priority" field. How could I create a layout with the same field from different records? Is it by using portal?

               

              • 4. Re: Suggestion needed on a survey application
                mrvodka
                  

                See if the demo and links in this thread will help you.

                 

                http://fmforums.com/forum/showtopic.php?tid/183639#238339