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

Filter problem

I’m pretty new to Power Apps and have been looking at various sources to help with the syntax of a filter command I am using but have run out of ideas.

 

Here’s the background:

 

  1. I am developing an Employee request application with data stored in SharePoint
  2. My objective is to auto-populate a single line text field with the email address of a Legal Director in the main list used in SharePoint (‘Requisitions’)
    • The criteria being we have one Legal Director for each of our Business Units in each Country we serve
  3. In Power Apps
    • Country [DataCardValue4].  The SharePoint List ‘Requisitions’ includes the values available for selection – which appear in the drop down control
    • Business Unit [Dropdown1].  The values in the dropdown are retrieved from the list ‘Organization’:  Items:   Distinct(Choices(Organization.BU), Value)
  4. My questions:
    • My problem is with the syntax of the filter command in the Legal Director field (which returns no results and a delegation warning):

Filter(Approvals,Country = DataCardValue4.Selected.Value) And Filter(Approvals,'Business Unit' = Dropdown1.Selected.Result)

Warren_Gibbs_0-1633441172419.png

  • This filter command is written on a dropdown control [Dropdown5].  I did this in order to specify the correct returned field (‘Legal Director’) in the right hand ‘Depends on’ field list

 

Any help would be really appreciated.  Thanks!

 

Requisitions:

Warren_Gibbs_1-1633441172425.png

 

 

 

Approvals

Warren_Gibbs_2-1633441172427.png

 

 

Organization:

Warren_Gibbs_3-1633441172429.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User
Super User

@Warren_Gibbs 

I'm old school about database design and do not use compound fields at all, only single line of text, numbers and date/time.  The principle that each cell in a database must contain a single piece of data is one that works best for me.  Others disagree and there are workarounds but I haven't found the need for them in my apps.  

View solution in original post

5 REPLIES 5
Drrickryp
Super User
Super User

@Warren_Gibbs 

The problem is that country is a choice field.  Change it to single line of text and your formula should work.

Thanks @Drrickryp.   You mean getting users to type in the country name during data entry and not having the drop down?  If so, the impact of doing that (e.g. Power Automate flows that rely on the accuracy of the Country field value) would not be worth the auto-populated value for Legal Director.    

Drrickryp
Super User
Super User

@Warren_Gibbs 

You can either hard code the dropdown, use a second list of countries, or use Distinct(Approvals, Country) for the items in the dropdown if you already have all of them in your list.

I used; Distinct(Choices(Approvals.Country),Value) to produce the list in a new dropdown; Dropdown4

 

The filter has been updated, but still produces the same warning (with no data); 

Filter(Approvals,Country = Dropdown4.Selected.Result) And Filter(Approvals,'Business Unit' = Dropdown1.Selected.Result)

 

Do I need to change the Country and Business Unit fields in the Approvals list from Choice to Single-line text too?

Drrickryp
Super User
Super User

@Warren_Gibbs 

I'm old school about database design and do not use compound fields at all, only single line of text, numbers and date/time.  The principle that each cell in a database must contain a single piece of data is one that works best for me.  Others disagree and there are workarounds but I haven't found the need for them in my apps.  

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,596)