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 / Unable to update colle...
Power Apps
Unanswered

Unable to update collection from gallery if current values in collection are null/empty

(0) ShareShare
ReportReport
Posted on by 30

I have a SharePoint list that I want to load into a gallery, then allow the user to edit the details of each row and save the results back to the list.  Fairly straightforward stuff.

 

I know that for each row in the parent list there will always be 4 rows in the child list (the list used to populate the gallery).  Furthermore I know basically what those rows will look like.  The app is related to leases.  This particular screen contains information regarding the utilities (power, water, gas, and sewer) associated with the lease.  When I initially create the rows in the utility list for a given lease, I seed them with the type of utility and set the other values to Blank().

 

On a subsequent page I load the utilities gallery from the utility list for editing. Here’s where things get strange.

 

If I load the rows directly from the list into a collection (the preferred method, I would assume) using the following:

 

ClearCollect(

    colUtilities,

    Filter(

        'Branch Location Utilities',

        BranchLocationInformationID = gblID <-- the ID from the parent row

    )

);

 

the rows load successfully.  However, when I try to edit the rows in the gallery and update the collection on change with this code

 

Patch(colUtilities,

ThisItem,

{UtilityProviderName: txtProviderName_Utilities.Text}

);

 

the collection does not update unless there is already a non-blank value in the column.

 

However, if instead of the ClearCollect above I do this:

 

Clear(colUtilities);

Patch(

    colUtilities,

    Defaults(colUtilities),

    {

        Title: gblTitle,

        UtilityType: "Power",

        UtilityResponsibility: "IMS",

        UtilityProviderName: "",

        UtilityProviderContact: "",

        UtilityProviderPhone: "",

        UtilityProviderWebAddress: "",

        UtilityProviderContactEmail: "",

        UtilityProviderNotes: "",

        UtilityDepositRequired: "TBD",

        UtilityDepositAmount: 0

    }

);

 

four times (once for each utility type) and try to edit the rows in the gallery and update the collection on change with the same Patch statement as above, the collection updates correctly.

 

Obviously neither solution is acceptable.  I can’t use the first scenario because it makes no sense to load non-blank values for the columns.  If I use the second scenario, I’m not loading the collection with the existing values from the list.

 

What am I missing????

Categories:
I have the same question (0)
  • Verified answer
    timl Profile Picture
    36,319 Super User 2025 Season 2 on at

    Hi @lburgess 

    You're not missing anything. Unfortunately, there's a bug/limitation in PowerApps that prevents us from updating collections if the source field contains a blank/null. Here's a thread that contains a similar problem.

     

    https://powerusers.microsoft.com/t5/General-Discussion/Patch-not-updating-on-null-values-in-database-tables/m-p/92003

     

    A workaround for this problem is to replace any blank fields with an empty string. You could use code that looks like this after your ClearCollect:

    UpdateIf(collection1, IsBlank(UtilityProviderName), {UtilityProviderName:""})
    --> Repeat the above for any possible blank fields that you might want to update

     

  • lburgess Profile Picture
    30 on at

    Thanks!  I found that not long after I posted the question. It does seem to resolve the issue.  At the same time, it seems that should be unnecessary.  Not sure why PowerApps would treat a blank any differently than "" or " ".

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 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard