cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anonymous16
Frequent Visitor

Conditionally Choose Items in Dropdown

I have a table named Vacation in Dataverse as such:

 

Tag

Name

Request

1

Sam

Approved

1

Harry

Approved

2

Jane

 

2

Mary

 

 

In my Power Apps, I have a dropdown control ("Dropdown") that is supposed to filter by Tag and show the first Request value (if it exists).  For example, if Tag is 1, then Dropdown should show "Approved".  If Tag is 2, then Request is blank.  In this case, the Dropdown should give the user the options to choose from: ["Approved", "Rejected", "Under Review"]. 

 

This is the formula that I have in the Items property of Dropdown.  

 

If(
LookUp('Vacation', 'Tag' = Tag_control.SelectedText.Value).'Request',

Text(LookUp('Vacation', 'Tag' = Tag_control.SelectedText.Value).'Request'),

["Approved", "Rejected", "Under Review"]

)

 

I can't get the dropdown to function.  I get this error - "invalid argument type (Table). Expecting a text value instead". 

I'm not sure why, because I used the Text() function to wrap the second LookUp statement.  

 

Could someone please help? 

3 REPLIES 3
rubin_boer
Super User
Super User

hi @anonymous16 assuming your tag selected comes form the gallery this may be an option for you.

 

Set the DropDown's Items = If(yourGallery.Selected.tag = 1,["Approved"],["Approved", "Rejected", "Under Review"])

 

Result

Peek 2022-02-19 20-37.gif

Hope it helps ,

R

Thanks @rubin_boer for your response.  I re-read my question and realized that I should have added some clarity.  The Dropdown should show the corresponding value in the Request column for the given Tag.  It's not necessary that Tag 1 always maps to Approved - I only used that as an example.  If Tag 1 was previously mapped to Rejected for example, then I would need Rejected to appear in the Dropdown.      

 

A given Tag number will have the same value in the Request column.  

rubin_boer
Super User
Super User

hi @anonymous16 

 

no problem, make the follwing change

Set the DropDown's Items = If(yourGallery.Selected.tag = 1,[yourGallery.Selected.Request],["Approved", "Rejected", "Under Review"])

 

The dropdown will display the value of Request for that entry.

 

Hope it helps,

R

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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