cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Djuls
Frequent Visitor

Collect Radio button value from a gallery

Hello,

 

I created a gallery with a list of questions (the number of the questions depends of the survey you selected in a previous screen). I've also included, in this gallery, some radio buttons (OK, NOK and NA). And, at the end of this survey, you have to press on a button to collect all these datas (Questions and answers).

 

Here is my issue:

I would like to know if it's possible to collect some specific datas from this gallery without using 'Gallery.AllItems'? I would be to get something like this:

ClearCollect(Collection,{Surveys:Label3.Text,Question_Num:Label2.Text,Question:Title10.Text,Answer:Radio.  ???  })

 

My final goal, by pressing the button, is to check that the user reply to every question (but I cannot do it question by question seeing that the number is variable). If it's the case I save the datas otherwise I put an error message.

 

Thanks in advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

@Djuls 

 

Can you please try to modify your expression as:
 
Clear(Collection_Test), ForAll(Gallery_Questions.AllItems,Collect(Collection_Test,{Question:Label_Question.Text, Answer: Radio_Answer.Selected.Value}))
This will create a collection iterating over all the items in your gallery control.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

@Djuls 

For that, based on the collection you have now, you can sum the values:

   If(Sum(Collection_Test, If(IsBlank(Answer), 1, 0)) > 0, "unanswered questions", "all answered")

This will sum the values of the Answer column - 1 if it is blank and 0 if it is not blank.  If the sum is greater than 0, then there are blank/unanswered questions.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

6 REPLIES 6
RandyHayes
Super User III
Super User III

@Djuls 

To get exact on this solution I would need more specific information from you on your App and controls and so forth.  So, I will be somewhat generic in the response.

Let's say you have your Gallery (Gallery1) and it has the Radio control on it (Radio1).  Let's say your Gallery has an Items property that includes a table which has a column in the record called "Question".

With the above, you can get the specific value with this formula:

   Lookup(Gallery1.AllItems, Question="some question text").Radio1.Selected.Value

 

You can work that into your app and if you have some specific problems, post back with more details.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Djuls
Frequent Visitor

Thank you for you prompt reply.

 

I tried your solution but it did not work. Please, let me include some printscreens (I make as simple as possible by now, just want to collect the question 'Label_Question' and its value from radio button 'Radio_Answer' [even if user didn't replied]). When I use your proposal, I only get the last question that user replied and nothing for the answer.

So the user, after having selected the specific survey, have to reply to different questions (the number depends of the surveys you chosed). For each question, you have the choise in between 'Yes', 'No' and 'NA'(Not applicable). When user finish to populate it, he click on a button 'Valider'.

 

My expectation would be to get a form with two columns. The first one with every question and the second with the answer (even empty if not replied).

I want also precise that I didn't create neither form nor data table, I don't know if it could be useful for what I want to do?

 

Regards,

 

yashag2255
Dual Super User II
Dual Super User II

@Djuls 

 

Can you please try to modify your expression as:
 
Clear(Collection_Test), ForAll(Gallery_Questions.AllItems,Collect(Collection_Test,{Question:Label_Question.Text, Answer: Radio_Answer.Selected.Value}))
This will create a collection iterating over all the items in your gallery control.
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

@Djuls 

Sorry I misunderstood your original question - you had mentioned you wanted to NOT use the Gallery.AllItems data for some reason and it appeared you just wanted to get a specific question and answer from your gallery.

The screen shots helped, but looks like you figured out your solution already.

Glad you figured it out.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Djuls
Frequent Visitor

Don't worry, I was probably not clear enough. But maybee you can reply to my second part 😉 which is how can I check that for every line of the column 'Answer' from collection 'Collection_Test' is not empty?

@Djuls 

For that, based on the collection you have now, you can sum the values:

   If(Sum(Collection_Test, If(IsBlank(Answer), 1, 0)) > 0, "unanswered questions", "all answered")

This will sum the values of the Answer column - 1 if it is blank and 0 if it is not blank.  If the sum is greater than 0, then there are blank/unanswered questions.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (71,021)