Skip to main content

Notifications

Power Apps - Power Apps Pro Dev & ISV
Unanswered

Setting up Default property of a DropDown Control in Microsoft Power Apps

Posted on by
Hi there,

I have a canvas app which has a gallery "glyApproveQuotation" that show items from a sharepoint list, when an item is selected a button with the following formula navigate to another screen
items property of the button=
    Switch(
        LookUp(
glyApproveQuotation.AllItems, ID = selectedItemID).AnalysisClass,
        "DNA", Navigate('DNA Analysis Overview', ScreenTransition.UnCoverRight, { QuoteSelected: LookUp( 

glyApproveQuotation.AllItems, ID = selectedItemID) }),
        "RNA", Navigate('RNA Analysis Overview', ScreenTransition.UnCoverRight, { QuoteSelected:
        Notify("Class not recognized", NotificationType.Error)
    );
the item selected is thenstored in a variable selectedItemID, when navigating to the other screen the controls "Text, dropdown and combobox" display the items selected, all the control shows the items selected with the following formula
If(
    IsBlank(QuoteSelected),
    "",
    QuoteSelected."The Sharepoint column")
except the dropdown which display nothing "just blank"
I set the default property of a dropdown as follow
Default = If(IsBlank(QuoteSelected), "", QuoteSelected.RicGroup)
the SharePoint column in the case of the dropdown is of type singlle line of text
from the screenshot where the arrows are pointing it shows the group "Ric.Tonon" in the Default property pane but the control is blank
The dropdown depends on a Text label and a combobox, the dropdown shows the groups the selected user "from the combox " belong to, it could blank in case the user doesn't belong to any group, or 1-6 option to select from
the schema has to be closely tied to schema of the item property of the item property, the item property has this formula of DataType table
the dropdown Items=
Filter
    ( GroupDetailsDNAOverview, StartsWith(Lower(displayName), Lower("ric." &       txtPILastNameDNAOverview.Text)) || StartsWith(Lower(displayName), Lower("Ric." &      txtPILastNameDNAOverview.Text)) )

The dropdown default with this formula which is of data type text
Default = If( IsBlank(QuoteSelected), Blank(), QuoteSelected.RicGroup )

The dropdown depends on to two controls, a combobox and and Text control, 
the  Variables in the dropdown control are defined in a combobox the Onselect property

OnSelect =    
IsBlank(cmbPIEmailDNA.Selected.UserPrincipalName), // Check if a user is selected
    "",
    UpdateContext({UserGroupsDNA: MicrosoftEntraID.GetMemberGroupsV2(cmbPIEmailDNA.Selected.UserPrincipalName, true)})
);
ClearCollect(
    GroupDetailsDNA,
    ForAll(
        UserGroupsDNA.value,
        MicrosoftEntraID.GetGroup(Value)
    )
);
The combobox item property show this formula to search users.
Item =
Office365Users.SearchUserV2({searchTerm: Self.SearchText}).value
The Text control displays the user's last name extracted from the combobox.
Text = If(
    IsBlank(cmbPIEmailDNA.Selected), // Check if no user is selected
    "", // If no user is selected, display nothing
    Office365Users.UserProfile(cmbPIEmailDNA.Selected.UserPrincipalName).Surname // Fetch the surname of the selected user
)

Please Advice
Mogahid
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 1,216 on at
    Setting up Default property of a DropDown Control in Microsoft Power Apps
     

    Dropdown Items: The dropdown's Items property is set to a table:

    Filter(
        GroupDetailsDNAOverview,
        StartsWith(Lower(displayName), Lower("ric." & txtPILastNameDNAOverview.Text)) ||
        StartsWith(Lower(displayName), Lower("Ric." & txtPILastNameDNAOverview.Text))
    )
    
    
    Dropdown Default: The Default value is a text value:
    If(IsBlank(QuoteSelected), Blank(), QuoteSelected.RicGroup)
     
    modify the Default formula to match the displayName field in the dropdown’s Items property:
    If(
        IsBlank(QuoteSelected),
        Blank(),
        LookUp(
            GroupDetailsDNAOverview,
            displayName = QuoteSelected.RicGroup
        ).displayName
    )
     
    Add a Label to display QuoteSelected.RicGroup to ensure it holds the expected value.
    Concat(
        GroupDetailsDNAOverview,
        displayName & "; "
    )
     
    Modify the ClearCollect logic to explicitly include the necessary columns:
    ClearCollect(
        GroupDetailsDNA,
        ForAll(
            UserGroupsDNA.value,
            {
                displayName: MicrosoftEntraID.GetGroup(Value).displayName,
                groupId: MicrosoftEntraID.GetGroup(Value).id // Add any other necessary fields
            }
        )
    );
     
    Add the following to the OnChange property of the combobox
    Reset(DropdownControlName)
     
    The MicrosoftEntraID.GetGroup call retrieves group details. Ensure it returns expected data. Add a gallery control to visualize the GroupDetailsDNA collection:
    GroupDetailsDNA
     
     
    Items
    Filter(
        GroupDetailsDNAOverview,
        StartsWith(Lower(displayName), Lower("ric." & txtPILastNameDNAOverview.Text)) ||
        StartsWith(Lower(displayName), Lower("Ric." & txtPILastNameDNAOverview.Text))
    )
     
     
    Default
    If(
        IsBlank(QuoteSelected),
        Blank(),
        LookUp(
            GroupDetailsDNAOverview,
            displayName = QuoteSelected.RicGroup
        ).displayName
    )
     
    OnChange (Combobox): Reset(DropdownControlName)
     
    try the above - your issue will b fixed.
     
     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard