Skip to main content

Notifications

Community site session details

Community site session details

Session Id : M01dyjMbxCRwjS2O9jusdq
Power Apps - Building Power Apps
Answered

DefaultSelectedItems Using Variables for ComboBox

Like (0) ShareShare
ReportReport
Posted on 28 Dec 2019 03:47:17 by 230

Hi Community - 

 

I am having some issues and hope that this may be a quick solve. I am looking to have the default selected item for my combox using a variable. I currently get the error "Expected Table value." I am setting the variable with on select & navigate from another screen and using this combox to filter the gallery on the current/new screen. This would be a huge user win if they are able to have the screen already filtered to the item they previously selected.

 

Any ideas how I can solve this? 

Categories:
  • MASinc13 Profile Picture
    4 on 14 Oct 2022 at 21:25:40
    Re: DefaultSelectedItems Using Variables for ComboBox

    I hope this helps.  If you are trying to get the defaultselecteditem to be the variable you captured in a DD or CB then use [Text(varNAME)].

    In my scenario i want a location to be chosen before going into a order form.  
    Splash screen has a button that brings up the location DD.  Button to capture variable.  Close group screen. 

    On my form i have used the above formula as the defaultedselecteditem. 

    Hope this helps

    I have a setup

  • cmegow Profile Picture
    on 09 Sep 2021 at 04:18:52
    Re: DefaultSelectedItems Using Variables for ComboBox

    @v-xida-msft I have followed your instructions, but am unable to set my defaultselecteditem on my dropdown.  The variable I've created from your instructions above does indeed create a table, but nothing appears in the dropdown box.

     

    Here is the onSelect value:

     

    Set(POProject, Table({'Project Lookup':'Project_Search_Budget_3'.Selected}))

     

    The item field for Project_Search_Budget_3 is: 

    Filter(SortByColumns([@'FPC - Project Status List'],"Project_x0020_Lookup"), 'Small Project' = false)

     

    Thanks for any help you can offer.

     

    However, no value is being produced.  Here are the values of my dropdown:

    DefaultSelectedItems: POProject

    Items: Choices([@'FPC-Purchase Orders'].'Project Name')

     

    The 'Project Name' Column in sharepoint is a lookup column, which pulls information from the 'FPC-Project Status List' column 'Project LookUp'.

  • Verified answer
    v-xida-msft Profile Picture
    on 30 Dec 2019 at 07:18:52
    Re: DefaultSelectedItems Using Variables for ComboBox

    Hi @tlevine ,

    Could you please share more details about the formula you used to initialize the ?

    Do you want to set a default value within the ComboBox using a variable?

     

    Based on the error message that you mentioned, it seems to tell that the DefautlSelectedItems property of the ComboBox is required to provide a Table value. Please check if you have set your variable as a Table value rather than a record value or single Text value.

     

    I have made a test on my side, please consider take a try with the following workaround:

    2.JPG

     

    3.JPG

    The data structure of RecordsCollection as below:

    4.JPG

     

    Set the OnSelect property of the "Initialize Var" button to following:

    Set(DefaultOption, Table({ProductName: "Power BI"}))

    On your side, you should initialize your variable as below:

    Set(Var1, Table({DisplayColumn: "Specific Value"}))

    Note: The DisplayColumn represents the column you used as display value within your ComboBox.

     

    Please consider take a try with above sample solution, then check if the issue is solved.

     

    Best regards,

  • PowerAddict Profile Picture
    7,314 Most Valuable Professional on 28 Dec 2019 at 07:13:12
    Re: DefaultSelectedItems Using Variables for ComboBox
    Without more details and based on the error message you are getting, I can tell that you are probably passing text as the defaultselected using a variable. You need to make sure it's a record of the items that populate the combo box.

    Let me know the items property of the combo box, and how you are setting the variable which you want to use to set the defaultselected property.

    ---
    If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

    Hardit Bhatia
    https://thepoweraddict.com
  • tlevine Profile Picture
    230 on 28 Dec 2019 at 06:27:55
    Re: DefaultSelectedItems Using Variables for ComboBox

     This video has gotten me closer, but still unable to get it to work while using a contextual variable:

     

    https://www.youtube.com/watch?v=zxlmIwAP0i0 

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard