web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to filter empty or...
Power Apps
Answered

How to filter empty or blank items from gallery before patching

(0) ShareShare
ReportReport
Posted on by 114

Hi all,

My code below is to patch to my SharePoint List from a collection, colSubmittedQuestion which being populated by a gallery.allitems, and it is working perfectly if I don't have the RemoveIf statement in it.  

Without removing the blank or empty records,  the patch function patches ALL items.  

My TriagedScore column is a type choice and it has 1,2,3 as choices inside a gallery and all items are being collected into a collection called colSubmittedQuestion.  Please see the image below.

davidvo68_0-1656636937880.png

My code:

ForAll(

RemoveIf(colSubmittedQuestion, IsBlank(TriagedScore) || IsEmpty(TriagedScore)),  // this is the statement I need help with

RenameColumns(colSubmittedQuestion,"ID", "SID"),
Patch('Fenced Triaged Review Checklist',
LookUp('Fenced Triaged Review Checklist',ID = SID),
{ProgramName:ProgramName, ProgramID:Value(ProgramID),
ARIWGInitialDate:ARIWGInitialDate, ARIWGCompletionDate:ARIWGCompletionDate,
PriARIWGPOC:PriARIWGPOC, AltARIWGPOC:AltARIWGPOC, Member:Member,
SIMAlignment:LookUp(Choices('Fenced Triaged Review Checklist'.SIMAlignment),Value=SIMAlignment.Text), SectionNumber:Value(SectionNumber.Text),
TriagedScore:LookUp(Choices('Fenced Triaged Review Checklist'.TriagedScore),Value=TriagedScore),
QuestionNumber:Value(QuestionNumber), Question:Quesion, ARIWGComment:ARIWGComment, BusinessOwnerComment: BusinessOwnerComment,
ResultCommunicate2POC:ResultCommunicate2POC, Resultof2Submission:Resultof2Submission,
SecondSubmissionDate:SecondSubmissionDate, OverallAssessComment:OverallAssessComment,CMB:CMB

}
));

Thank you in advance.

Categories:
I have the same question (0)
  • Verified answer
    Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @davidvo68 

     

    you can try this

    ForAll( RemoveIf(RenameColumns(colSubmittedQuestion,"ID", "SID"), IsBlank(TriagedScore) || IsEmpty(TriagedScore)), 
     Patch('Fenced Triaged Review Checklist', LookUp('Fenced Triaged Review Checklist', ID = SID),
     {
     ProgramName: ProgramName, 
     ProgramID: Value(ProgramID),
     ARIWGInitialDate: ARIWGInitialDate, 
     ARIWGCompletionDate: ARIWGCompletionDate,
     PriARIWGPOC: PriARIWGPOC, 
     AltARIWGPOC: AltARIWGPOC, 
     Member: Member,
     SIMAlignment: LookUp(Choices('Fenced Triaged Review Checklist'.SIMAlignment),Value=SIMAlignment.Text), 
     SectionNumber: Value(SectionNumber.Text),
     TriagedScore: LookUp(Choices('Fenced Triaged Review Checklist'.TriagedScore),Value=TriagedScore),
     QuestionNumber: Value(QuestionNumber), 
     Question: Quesion, 
     ARIWGComment: ARIWGComment, 
     BusinessOwnerComment: BusinessOwnerComment,
     ResultCommunicate2POC: ResultCommunicate2POC, 
     Resultof2Submission: Resultof2Submission,
     SecondSubmissionDate: SecondSubmissionDate, 
     OverallAssessComment: OverallAssessComment,
     CMB: CMB
     }
     )
    );
    
    
  • davidvo68 Profile Picture
    114 on at

    Thank you Alex.  I tried your modified code and it did take care of the error. However, it still went thru and updated all of the gallery items including the blank/empty ones.

    Any other suggestion?  I was thinking of instead doing the remove blank/empty items, just update the ones which has value of 1,2,3 in the column but not sure how to modify the code.

  • davidvo68 Profile Picture
    114 on at

    Hi Alex,  sorry that I spoke too soon.  It did work with your modified code.  Thank you so much.

    Another question though related to this code.  How would I modify this code just to update the items which being changed or modified?

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @davidvo68 

    there is no an easy way to do that.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard