cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

Dropdrown with Condition

Hello,

Quick question here:

I have two SPL "Orders" and "Employees"

My employees lists look like this:

ID | Title | Department | Active

1   | Employee A | Production "Choice" | Yes/No

 

My Orders List looks like this:

ID | Title | CustomerID | EmployeeID

1 | 100001 | Customer ABC | Lookup field i.e 1

 

In my form I have my data card with the following Properties

Default = ThisItem.EmployeeID

DataField: EmployeeID

Items = Choices([@orders].EmployeeID)

 

The question is:

I want that my combobox show the values based in a condition, i.e if Employee = "Production" should be in that list.

 

Any idea?

 

Thanks in advancs

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @sajarac ,

Could you please share a bit more about the "Active" column? Is it a Yes/No type column?
Have you taken a try with the solution I provided above? Is it helpful for your scenario?

 

If you want to filter the EmployeeID ComboBox against the two conditions "Department" and "Active", please take a try with the following workaround:

Set the Items property of the EmployeeID ComboBox to following:

 

Filter(
       Choices([@orders].EmployeeID),
       Value in Filter(Employees, Department.Value = "Production", Active <> false).ID
)

 

Note: I assume that the "Active" column is a "Yes/No" type column in your SP List. The EmployeeID LookUp column reference values from the ID column in your Employees List.

 

If the "Active" column is still a Choice type column as the "Department" column, please consider modify above formula as below:

 

Filter(
       Choices([@orders].EmployeeID),
       Value in Filter(Employees, Department.Value = "Production", Active.Value = "Yes").ID
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

12 REPLIES 12
Super User III
Super User III

@sajarac 

Replace this code:

Choices([@orders].EmployeeID)

With this code:

Filter(Employees, Department.Value = “Production”)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted

Hi, thanks for your prompt response and double thank you because is Saturday!!

 

Unfortunately is not picking any value.

 

Is a lookup column maybe that is the reason?

Highlighted

@sajarac 

True, it’s Saturday.  But there’s nothing else I can do.  Nothing is open, haha.

 

Did my formula produce many blank options in the ComboBox?  Or did it produce absolutely nothing?

 

What is the DisplayName property and SearchName property? Did you set it to [“Employee”]?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted

LOL, you are right nothing to do.

 

Anywway the formula produces and empty box

 

Replace this code:

Choices([@orders].EmployeeID)

With this code:

Filter(Employees, Department.Value = “Production”)

 

BTW But in my Orders is where the EmployeeID is saved. so this formula is not pointing that list,right?

 

Sorry I am confused....I need a beer!

Highlighted

@sajarac 

I thought we could use this code as well in the Update property of the Card and it would write back to the SP list

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

Id: Value(ComboBox1.ID),

Value: ComboBox1.ID}

 

Any screenshots you can show?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted

Thank you, let me create a GIF file for you and I will send you via PM.

 

Thanks again for your help!

 

 

Highlighted

@sajarac 

I assume this is to protect privacy?  Fair enough. GIF is a good idea.

Highlighted
Community Support
Community Support

Hi @sajarac ,

Could you please share a bit more about the "EmployeeID" column in your Orders List? Does it reference values from the "ID" column in your Employees List?

Further, do you want to filter your EmployeeID ComboBox available options based on a specific condition?

 

Based on the needs that you mentioned, I think the Filter function could achieve your needs. Please consider set the Items property of the EmployeeID ComboBox to following:

Filter(
       Choices([@orders].EmployeeID),
       Value in Filter(Employees, Department.Value = "Production").ID
)

Set the DefaultSelectedItems property of the EmployeeID ComboBox to following:

ThisItem.EmployeeID

Please consider take a try with above solution, check if the issue is solved.

 

If the "EmployeeID" column reference values from the Title column in your Employees List, you should modify above Items property formula as below:

Filter(
       Choices([@orders].EmployeeID),
       Value in Filter(Employees, Department.Value = "Production").Title
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hi,

@v-xida-msft and @mdevaney 

 

It took me too long to figure out issue, now I think I have a better elaborated question, kindly see bellow:

 

************

 

I have two SPL "Orders" and "Employees"

My employees lists look like this:

ID | Title | Department | Active

1   | Employee A | Production "This is a Choice" | Yes

2   | Employee B | Sales                                       | No

 

My Orders List looks like this:

ID | Title | CustomerID | EmployeeID

1 | 100001 | Customer ABC | Lookup field i.e 1

 

In my form I have my data card with the following Properties

Default = ThisItem.EmployeeID

DataField: EmployeeID

Items = Choices([@orders].EmployeeID)

 

The question is:

I want that my combobox show the values based in two conditions "Department" and "Active" , i.e if Employee = "Production" and "Yes" should appear in that dropdown result.

 

Any idea?

 

And Thank in advance for any response.

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (13,095)