Create list of survey questions in mobile app

Create list of survey questions in mobile app

  

Hi,

I need to develop a mobile app which will show a list of survey questions say 10 question. For each question user can provide rating in the scale of 1-10 (1- least, 10- most). Also there should be a comment box for each question. I have defined the data model for this purpose. User can go to the next question by scrolling. I'm trying to use "Button GroupItems" for rating feature, but selecting any button for a question, same button is also getting selected for other question. It should be different for different question as rating would be different for different question. Can you please tell what is the best way to achieve this functionality? I'm bit new in mobile app development.


Thanks,

Biplab

Hi Biplab,

It's difficult to say what's wrong without any information on your implementation, but my guess would be you forget to reset the variable that is bound to the rating when starting a new question.

Kilian Hekhuis wrote:

Hi Biplab,

It's difficult to say what's wrong without any information on your implementation, but my guess would be you forget to reset the variable that is bound to the rating when starting a new question.

Hi Kilian,

I have used GetQuestionnaire aggregate  (entity - Questionnaire) to fetch all questions on the mobile app screen. Then added "ButtonGroup" under a question (this gets added automatically under each question) in service studio. PFA widget tree. Selecting any button for a question, same button is also getting selected for other question. Not sure how to set separate "ButtonGroup" for each question. Any reference application similar to this would be very helpful. 


Thanks,


Hi Biplab,

A Button Group has a Variable Property, that receives the value of the ButtonGroupItem pressed:

However, if it is set to a value of one of the ButtonGroupItems, that ButtonGroupItem will be selected. What I meant to say is that if you don't clear that Variable (i.e. set it to a value non of the ButtonGroupItems have) when you present the screen for the next question, you get the erroneous behaviour that you are seeing.

Im not sure if I fully understood your question, but I've done something simillar, but using the slider widget provided in the Silk UI.

As you have Questions, I imagine that you also must have a Answer entity, that'll have a QuestionId as well as a SelectedValue (int) that will hold the answer selection. My suggestion for you, is that you use a Block, that have a QuestionId input. This means that you'll be able to re use this block either listing your questionnaire questions, or some other way. You make two data fetches on that block, the first one, to grab the question by QuestionId, the 2nd one to grab the answer to that question also by QuestionId.. As you click the button (onClick) you'll want to save the button's value to the SelectedValue on the Answer you've fetched. 

If you use the slider, you can set it's min and max, and hold the value inputed by the user directly to the SelectedValue on the OnChange method of this widget. I hope this helps ;)

Here it is a guide on this widget https://success.outsystems.com/Documentation/SILK_UI_Framework/03_Building_UI_Through_Pattern_Composition/Using_Silk_UI_Patterns/RangeSlider_Pattern

Hi,

Still facing the same issue.

I have did the following.

1. Create an entity (Questionnaire)

2.Dragged the entity - 'Questionnaire' into the content area of mobile home screen.

3. Dragged 'ButtonGoup' into the content area of mobile home screen (after the question area created above) and created 10 ButtonGroupItems.

4. Published the app.


Now in mobile I can see all questions are getting displayed with each having the button groups(please see the attached image), but if I click any button(say 2) of the Question 1, then all button 2 of the subsequent questions are getting selected simultaneously. I'm not able to create separate set of Buttongroup for each question.

Can you please advise how to solve this issue? 


Thanks,


Biplab Pal wrote:

Hi,

Still facing the same issue.

I have did the following.

1. Create an entity (Questionnaire)

2.Dragged the entity - 'Questionnaire' into the content area of mobile home screen.

3. Dragged 'ButtonGoup' into the content area of mobile home screen (after the question area created above) and created 10 ButtonGroupItems.

4. Published the app.


Now in mobile I can see all questions are getting displayed with each having the button groups(please see the attached image), but if I click any button(say 2) of the Question 1, then all button 2 of the subsequent questions are getting selected simultaneously. I'm not able to create separate set of Buttongroup for each question.

Can you please advise how to solve this issue? 


Thanks,


You don't give enough info so that someone can know for sure what the problem is

Export your project and attach it here. 

Still, try doing the logic for 1 question in a block, and then when listing all questions to a questionnaire, use that block (the block should have a QuestionId input). If you fetch all questions, to a questionnaire, you can then create a list, with that fetched list as it's source, and use the block to represent each item. 

Hope you can fix your problem

Biplab Pal wrote:

Hi,

Still facing the same issue.

I have did the following.

1. Create an entity (Questionnaire)

2.Dragged the entity - 'Questionnaire' into the content area of mobile home screen.

3. Dragged 'ButtonGoup' into the content area of mobile home screen (after the question area created above) and created 10 ButtonGroupItems.

4. Published the app.


Now in mobile I can see all questions are getting displayed with each having the button groups(please see the attached image), but if I click any button(say 2) of the Question 1, then all button 2 of the subsequent questions are getting selected simultaneously. I'm not able to create separate set of Buttongroup for each question.

Can you please advise how to solve this issue? 


Thanks,


Hi Bipal


Sounds like you used the same variable for every button group. As Kilian said eariler, every button group has a variable that it is bound to (you can check out which variable it is at the properties window). Check that every button group has a different variable. That should solve the "one button selects every button group" problem.


Regards,

  CLSJ


If the number of questions is variable, having a seperate variable for each is not possible. And even if you have a larger number of questions, it's not best practice. In that case, add an Attribute to the Aggregate used to fetch the questions that will hold the answer. In fact, as I suspect the answer will be recorded in the database, and also because perhaps you want to allow the user to go back and change the answer, you can probably use an Entity Attribute instead of a variable.

Hi guys

Thanks a lot for your comments. But still need help from your side on this issue.

In my mobile app project, I am using two entities - Questionnaire (to store questions) and UserQuestionRating (to store userid, question id and corresponding rating).

I'm also attaching the oml file of my application. I tried to use Block (as suggested by Jose Lopes) which is used in the screen called - UsingBlockScreen, but not able to get desired result. Here not able to get the next question.


As another alternative (without using block), I am using HomeScreen where all the question are getting displayed , but still the issue persist ("one button selects every button group" problem.). @Kilian: can you please suggest what else I need to do here?

I really appreciate you guys for your response. Need bit more help on this as I'm new to Mobile app.

Please note that number. of questions is variable. If user clicks on any rating for an question, then the record would be created in UserQuestionRating with corresponding userid, questionid and rating.

Best regards,


Biplab Pal wrote:

Hi guys

Thanks a lot for your comments. But still need help from your side on this issue.

In my mobile app project, I am using two entities - Questionnaire (to store questions) and UserQuestionRating (to store userid, question id and corresponding rating).

I'm also attaching the oml file of my application. I tried to use Block (as suggested by Jose Lopes) which is used in the screen called - UsingBlockScreen, but not able to get desired result. Here not able to get the next question.


As another alternative (without using block), I am using HomeScreen where all the question are getting displayed , but still the issue persist ("one button selects every button group" problem.). @Kilian: can you please suggest what else I need to do here?

I really appreciate you guys for your response. Need bit more help on this as I'm new to Mobile app.

Please note that number. of questions is variable. If user clicks on any rating for an question, then the record would be created in UserQuestionRating with corresponding userid, questionid and rating.

Best regards,


Like I said, you have the "Rating" variable set up as the variable for every button group that is being created on the list. As Kilian suggested, the best here would be to add a "Rating" variable To the Questionnaire Aggregate and bind the ButtonGroup variable to that attribute. Something like this:


If you want the UserRating to be created when the User clicks on the button group set up an action on the onChange event of the button group like so:

Hope this helps!

  CLSJ


PS: It doesn't necessarily have to be in a block, though that makes the questionnaire reusable.


In fact, if you left-join ("With or Without") the UserQuestionRating Entity, you can use the Rating Attribute, like I said above.