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

Community site session details

Session Id : d4do3r2bjXRZyC07QaR+AA
Power Apps - Building Power Apps
Unanswered

Patch gallery items randomly updating incorrect sharepoint records

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2023 09:21:30 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!

  • EK-09102106-0 Profile Picture
    10 on 09 Oct 2024 at 21:08:24
    Patch gallery items randomly updating incorrect sharepoint records
    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.
  • Kambro Profile Picture
    80 on 21 Mar 2024 at 02:10:27
    Re: Patch gallery items randomly updating incorrect sharepoint records

    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.

  • Kambro Profile Picture
    80 on 30 Aug 2023 at 10:46:49
    Re: Patch gallery items randomly updating incorrect sharepoint records

    @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

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete