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 / Set value of Combo Box...
Power Apps
Answered

Set value of Combo Box in Gallery from the Collection Values

(0) ShareShare
ReportReport
Posted on by 145

Hi,

 

I have an app where there is a Gallery of CDS Data Source "Questions". Each record of Questions is have different "Answers" record.

I have used combo box to show all the records Answers record related to the particular Question.

When the user selects the Answers and clicks on Next button, I am collecting the Question and the Answer in a Collection.

But when the user selects the Back Button, it should show Previous Questions with selected Answers.

 

This is the Collection for Collecting the Question and Answer Records: 

 

ForAll(
 SelectedQuestions,
 Collect(
 saveQuestions,
 {
 Name: SelectedQuestions[@Name],
 GroupId: SelectedQuestions[@Group],
 QuestionId: SelectedQuestions[@Question],
 answerRecord: SelectedQuestions[@selectedAnswer]
 }
 );
 
);

 

 

On Selecting the Back Button the Combo Box should show the Selected answers but I am struggling to get the selected Answer

Community20_1.png

 

Any help is appreciated.

 
 
Categories:
I have the same question (0)
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @tjalui ,

    Do you mean that:
    1)you select one item in the gallery of Questions?

    2)then you display related answers based on this selected question?

    3)if you click the "next" button, you will create a collection with selected question and selected answers?

    4)if you click the "back" button, you want to display related answers based on  selected question's Previous one in that answer combo box?

    If so, could you tell me:
    1)the formula about how to create SelectedQuestions?

    2)the formula about the answer combo box's Items?
    3)the relationship between Questions entity and Answers entity?

    4)what do you exactly mean about "Previous Questions"?

    I assume that: 

    1)Questions entity and Answers entity relationship is: 1:N, Answers entity has a lookup field named answer(looks up to questions entity)

    2)SelectedQuestions is the gallery's selected Question

    3)"Previous Questions" means the question before the selected question

     

    If so, you could set like this:

    1)galleryquestion's OnSelect:

    Set(SelectedQuestion,Galleryquestion.Selected.Name)

    2)back button's OnSelect:

    Set(SelectedQuestion,LookUp(Questions,ID=Galleryquestion.Selected.ID-1,Name))

    3)the answer combo box's Items:

    Filter(Answers,answer.Name = SelectedQuestion)

     

     

    Best regards,

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 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard