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

Dropdown list-multiple conditions

Hello,

 

I have a dropdown list where the user should only see the items that have the following conditions:

1. from DataSource1 the requester should be equal to User().Email

2. from DataSource2 the status of the item should be equal to "Completed"

 

I have managed to display in dropdown list the items of the first condition by applying the following formula: Filter(DataSource1, SubmittedbyEmail = User().Email) but I have tried different ways adding the second condition but it seems that the way that I am trying to combine the conditions is not working.

 

Could anyone help?

 

Many Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Dropdown list-multiple conditions

Hi @anna2109 ,

Could you please share a bit more about the data structure of your two Data sources?

Is there a relationship between the DataSource1 and the DataSource2?

 

If there is a relationship between your DataSource1 and DataSource2, you could consider combine your two data sources into a single one collection, then apply the two filter conditions to the single one collection.

 

I assume that there is a relationship between your DataSource1 and DataSource2 via a common field called "RelationField". Please consider take a try with the following workaround:

Set the Items property of the Dropdown box to following:

Filter(
       AddColumns(
               DataSource1,
               "StatusValue",
               LookUp(DataSource2, RelationId = DataSource1[@RelationId]).Status
       ),
       SubmittedbyEmail = User().Email,
       StatusValue = "Completed"
)

If the two Datasoures are both SP List, and the "Status" column is a Choice type column, please modify above formula as below:

Filter(
       AddColumns(
               DataSource1,
               "StatusValue",
               LookUp(DataSource2, RelationId = DataSource1[@RelationId]).Status.Value  // Modify here
       ),
       SubmittedbyEmail = User().Email,
       StatusValue = "Completed"
)

Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Can-I-add-fields-from-multiple-data...

 

If there is no relationship between your DataSource1 and DataSource2, I afraid that there is no way to achieve your needs in PowerApps currently.

 

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

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Dropdown list-multiple conditions

@anna2109 

Assuming "Status" is a SharePoint Choices column you can do it like this.

 

Filter(DataSource1, SubmittedbyEmail = User().Email, Status.Value = "Completed")

 

Otherwise, if "Status" is a single line text field you can do it like this.

 

Filter(DataSource1, SubmittedbyEmail = User().Email, Status = "Completed")

 

---
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
Helper I
Helper I

Re: Dropdown list-multiple conditions

I tried it but it didn't work, the status is from a second data source whereas the submitted by is from the datasource1. I can't combine in the formula the two data sources show to filter the dropdown list accordingly

 

 

Highlighted
Super User III
Super User III

Re: Dropdown list-multiple conditions

@anna2109 

Here's a revised solution.  I initially missed that you had 2 data sources.  Before applying the FILTER you must use ADDCOLUMNS + LOOKUP to make table join for Status.  See below for my code.

 

Filter(
    AddColumns(
        DataSource1,
        "Status",
        LookUp(DataSource2,ID=DataSource2[@ID],Status)
    ),
    SubmittedbyEmail = User().Email,
    Status="Completed"
)

 

---
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
Community Support
Community Support

Re: Dropdown list-multiple conditions

Hi @anna2109 ,

Could you please share a bit more about the data structure of your two Data sources?

Is there a relationship between the DataSource1 and the DataSource2?

 

If there is a relationship between your DataSource1 and DataSource2, you could consider combine your two data sources into a single one collection, then apply the two filter conditions to the single one collection.

 

I assume that there is a relationship between your DataSource1 and DataSource2 via a common field called "RelationField". Please consider take a try with the following workaround:

Set the Items property of the Dropdown box to following:

Filter(
       AddColumns(
               DataSource1,
               "StatusValue",
               LookUp(DataSource2, RelationId = DataSource1[@RelationId]).Status
       ),
       SubmittedbyEmail = User().Email,
       StatusValue = "Completed"
)

If the two Datasoures are both SP List, and the "Status" column is a Choice type column, please modify above formula as below:

Filter(
       AddColumns(
               DataSource1,
               "StatusValue",
               LookUp(DataSource2, RelationId = DataSource1[@RelationId]).Status.Value  // Modify here
       ),
       SubmittedbyEmail = User().Email,
       StatusValue = "Completed"
)

Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Can-I-add-fields-from-multiple-data...

 

If there is no relationship between your DataSource1 and DataSource2, I afraid that there is no way to achieve your needs in PowerApps currently.

 

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (7,448)