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 / Dropdown control - def...
Power Apps
Answered

Dropdown control - default value based on var

(0) ShareShare
ReportReport
Posted on by 153

Hi

Dropdown (DD) control.

Items:

 

Distinct(Table; Order_no) //Order_no is a text

 

DefaultSelectedItems:

 

{value: LookUp( table; ID = varItemID).Order_no} //return proper value

 


When I run the app DD i empty. What to do to have there Order_no as default from record varItemID?

BR

Categories:
  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @knyklu ,

     

    I think this is what you want?

    {Value: LookUp( table, ID = varItemID, ThisRecord.Order_no}
    
    //Considering Order_no is the actual columnName

    Note: Idk if your App considers "," as ";" but replace if error

    Hope this helps

  • knyklu Profile Picture
    153 on at

    Hi,

    Both, Your and my Lookup return the same value. DD by default is empty.

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @knyklu ,

     

    "DefaultSelectedItems" comes under Combobox control.

    Dropdown has Default property.

    If you are using Dropdown then in "Items" property will contain list of items and Default is used to reference either by name or Index as 1,2,3,4 or "1", "2" so on...
     

  • knyklu Profile Picture
    153 on at

    Hi @Ethan_R 

    Neither of them have "Default" property. Only "DefaultSelectedItems".
    Even, if I put hardcodeed values in "DefaultSelectedItems" like:
    {value: "sample Order_no"} the reult is the same, empty.
    And sorry, I forgot to menation, that I'm creating a custom page, not a regular canvas app.

  • Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    To set the default value of a Dropdown control based on a variable (varItemID), you need to make sure that the variable holds a valid value and matches one of the available options in the Dropdown control's Items property. Here's an example of how you can achieve this:

    1. Make sure the varItemID variable is set correctly with a valid value that matches one of the Order_no values in your table.

    2. Update the DefaultSelectedItems property of the Dropdown control as follows:

     

    //DefaultSelectedItems: 
    LookUp(Table, ID = varItemID)

     

     

    In the code above, Table should be replaced with the actual name of your table that contains the Order_no field.

    The LookUp function searches for a record in the table where the ID matches the value of varItemID. Assuming that the Order_no field is unique, the LookUp function will return the entire record with the matching ID, which includes the Order_no value. The Dropdown control will then set the matching record as the default selected item, displaying its corresponding Order_no value.

    Ensure that the "Items" property of the Dropdown control is set to "Distinct(Table, Order_no)" to populate the Dropdown options correctly.

    By following these steps, the Dropdown control should display the "Order_no" value from the record that matches the "varItemID "variable as the default selected item.

  • knyklu Profile Picture
    153 on at

    @ShaheerAhmad 

    Order_no is not a unique field, ID is.

    My scenario is. 

    1. Detail list (DL) besed on Table. ID is a unique field of the Table.

    2.  I select a record from DL.

    3. Press "Edit" buttom where I set the:

     

     

     

    Set(varItemID; DL.Selected.ID);

     

     

     

    4. ...and open the side panel, with DD where:

    Items:

    Distinct(Table; Order_no)

     DefaultSelectedItems:

    {value: LookUp( Table; ID = varItemID).Order_no} //return proper value

    real on screenshot of DefaultSelectedItems:

    knyklu_0-1686308028540.png

     

    (there is no diffent between DD or Combobox. Result the same - empty)

  • Verified answer
    Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Based on your description, it seems that the issue lies with the expression in the DefaultSelectedItems property of the Dropdown control. The formula you provided is not formatted correctly. Here's the corrected version:

    DefaultSelectedItems:

    { value: LookUp(Table, ID = varItemID).Order_no }

    Make sure to use a comma (,) instead of a semicolon (;) to separate the parameters within the LookUp function.

    Additionally, if the Order_no field is not unique, you may need to modify the formula to retrieve a single record. For example, you can use the First function to get the first record that matches the condition:

    DefaultSelectedItems:

    { value: First(Filter(Table, ID = varItemID)).Order_no }

    This expression filters the Table based on the ID matching varItemID and then retrieves the Order_no field from the first record.

    Please ensure that the varItemID variable is correctly set before opening the side panel and that the Lookup or Filter function returns a valid record with a non-empty Order_no value.

  • knyklu Profile Picture
    153 on at
    { value: LookUp(Table, ID = varItemID).Order_no }

    I dont get it.

    I have tested this as my first solution (check my first post) and it wasn't work. Now works fine!

    Thanks for help.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard