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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue Displaying DropD...
Power Apps
Unanswered

Issue Displaying DropDown Box Selected Value in Power Apps with Dataverse table source

(1) ShareShare
ReportReport
Posted on by 112

Hi Community,

 

I tried and searched for an answer but still couldn't figure it out so hoping someone can help me.

 

I have a dataverse table with a bunch of questions, it's quite simple, i have Category, QuestionID, Question and Answer where 3 options in a choice column "Yes", "Maybe", "No". 

 

When I created a gallery to display the questions by category, with a dropdown box insert in the gallery for each question, I manage to get the defautselelecteditems to show the patched/existing answer.  I used a collection in the Answer's dropdown box OnChange property so that if/when user click to select/change answers from the drop down, the final result will be patch via ForAll of the collection.  Since I have to break down the display of questions by category, I use TabList to control which category to switch to showing which batch of questions, the gallery underneath the Tablist will then filter the related category accordingly, now, when user selects answers in the previous gallery, once they click to switch to anther category, meaning the gallery will display, say instead of question 1-6, now it will display 7-13, and if user decides to go back to check what they selected previous in 1-6, all the selections in the dropdown will be gone, meaning the answerdropdown box ddanswer.Selected.Value doesn't hold the value.  If there was existing old value, it will show as it was the defaultselecteditem.  

 

How do I keep the selected value of all the answers when user makes changes?  I suppose I need to revise the defaulselecteditem part but whatever I tried, it just doesn't work.

 

My defaultSelectedItems for the answer dropdown box is 

Filter(Choices(Questionnaires.Answer), Value = ThisItem.Answer)
 
This shows the existing patched value.  Any help is greatly appreciated!
 
S
Categories:
I have the same question (0)
  • BoboLee Profile Picture
    33 on at

    Dropdown uses "default" while combobox uses "DefaultSelectedItems" - you can just put ThisItem.Answer in the default and Choices(Questionnaires.Answer) for the items

  • sc0rpiongirl Profile Picture
    112 on at

    Thanks for the quick reply. ThisItem.Answer is currently / already the default of the data field. I tried all type of combination in filter / lookup etc to try to hold the value in ddAnswer but to no avail. (Eg tried to lookup the colAnswers  (the collection to hold user’s answer etc) but as soon as user switch category which means the gallery is filtered to show the next batch of questions, all the previous answers to the questions in dropdown is gone…

  • BoboLee Profile Picture
    33 on at

    What's the code in OnChange? BTW if user selects the same category the value will be clear. 

  • sc0rpiongirl Profile Picture
    112 on at

    Actually upon thinking it over, I suppose the only way around this is to patch the answers to each category when user click the TabList to switch cateogries, that way whatever user selected for that category, before switching, after being patched, will become the most recent "existing record" therefore will display as defaultselecteditems...

     

    Here is my Answer dropdown box OnChange property:

    OnChange = 

    If(
        !IsBlank(
            LookUp(
                colAnswers,
                QuestionID = ThisItem.QuestionID
            )
        ),
        UpdateIf(
            colAnswers,
            QuestionID = ThisItem.QuestionID,
            {Answer: ddAnswer.Selected.Value}
        ),
        Collect(
            colAnswers,
            {
                QuestionID: ThisItem.QuestionID,
                Answer: ddAnswer.Selected.Value
            }
        )
    );
     
  • BoboLee Profile Picture
    33 on at

    I guess you put the table e.g. Questions in the data source of the table with filter of the category. 

    In the OnChange of dropdown or combo box of the the answner:

    If(
        !IsBlank(Self.Selected),
        Patch(
            Questions,
            ThisItem,
            {
                Answer:Self.Selected.Value
            }
        )
    )

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard