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

Where clause equivalent in Power Apps for Filter

I'm struggling with attempting to write the PA equivalent of a SQL where clause. In this Bold line below I want to flag records to be deleted in TempOptions that have the same QID as a parent record in TempQuestions that has already been marked with the delete flag. PA doesn't like using Filter with =. 

 

Is there a way to filter the multiple records in TempOptions and flag them based on the matching the QID and delete flag from another table (TempQuestions)? 

 

Patch(TempQuestions, LookUp(TempQuestions, QuestionText = ThisItem.Question),{Delete: 1}); ForAll(TempQuestions,Patch(TempOptions, First(Filter(TempOptions, QID = TempQuestions.QID && TempQuestions.Delete = 1)),{Delete: 1})); Remove(TempQuestions,Filter(TempQuestions, Delete > 0)); Remove(TempOptions,Filter(TempOptions, Delete > 0)); Patch(QuestionPool,ThisItem,{Loaded: 0});

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Where clause equivalent in Power Apps for Filter

@krickard

To find all of the records we need to update within TempOptions we can use this code

Filter(TempOptions, QID in Filter(TempQuestions, Delete =1).QID)


But to actually update them we can do this

UpdateIf(
    TempOptions,
    QID in Filter(TempQuestions, Delete =1).QID),
    {Delete: 1}
)


---
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."

View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Re: Where clause equivalent in Power Apps for Filter

@krickard

To find all of the records we need to update within TempOptions we can use this code

Filter(TempOptions, QID in Filter(TempQuestions, Delete =1).QID)


But to actually update them we can do this

UpdateIf(
    TempOptions,
    QID in Filter(TempQuestions, Delete =1).QID),
    {Delete: 1}
)


---
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."

View solution in original post

Highlighted
Helper III
Helper III

Re: Where clause equivalent in Power Apps for Filter

Thanks @mdevaney it works. 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

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

Top Solution Authors
Top Kudoed Authors
Users online (8,437)