cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewNW
Advocate II
Advocate II

Filter Condition

Hi All,

 

I m in the middle of building an app and want to filter a collection as follows.

 

1. selectedRequestor,Permission.Value = "Add"

AND

2. Status.Value Rjected OR Cancelled

AND

3. WFType.Value= XYZ

I have used the following condition but ii won't filter out Cancelled records from the selectedRequestor collection. Can someone please help me with this?  The selectedRequestor collection ends up with records the Status. Value = Cancelled. 

 

ClearCollect(selectedRequestor1,Filter(selectedRequestor,Permission.Value = "Add" && ( Status.Value <>"Rejected" || Status.Value <>"Cancelled")&& WFType.Value ="XYZ"))

 

Thank you. 

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @NewNW ,

Just a logic adjustment - you need And &&, not Or || when you use Does not equals <>

ClearCollect(
   selectedRequestor1,
   Filter(
      selectedRequestor,
      Permission.Value = "Add" && 
      Status.Value <> "Rejected" &&
      Status.Value <> "Cancelled" && 
      WFType.Value ="XYZ"
   )
)

although I am also wondering why you have .Value on Text filters.

 

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.

Visit my blog Practical Power Apps

 

View solution in original post

@mobilismexico ,

You do not need quotes around the field name

LookUp(
   bd_Solicitud_QR,  
   scandata.Text in Clave
)

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @NewNW ,

Just a logic adjustment - you need And &&, not Or || when you use Does not equals <>

ClearCollect(
   selectedRequestor1,
   Filter(
      selectedRequestor,
      Permission.Value = "Add" && 
      Status.Value <> "Rejected" &&
      Status.Value <> "Cancelled" && 
      WFType.Value ="XYZ"
   )
)

although I am also wondering why you have .Value on Text filters.

 

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.

Visit my blog Practical Power Apps

 

Thank you very much @WarrenBelz really appreciated it. 

Hi @NewNW ,

So this is now solved ?

mobilismexico
Resolver I
Resolver I

Can any of you please tell me what is wrong with this comparison?

Filter(bd_Solicitud_QR, Clave = "PH1B-5-221110")

Clave is a text field in the data source bd_Solicitud_QR. This cannot be simpler and yet I get an incompatibility error: "Incompatible types for comparison"

 

mobilismexico_0-1667444713711.png

 

WarrenBelz
Super User
Super User

@NewNW ,

You have it as the Item of a Form which needs a Record, not a Table. Use LookUp instead of Filter.

Thank you. The error went away with the formula:

LookUp(bd_Solicitud_QR, scandata.Text in "Clave" )

 

However, the Form displays no record when I enter a valid Clave value in my input field.

mobilismexico_4-1667477950467.png

 

Is it because I'm not using the result part of the Lookup function? Sorry, but this documentation is not helpful at all:

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup

 

When the input field is empty the Form displays the first record:

mobilismexico_5-1667478055001.png

 

@mobilismexico ,

You do not need quotes around the field name

LookUp(
   bd_Solicitud_QR,  
   scandata.Text in Clave
)

thank you, @WarrenBelz 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,279)