I have two dropdowns, dpd1 is 'Category' and dpd2 is 'Sub-category'.
Under Categories I have 1, 2, 3, 4, 5 etc. Under sub-categories I have "a, b, c, d" etc.
However, I only want certain sub-categories to show up for certain categories, eg. dpd1 = "2", dpd2 = "a, b"; dpd1 = "4", dpd2 = "c, d"
Is there any way to do this? I have tried an IF statement using the same format as how you would populate a normal dropdown eg:
If(dpd1.SelectedText = "4", ["a", "b", "c"])
but this isn't working.
The Form is populated by a SharePoint list and the columns it's updating are Choice columns, if that helps at all.
Thanks,
Solved! Go to Solution.
I figured this out, I had thought I'd done this the other day but tried again today and it worked so not sure what I did then. It was as simple as this:
If
(dpd1.Selected.Value = "1", ["a", "b", "c", "d"],
dpd1.Selected.Value = "2", ["e", "f"],
dpd1.Selected.Value = "3", ["g", "h", "i", "j"])
@misc
I am not sure if your values you cited are all made up values or if you are getting them from some place, but if you are making your own Items in dpd1, you can easily add this without any If's.
Example:
Items property of dpd1 -
Table(
{Value:1, Subs:["a", "f"]},
{Value:2, Subs:["a", "b"]},
{Value:3, Subs:["b", "d"]},
{Value:4, Subs:["c", "d"]}
)
Items property of dpd2 -
dpd1.Selected.Subs
Result:
I hope this is helpful for you.
EDIT: oh...and by the way - avoid using the SelectedText property, it is deprecated and should be avoided.
Thanks for your reply, I've tried to do that and it doesn't want to work, giving me the red wiggly line error "Name isn't valid, identifier not recognised" on my first Value and the overall error "Expected Operator, we expect an operator such as +, * or & at this point in the formula".
The dropdowns are choice columns which are pulled from SharePoint, so the default Items of of dpd1 is:
Choices([@Incidents].Incident_x0020_Category)
Could that be why this fix doesn't work?
EDIT: Having played around more after your comment on SelectedText I can confirm I have managed to get it to half work eg. I can use the following to have dpd2 show the correct options for one of the choices from dpd1:
If(dpd1.Selected.Value = "1", ["a", "b", "c", "d"])
However when I try to expand it using that format and OR statements it breaks again eg:
If(dpd1.Selected.Value = "1", ["a", "b", "c", "d"]||dpd1.Selected.Value = "2", ["e", "f", "g"])
I figured this out, I had thought I'd done this the other day but tried again today and it worked so not sure what I did then. It was as simple as this:
If
(dpd1.Selected.Value = "1", ["a", "b", "c", "d"],
dpd1.Selected.Value = "2", ["e", "f"],
dpd1.Selected.Value = "3", ["g", "h", "i", "j"])
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
213 | |
198 | |
83 | |
59 | |
38 |