Hi Power Apps Community,
I am currently creating a survey in Power Apps.
Issue: I am using a Gallery to list all the questions and Radio Input. However, I have one question which requires Text Input. When using a Gallery, the Radio Input is replicated to all the questions. Is there any way that I could replace the Radio Input for a Text Box in the last question? - as seen in the image below.
Thank you in advance.
Solved! Go to Solution.
How are you designating your "question types" in your items list for that Gallery?
You will need to key off of that. So, for example, if your Items record contains a "dataType" column that designates what kind of question control it should have (Radio, Text, etc). Then you can add the TextInput to the Gallery and set its Visible property to ThisItem.dataType = "Text" and the Visible property on your Radio control to ThisItem.dataType="Radio"
That should give you what you want.
I hope this is helpful for you.
How are you designating your "question types" in your items list for that Gallery?
You will need to key off of that. So, for example, if your Items record contains a "dataType" column that designates what kind of question control it should have (Radio, Text, etc). Then you can add the TextInput to the Gallery and set its Visible property to ThisItem.dataType = "Text" and the Visible property on your Radio control to ThisItem.dataType="Radio"
That should give you what you want.
I hope this is helpful for you.
Hi @RandyHayes ,
Brilliant! Thank you for the quick response. I tested this out and it worked! 😀
Excellent!
As a side-note, I am currently editing a video on the process of building long survey type questionnaires like you seem to have. It's an end-to-end solution video. The video Channel is still in its infancy stage, but I'm aggressively working on a long list of video topics. Go ahead and subscribe there so when it is done, you can check it out - I believe you will be able to apply a tremendous amount of information in it to you App.
I think I'm trying to do what you're doing @RandyHayes and I'm stuck. I have a sharepoint list that contains my questions and some columns used for filtering. This way the admin can add/edit/remove questions without editing the PowerApp.
I created the PoweApp with a gallery that pulls the questions, and I added the input fields for their response in to the gallery template. It looks great and uses filters to change the questions displayed.
Now I'm stuck trying to figure how to capture the values from the input fields. I just realized that every field is ThisItem.TextField and I don't know how to get each row's answer. I was hoping your video was posted but didn't see it.
I'm working on it still. It's a long one, so it is taking some time to put together - especially when I only get some spare time to do it.
In general, what I do is to capture any value in a label in the Gallery (let's say labelAnswer). The concept of the formula on the text property of the label is this:
Switch(ThisItem.dataType,
"Text", textInputBox.Text,
"Radio", RadioControl.Selected.Value,
"Slider", Text(SliderControl.Value),
"Date", Text(DatePickerControl.SelectedDate, ShortDate)
)
Now from that label, you can get all the values of the answers directly from the labelAnswer.Text value.
You're making me itch to finish the video...I will put some work into it this weekend.
Thanks @RandyHayes for your reply. I managed to get the gallery display the right type of input field. But the set step that I'm not figuring out is How do I collect the values they are answering when they click the submit button it will create a single record in a SharePoint list? I use one SP list to supply the questions and want a another SP list to store the results by people. Is this even possible with a gallery?
For a generic example if they answer Question A with option 1 and answer Question B with option 2.
The screen has the components
gallerySurvey
- txtAnswer
- lblQuestion
btnSubmit
This is an example of the real inspection form I'm creating.
Just figured out part of it. I had to do something like
Clear(Collection_Test);
ForAll(galleryEhsEquipment_1.AllItems,Collect(Collection_Test,{Question:Question_4.Text, Answer:ResponseAnswers2_3.Selected.Value}))
Now just need to convert a gallery of rows containing Question ID and Answers in to a record with columns for each question and it's corresponding answer.
Since you are doing this in a running Gallery, you can simply put a Label in your gallery (hidden) and set the text property to the value of the current row based on its control.
ex:
Switch(ThisItem.questionType,
"Text", yourTextInputControl.Text,
"Radio", yourRadioControl.Selected.Value,
...etc...
)
Then at the end of it all, you can reference Gallery.AllItems and then get the value in the label control as the answer to the question.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
252 | |
123 | |
85 | |
84 | |
67 |