Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Multiple Records; One Form

Featured Replies

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.

Is the solution you are constructing using IWP or CWP?

  • Author

Um... I'm afraid I don't know what either of those acronyms mean.

  • Author

I just figured it out: Custom web publishing. Took me a while...

Looks like you're all set up to run with related fields.

  • 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.

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.

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

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?

I'm referring to a ScriptMaker script.

Garry

  • 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?

  • 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?

"...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.

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

  • 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.

  • 4 weeks later...

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 smile.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.