June 21, 200223 yr I'm constructing a web survey using a Filemaker backend. I have five databases so far: surveys, questions, answers, sessions, and responses. "Surveys" stores the survey title and a unique survey identifier. "Questions" stores a question ID, the question text, the question type, and its parent survey's ID. "Answers" stores the answer text for check box or radio button questions. For text answers, it stores the number of lines to display on the site. It also stores its parent survey's ID and its parent Question's ID. These first three databases work just fine. They are the admin side used to create the survey(s). The final two databases, Sessions and Responses, will deal with the responses of those who take the survey. Sessions will store a unique session ID, while Responses will store the session ID, Survey ID, Question ID, and either the answer id of the radio button/check box the user clicked (linked to the Answers database above), or the text the user entered. Responses are linked to sessions through the session ID. Finally, my question is: is there any way to save to multiple Response records from a single web form? I want to be able to save four or five fields for several response records from one form.
June 21, 200223 yr Author Yeah, I've got related records down. I just need to figure out a way to store several records at once when a user clicks submit.
June 21, 200223 yr I would probably handle this with a ScriptMaker script. But then I know how to run them safely in browser solutions. Since no one else contributing here will recommend ScriptMaker, I will leave it to those nay-sayers to give you an alternate solution to creating multiple records. If you are intrerested in ScriptMaker as part of your solution, you can visit my site for more info.
June 21, 200223 yr If you had a set number of questions you could have a field for each response to each question. However, if the numbers of questions varies between surveys you may want to use a multivalued field (repeating) to record the responses. You could then run a script to write them as records to the Responses file. Good Luck. Garry
June 22, 200223 yr Garry, you wrote, " You could then run a script to write them as records to the Responses file." I gather that you are recommending a script other than a ScriptMaker script since a solution is necessary to the single-thread nature of ScriptMaker. Are you referring to JavaScript?
June 22, 200223 yr Author Thanks for the help. WIth the relatively low use expected on this survey, I don't think there will be much of a chance of users simultaneously running any script at the same time. I feel Garry's repeating field and scripting solution looks the most promising. Does anyone else have an idea I might try?
June 24, 200223 yr Author Thanks for your help, Garry. I've gotten to the point where I can get all the data into my responses database. However, the only possible way I was able to do it was using repeating fields, as you said. Now that I've got that part taken care of, how does one loop through each value in a global repeating field and create new records with the data held inside?
June 24, 200223 yr "...how does one loop through each value in a global repeating field and create new records with the data held inside" Certainly not with a ScriptMaker script. To find out why try these: http://www.fmforums.com/threads/showflat.php?Cat=&Board=UBB22&Number=21705&Forum=UBB22&Words=entertainment&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=1year&Main=21705&Search=true#Post21705 http://www.fmforums.com/threads/showflat.php?Cat=&Board=UBB22&Number=21737&Forum=UBB22&Words=entertainment&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=1year&Main=21737&Search=true#Post21737 In my protected solution I do not use a looping script, but I do use a script to accomplish what you seemingly desire to accomplish. Good Luck.
June 25, 200223 yr I've been able to do this using a Script which uses 'GetRepetition()'. As an example I have a file with sports in a repeating field called sports. I want to create records in a file called 'sports.fp5'. It has two fields { name, sport }. I have a relationship between the first file and the sports.fp5 on the field 'name'. The 'sports.fp5' file has two Global fields { g_curr_name, g_curr_sport }. It also has a script called 'new_entry'. The script looks like this: New Record/Request SetField['name','g_curr_name'] SetField['sport','g_curr_sport'] The first file has a Global field called 'g_curr_rep'. It also has a Script, which looks like this:Goto Record/Request[first] SetField['sports::g_curr_user','user'] SetField['g_curr_rep',"1"] Loop SetField['sports::g_curr_sport','GetRepetition(sport,g_curr_rep)'] Perform Script [External:sports.fp5] SetField['g_curr_rep','g_curr_rep + 1'] Exit Loop If ['g_curr_rep = 6] End Loop Hope this gives you enough information to help. Garry
June 25, 200223 yr Author I can't thank you enough. I just got the survey working exactly the way I want it. I had never thought to use two scripts across the databases.
July 21, 200223 yr Yeah, I've got related records down. I just need to figure out a way to store several records at once when a user clicks submit. You can do it from Portals
Create an account or sign in to comment