Brett_D Posted June 21, 2002 Posted June 21, 2002 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.
Keith M. Davie Posted June 21, 2002 Posted June 21, 2002 Is the solution you are constructing using IWP or CWP?
Brett_D Posted June 21, 2002 Author Posted June 21, 2002 Um... I'm afraid I don't know what either of those acronyms mean.
Brett_D Posted June 21, 2002 Author Posted June 21, 2002 I just figured it out: Custom web publishing. Took me a while...
IdealData Posted June 21, 2002 Posted June 21, 2002 Looks like you're all set up to run with related fields.
Brett_D Posted June 21, 2002 Author Posted June 21, 2002 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.
Keith M. Davie Posted June 21, 2002 Posted June 21, 2002 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.
Garry Claridge Posted June 21, 2002 Posted June 21, 2002 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
Keith M. Davie Posted June 22, 2002 Posted June 22, 2002 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?
Garry Claridge Posted June 22, 2002 Posted June 22, 2002 I'm referring to a ScriptMaker script. Garry
Brett_D Posted June 22, 2002 Author Posted June 22, 2002 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?
Brett_D Posted June 24, 2002 Author Posted June 24, 2002 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?
Keith M. Davie Posted June 24, 2002 Posted June 24, 2002 "...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.
Garry Claridge Posted June 25, 2002 Posted June 25, 2002 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
Brett_D Posted June 25, 2002 Author Posted June 25, 2002 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.
Anatoli Posted July 21, 2002 Posted July 21, 2002 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
Recommended Posts
This topic is 8153 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now