web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change question in Gal...
Power Apps
Answered

Change question in Gallery

(0) ShareShare
ReportReport
Posted on by 383

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.

 

Data_Enthusiast_0-1602017059276.png

Thank you in advance.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    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.

  • Data_Enthusiast Profile Picture
    383 on at

    Hi @RandyHayes ,

    Brilliant! Thank you for the quick response. I tested this out and it worked! 😀

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Data_Enthusiast 

    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.

     

  • Data_Enthusiast Profile Picture
    383 on at

    @RandyHayes 

    I will definitely give it a look. Thanks!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    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.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

    gallerysample.png

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    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.

  • SafetySiren Profile Picture
    3 on at

    Hey Pete!  I am building a similar inspection.  Curious to see if you completed your project and how did it work out?  Where does the response data pass to, hoping a different sharepoint list?  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard