You may have seen this thread already as it describe tables similar to yours: Need aid on generating a report from a survey layout.
Assuming relationships similar to those in the thread for which I just posted a link, you should be able to create summary reports on a layout based on UserAnswers that includes fields from the other related tables. Summary fields can count the number of responses with a given AnswerID if you put the summary field in a sub summary layout part that is sorted by AnswerID and you can add another sub summary layout part "when sorted by QuestionID" so that the answer statistics are grouped under each question.
And you can remove the body layout part from such a layout to show only the aggregate answer statistics instead of the individual userAnswer records.
Here's a tutorial on summary reports: Creating Filemaker Pro summary reports--Tutorial
many thanks for the link. It helped me a great deal. I am having difficulty displaying the questions and the possible answers (radio button format) in a portal while I am based on the Respondents TAble. Could you please advise? Do I have to set up a conditional value list?
Please see a screenshot of my relationships attached.
What are you listing in the portal?
On what table are you basing that portal?
Yes, a conditional value list is in order to list the possible answers for each record in Questions that you choose to display for a given survey being completed by a given respondent.
I wanted to list the PossibleAnswers for each question.
"With the above structure, you can set up a portal to responses on the respondants layout. The Question field from the related Questions table can be added to this portal so that the respondant can read the question and select a response in the portal for each question."
The portal is based on ResponsesTable. Am I way off?
No, you are right on.
Do you know how to create the needed conditional value list so that the possible answers appear as a value list for the Responses::ChoiceID field placed in that portal row?
If not see the links below. It's a major "Infodump", but you probably only need to look at either the first or second link possibly followed by a look at the demo file in link 3.
There's a lot of overlap between the first two links so you can read one and skim the other. The demo file gives you several examples of different conditional value lists so you can examine them to see how they are set up. If you are using FileMaker 12 or later, you can open this demo file from your File menu to get a converted copy of the demo file that you can examine in your version of FileMaker.
The next to last link discusses how to set up a chain of conditional value lists where the value selected in each conditional value list controls the values listed in the next value list and the very last link is a fairly new addition that describes how to use ExecuteSQL to produce conditional value lists that aren't easily possible with the other methods described here.
Forum Tutorial: Custom Value List?
Knowledgebase article: http://help.filemaker.com/app/answers/detail/a_id/5833/kw/conditional%20value%20list
Hierarchical Conditional Value lists: Conditional Value List Question
Using ExecuteSQL to produce a conditional value list: Using ExecuteSQL to Produce a Conditional Value List
Feel free to post follow up questions here if those links aren't enough to get your value lists working correctly.
Thanks for the links. I was able to display the possible answers for each question however I was only able to do it on The QuestionsTable based layout. When trying to display questions and their set of choices (possible answers for that question), nothing appears on the Layout. I know I have to slightly change my structure or use a script. Could you please advice?
How can a selected possibleanswer be captured and associated to the survey and the respondent?
I came across a thread on the forum discussing about global fields for the QuestionsTxt field. Do you think it is the reason why I can't seem to be able to display the questions and their related set of possible answers while on the layout based on the Respondent Table?
There are several options for how to set this up. The following option does not use global fields:
First, we have: "a portal to responses on the respondents layout."
So each portal row in this portal represents one respondent's answer to one question. In this portal row, the ChoiceID field can be set up with a conditional value list of values from PossibleAnswers. The value list would use the specify values from a field option and list values from PossibleAnswers::__pk_ChoiceID as "field1" and ChoiceText as "field 2." You'd select the "Include only related values" option and specify Questions as the "starting from" table occurrence.
But a missing detail is that you need to create a record in responses for each question for each respondent. Until you have a record for each question for that respondent, you can't list questions in your portal to responses. This can be set up with a script that loops through the records in questions and produces one record in responses for each question with the respondent's _pk_ RespondentID value entered into the RespondentID field and each Question record's _pk_QuestionID value entered into the QuestionID field of each such new record created.
This then makes it possible to put the QuestionText field from Questions in the row of this portal to show the questions for the selected survey.
Thanks. I think the script is described in the link you provided. Regarding
I tried but the PossibleAnswers do not show. (No values defined) Please see screenshot. Could you please advise me?"But a missing detail is that you need to create a record in responses for each question for each respondent. Until you have a record for each question for that respondent, you can't list questions in your portal to responses. This can be set up with a script that loops through the records in questions and produces one record in responses for each question with the respondent's _pk_ RespondentID value entered into the RespondentID field and each Question record's _pk_QuestionID value entered into the QuestionID field of each such new record created.
The script must be run before the respondent can even see questions to answer. Thus you need to run this script at some point on or before the respondent actually sits down to read questions and select answers.
Until you run this script, the rest of this will not work as there is no record in the table to make the needed valid link to PossibleAnswers and you won't see any values in your portal row. Nor will you see any questions in the portal row either.
I have created the following script but I am still unable to display both questions and possible answers on the Respondents layout. Please see screenshot for both the script and my relationships. I have created a Home layout with a start survey button [Go to Layout (Respondents Laypout + Perform The script "Survey"]. Could you please help?
The script is basically correct except for one possible detail: Does this script start from a layout based on Respondants and did you create a new record just before running this script. Since you need a different record for each respondant, you need to be sure that you are on the correct record before this script is performed or the variable for the respondantID won't get the correct value.
Assuming that you do run this script from a layout based on Respondants and that you have the correct current record at the time that you run it, there are several key details that could keep this from working.
Your layout must be based on Respondants with a portal to Responses.
The Questions::Questiontxt field should then be placed in the portal row to show the actual question to be asked.
Let me know if you can get to that point or not and then we can take a closer look at how to display the possible responses correctly.
Thanks for your reply. I have added the following steps to the script:
Go To Layout [The one based on respondants]
I am now able to see the first question in the portal but not the set of PossibleAnswers for that specific question. Also, how would the user go the next question since the Layout is based on respondents, a go to next record will not work. I was thinking about adding a button which will perform a Go to portal (next) ?
Could you help me with "how to display the possible responses correctly."?