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 / Patch gallery items ra...
Power Apps
Unanswered

Patch gallery items randomly updating incorrect sharepoint records

(0) ShareShare
ReportReport
Posted on by 80

Hi all,

 

I have an app which updates records in a sharepoint list, which then can be edited via a gallery.

 

I have a gallery that looks like this:

Kambro_0-1693386537006.png

 

The items of the gallery:

 

If( 
 ctxCol = "CLASS",
 SortByColumns(
 colTxnReviewFiltered,
 "CLASS",
 If(
 ctxSortDescending,
 SortOrder.Descending,
 SortOrder.Ascending
 )
 ),
 ctxCol = "DIGITS",
 SortByColumns(
 colTxnReviewFiltered,
 "DIGITS",
 If(
 ctxSortDescending,
 SortOrder.Descending,
 SortOrder.Ascending
 )
 ),

 ctxCol = "DATE",
 SortByColumns(
 colTxnReviewFiltered,
 "DATE",
 If(
 ctxSortDescending,
 SortOrder.Descending,
 SortOrder.Ascending
 )
 )
)

 

 

The submit edit button has this code:

 

Patch(
 'CC Txns - template',
 ForAll(Gallery3.AllItems,
 {
 ID: ID,
 APPROVALSTATUS: If(Approval_status_dd.Selected.Value = "Y", true, false),
 APPROVER2: {
 Claims: LookUp(
 collAllUsers,
 DisplayName = Approver_DD.Selected.DisplayName,
 Mail
 ),
 DisplayName: Approver_DD.Selected.DisplayName,
 Email: LookUp(
 collAllUsers,
 DisplayName = Approver_DD.Selected.DisplayName,
 Mail
 ),
 Department: "",
 JobTitle: "",
 Picture: ""
 },
 GLCODE: If(Len(GL_review) = 4 || Len(GL_review) = 8, GL_review.Text,""),
 DESC: GL_DESC_dd.Selected.Value,
 CLASS: GL_CLASS_dd.Selected.Value,
 BRANCH: Branch_DD.Selected.Title,
 DEPT: Dept_DD.Selected.Title,
 HAS_GST: If(GST.Text = "", false, true),
 GST: If(GST.Text <> Blank(), Value(GST.Text), Blank()),
 HAS_ATTACHMENT: If(Exp_flag.Value = true, false),
 REASONNOPHOTO: If(Exp_flag.Value = true, "Receipt in expensify") 
 
 }
 )
);
Navigate(Submitted_txns); Clear(colTxnReviewFiltered); Clear(colTxnReview)

 

 

The dropdown code for the items was suggested by a user on this forum, and this was to get around a problem I had where I needed to display a blank value in the dropdown. In a different power app, users can update all the values in the fields that are displayed above, but sometimes a field may be blank because they have not updated it. It isn't an actual option in the dropdowns they see. I had problems displaying a blank field in the gallery as the reference list did not have a blank value in it.

 

The GL description dropdown has these properties:

Default:  If(ThisItem.DESC = Blank(), "", ThisItem.DESC)

Items: 

 

Ungroup(
 Table(
 {expoptions: Table({Value: Blank()})},
 {expoptions: Sort(Distinct('Expense reference list', EXPDESC), Value)}
 ), 
 "expoptions"
)

 

 

Changing the value in this dropdown updates the dropdown GL Class:

Default: ThisItem.CLASS

Items:

 

 

Ungroup(
 Table(
 { 
 expoptions:
 Distinct(
 Filter(
 'Expense reference list', 
 EXPDESC = GL_DESC_dd.Selected.Value
 ),
 EXPGLDESC
 ) 
 },

 {
 expoptions: 
 Table( {Value:Blank() })
 }
 ), 
 "expoptions"
)
 

 

 

It patches a sharepoint list called 'CC Txns - template'.

 

The various fields update the sharepoint list as expected, except randomly after hitting submit, some records which I haven't modified in the gallery are updated in the sharepoint list. What happens is, a bunch of different records update with the same CLASS value even though the CLASS dropdown was left blank. This happens with different values of the dropdown, but when it does update the random records in the sharepoint list, they all get updated with the same incorrect value, the correct one being simply a blank. 

 

This random record update doesnt happen each time I submit, it is at seemingly random intervals i.e. I have edited some records in the gallery hit submit and done that a bunch of times before I get the random update.

 

The submit button is updating the gallery items that I actually do change in the sharepoint list, it's just sometimes updating a bunch of other records randomly at the same time.

 

I can't find any pattern to the records that are randomly updated. 

 

Please help! This is driving me nuts!

Categories:
I have the same question (0)
  • Kambro Profile Picture
    80 on at

    @RandyHayes  I apologise if it's not appropriate to tag you like this, but I noticed you've provided lots of help on seemingly similar gallery patching issues.

     

    Thanks in advance.

    K

  • Kambro Profile Picture
    80 on at

    I'm not sure if its frowned upon, but going to give this a bump as this is still a problem.

     

    Hoping someone knows what to try.

  • EK-09102106-0 Profile Picture
    12 on at
    I'm having this issue as well.  It works fine the first couple of updates and then starts clearing data in the db that was not cleared on the form.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard