cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elaaadani
Helper V
Helper V

Selection of an item, restriction of options in another

Hello good afternoon. I have two drop-down fields and would like to make the following query
How can I restrict that if in the X field the user selects "100", only the options 101,103 and 104 are shown in the Y field ?

 

elaaadani_0-1609795250935.png

 

Thank you !

 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

Hi @elaaadani 

 

Switch(
    Dropdown1.Selected.x,
    "1000",
    Filter(
        Table2,
        y * 1 < 1050
    ),
    "2000",
    Filter(
        Table2,
        y * 1 > 1999 && y * 1 < 3000
    ), etc.
)

 

worked perfectly for me.  I like to use * 1 instead of Value() to convert text to numbers.  It is a shortcut and easier to see in formulas._1.png_2.png

View solution in original post

8 REPLIES 8
Drrickryp
Super User
Super User

Hi @elaaadani 

Your text and your screenshot don't match but I will assume you mean 1000 and 1001, 1003 and 1004.

You would use the Switch() function as follows as the Items property of the dependent dropdown as follows:

 

 

Switch(Dropdown1.Selected.Value,"1000", Filter(list2, y <=1004),
                                "2000", Filter(list2, y>1004 && y <1100),
                                "3000", Filter(list2, y>=1100 && y <1200), etc,
)
                                   

 

 

 

Thank you very much for responding to me
I have some doubts.
The information in the drop-down lists comes from an excel table.
Drop-down 1 is filled with elements from table 1 and drop-down 2 from table 2, as I leave in the image for you to understand.
In that case, how can I implement this? since I get errors even when trying to use "Value" for both the filter and the switch
Thank you in advance

 

 

elaaadani_0-1609852980015.png

 

Drrickryp
Super User
Super User

Hi @elaaadani 

 

Switch(
    Dropdown1.Selected.x,
    "1000",
    Filter(
        Table2,
        y * 1 < 1050
    ),
    "2000",
    Filter(
        Table2,
        y * 1 > 1999 && y * 1 < 3000
    ), etc.
)

 

worked perfectly for me.  I like to use * 1 instead of Value() to convert text to numbers.  It is a shortcut and easier to see in formulas._1.png_2.png

For some reason it doesn't work for me.
elaaadani_0-1609869486634.png

 

I have this in the formula when you select the element

 

Table 1 = First table from excel
Table 2= Second table from excel

 

Soc_1 = First Dropdown

Org_1= Second Dropdown

Switch(
    Soc_1.Selected,
    "1000",
    Filter(
        Table2,
        Org_1 * 1 < 1050
    ),
    "2000",
    Filter(
        Table2,
        Org_1 * 1 > 1999 && Org_1 * 1 < 3000
    )
)

 

Thanks !

Drrickryp
Super User
Super User

@elaaadani 

The only problem I see is that you have not indicated the name of the column selected.  If you put a "." after Selected, does Intellisense indicate a choice?_1.png

elaaadani
Helper V
Helper V

If I select 1000 in the drop-down list 1, should I specify the column in the excel table where the information comes from ? That is to say
Soc_1.Selected.Table1, "1000" ?

What is the column name in your Table1

Table 1: Soc.

Table 2: OrgC

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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
Users online (4,082)