cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
morall
Microsoft
Microsoft

Set dropdown to blank by default

I've created a dropdown list

 

Items forumula:

 

Filter('OneEng Candidates', cr818_OneEngEvent.cr818_oneengeventid = DropdownEvent.Selected.cr818_oneengeventid)

 

 

I set the default value to the dropdown as: "" or "test" but it still keeps showing as the first item in the Items formula filter

 

Why is that? Does the formula override the Default? Do I need to save the app and reload?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@morall 
I can help you with this 🙂

You'll have to create a collection in the and add a blank option.  Do this by creating a collection.

You'll probably need to create the collection in 2 places: OnVisible property of the app and the OnChange property of DropdownEvent.

ClearCollect(colDropdownOptions, {your_column_name: Blank()});
Collect(colDropdownOptions, Filter('OneEng Candidates', cr818_OneEngEvent.cr818_oneengeventid = DropdownEvent.Selected.cr818_oneengeventid).your_column_name;

 

Then refer to the collection in the Items property of your dropdown.

colDropdownOptions

 

A similar concept is shown in this example:

https://matthewdevaney.com/powerapps-collections-cookbook/unique-values-from-a-collection-with-a-bla...

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

7 REPLIES 7
mdevaney
Super User III
Super User III

@morall 
I can help you with this 🙂

You'll have to create a collection in the and add a blank option.  Do this by creating a collection.

You'll probably need to create the collection in 2 places: OnVisible property of the app and the OnChange property of DropdownEvent.

ClearCollect(colDropdownOptions, {your_column_name: Blank()});
Collect(colDropdownOptions, Filter('OneEng Candidates', cr818_OneEngEvent.cr818_oneengeventid = DropdownEvent.Selected.cr818_oneengeventid).your_column_name;

 

Then refer to the collection in the Items property of your dropdown.

colDropdownOptions

 

A similar concept is shown in this example:

https://matthewdevaney.com/powerapps-collections-cookbook/unique-values-from-a-collection-with-a-bla...

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

View solution in original post

Just out of curiosity, the default is meant to select the default item from the list, not necessarily add create new items? 

@morall 

Yes, that's correct.  Your observation is the reason why we cannot default to blank if its not already within the dropdown items as an option.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

I threw this in App and ran Run On Start:

 

ClearCollect(colDropdownOptions, {Name: "Morgan"});
Collect(colDropdownOptions, Filter('OneEng Candidates', cr818_OneEngEvent.cr818_oneengeventid = DropdownEvent.Selected.cr818_oneengeventid).Name;

 

But only "Morgan" is showing up. I would have expected it to "combine" Morgan with the rest of the options. Can you see what I'm doing wrong  

Was missing a ")"

This is causing an error now on my Patch when trying to update an entity with the values in the dropdown menus:

The Patch code on a Button

 

ForAll(
    Gallery4.AllItems,
    Patch(
        'OneEng Candidates_Interviewers',
        Defaults('OneEng Candidates_Interviewers'),
        {
            Candidate: Slot1.Selected,
            Interviewer: Interviewer,
            IVSlot: Value(Label_Slot1.Text),
            Event: DropdownEvent.Selected,
            MorningOrAfternoon:drpdownMorA.Selected.Value
        }
    )
);

ForAll(
    Gallery4.AllItems,
    Patch(
        'OneEng Candidates_Interviewers',
        Defaults('OneEng Candidates_Interviewers'),
        {
            Candidate: Slot1.Selected,
            Interviewer: Interviewer,
            IVSlot: Value(Label_Slot2.Text),
            Event: DropdownEvent.Selected,
            MorningOrAfternoon:drpdownMorA.Selected.Value
        }
    )
);

 

 

"Invalid Argument type. Expecting a record value, but of a different schema."

 

Is this because previously it was looking at records in the dropdown, but now it's looking at a collection?

The table I'm patching this into is expecting a record value and it seems when I create a collection, it strips away the record value. Is there a way to handle this?

as a hack, not sure if there is a better way to do this:

 

 

 

Candidate: First(Filter('OneEng Candidates', Name = Slot1.Selected.Name)) 

 

 

 

The collection is returning a name, and I am trying to use that name as a filter on the 'OneEng Candidates' table, (the one I started with), and return the first record 

 

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,447)