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

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
Super User II
Super User II

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
Super User II
Super User II

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

 

Super User II
Super User II

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

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 !

Super User II
Super User II

@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

Helper IV
Helper IV

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
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.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (17,931)