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

Notifications

Announcements

Community site session details

Community site session details

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard