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

Reference Data Set From a Previous Drop Down List

Hello

 

How do I reference a data table based upon a previous drop down?

 

I have one table which is the master set of data ie Choice 1, Choice 2, Choice 3, when I select one of them, I want it to be able to look up the next table and only give the options for that table.

 

Each one is it's own table.

 

Choices
Choice  1Choice 2Choice 3
Choice 1AppleAppleBanana
Choice 2BananaOrangeOrange
Choice 3KumquatWatermelonKumquat
   Watermelon

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @SunnyJess ,

This makes no sense to me why the original did not work (actually sort of worked but with warning error) and why the below works, but it does (another anomaly in PowerApps code I guess).

Switch(
    Dropdown1.Selected.'Site (Site)',
    "BNO",
    Distinct(
        BNO,
        'BNO (BNO)'
    ),
    "MGR",
    Distinct(
        MGR,
        'MNR (MNR)'
    ),
    "YourThirdChoice",
    Distinct(
        YourThirdList,
        YourThirdField
    ),
    "YourFourthChoice",
    Distinct(
        YourFourthList,
        YourFourthField
    )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

13 REPLIES 13
WarrenBelz
Super User
Super User

Hi @SunnyJess ,

So the Choice1/2/3 are three tables and in each are fields (I will call them ChoiceField) which can be displayed in a drop down ddChoice1 which has the Items Choice1.ChoiceField, the Items Property of the second drop down ddChoice2 would be 

Filter(
   Choice2,
   ChoiceField = ddChoice1.Selected.ChoiceField
).ChoiceField

 following on, the Items of ddChoice3 would be

Filter(
   Choice3,
   ChoiceField = ddChoice2.Selected.ChoiceField
).ChoiceField

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz 

 

I think you're on the right path, but not quite there.

 

Dropdown1 will allow you to choose choice 1, choice 2, or choice 3

 

Dropdown2 will allow you to choose a field from choice 1, choice 2, or choice 3.

 

That's it.  There's 2 dropdowns only. but differing fields dependent on the choice you make in dropdown1.

 

Thanks

 

@SunnyJess 

Hi @SunnyJess ,

To "unconfuse" (if there is such a word), can you please give a different name to your choices to your list. Are your tables the columns or the rows?

@WarrenBelz 

 

Apologies,

 

I have 4 tables

 

Whatever you select in table 1 lets you pick from the list in tables 2-4

 

Dropdown 1
Table 2
Table 3

Table 4

 

Dropdown 2 then lets you pick an item dependent upon the table you chose in Dropdown1

 

Table 2
Item 1
Item 2

Item 3

 

Table 3
Item 2
Item 4

Item 5

 

Table 4
Item 2
Item 3

Item 6

Item 7

 

I hope that makes more sense

@WarrenBelz  I have a similar question。

How to realize multi-level linkage of drop-down list?

 

I'm not sure what that means

Hi @SunnyJess ,

To answer @Freesunshine 's question  - with difficulty and should not be necessary if the data is deigned to fit the query that you know you have to make.

If you have the drop-down selecting list name (rather than values in them), then you need to have the second drop-down formed conditionally - the Items something like - this is syntax only.

Switch(
   Dropdown1.Selected.Value,
   "Table2",
   Table2.YourListFieldName,
   "Table3",
   Table3.YourListFieldName,
   "Table4",
   Table4.YourListFieldName
)

so this would show the fields from the list as per your specs.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Hi @WarrenBelz ,

 

That's got it a touch closer, however it only allows one table to be selected

 

See attached picture

 

@SunnyJess 

Thanks @SunnyJess ,

This is now a very different question to your post. I provided some syntax to guide you  - the code below should work providing the output of  Dropdown1.Selected.'Site (Site)',  (I assume the field name presented) is 'Site (Site)' is either "BNO" or "MGR"

Switch(
   Dropdown1.Selected.'Site (Site)',
   "BNO", BNO.'BNO (BNO)', 
   "MNR", MNR.'MNR (MNR)'
)

I used Switch as I believed you had multiple values. You can use If (I assume this is on Items of the drop-down)

If(
   Dropdown1.Selected.'Site (Site)' = "BNO", 
   BNO.'BNO (BNO)', 
   MNR.'MNR (MNR)'
)

To test the validity of your Items, just put

MNR.'MNR (MNR)'

and see if you get the other list.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,420)