cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Dropdown in EMPTY ... again

Dropdown1:

 

Items: _mycollection

 

ID   |  Name

1    |  ABC

2    |  DEF

...

 

IsSearchable: true

 

DisplayFields: "Name"

SearchFields: "ID"

 

However:

Combobox1 is EMPTY. No search, no select, nothing!

 

I'm just trying to understand the logic of this, and why it is so erratic.

Can anyone help?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

@WebPortal 

Actually, sorry the formula should have been this:

With({dt:Sort(Table, Name)},
    ForAll(
        Sequence(CountRows(dt)+1, 0),
        If(Value=0, Patch(Defaults(Table),{Name:"_vazio"}), Last(FirstN(dt, Value)))
    )
)

This will give you all of the columns from your record.

 

If you want to narrow to just Name and ID, then you can change to the following :

With({dt:Sort(Table, Name)},
    ForAll(
        Sequence(CountRows(dt)+1, 0),
        If(Value=0, {Name:"_vazio", ID:0}, Last(FirstN(dt, Value)))
    )
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

18 REPLIES 18
Super User III
Super User III

Please how is the collection created, Onvisible?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Post Prodigy
Post Prodigy

@eka24
Yes, onvisible. Does it matter?

Post Prodigy
Post Prodigy

Now I have closed and reopened the app and I get an error!

 

It wasn't there before I closed the app....

 

Anyway, here it is:

 

WebPortal_0-1611076696692.png

And what is Combobox1.SearchItems I don't know...

Super User III
Super User III

@WebPortal 

What is your collection on _mycollection defined as?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Post Prodigy
Post Prodigy

ClearCollect(__mycollection, {Name: "_vazio"});
Collect(_mycollection, Sort(Table, Name, Ascending))

Super User III
Super User III

@WebPortal 

So, let's take the collection out of the picture then as you don't need it for this combobox.

Set your Items formula to the following:

With({dt:Sort(Table, Name)},
    ForAll(
        Sequence(CountRows(dt)+1, 0),
        If(Value=0, {Name:"_vazio"}, Last(FirstN(dt, Value)))
    )
)

This will give you a dynamic list of sorted items with the first one being "_vazio"

 

Now, go through the Edit Fields on the combobox in the right properties pane of the designer and make sure that the Primary text and search text are as you want them.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Post Prodigy
Post Prodigy

Thanks,

That returns the error: "Name isn't valid. This identifier isn't recognized."

 

This works:

Sort(Table, Name, Ascending)

 

ALL I want is to add an empty "_vazio" at the beginning, so the user may select the empty values...

Super User III
Super User III

@WebPortal 

So the formula I provided you should have worked verbatim as-is.  

Can you put it in place again and give me a screenshot of the formula with the error shown?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Post Prodigy
Post Prodigy

Sure, the formula works well on an empty screen.

It just doesn't work on the screen I want it.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (79,477)