Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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!

  • EK-09102106-0 Profile Picture
    10 on at
    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 at
    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 at
    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,618 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,962 Most Valuable Professional

Leaderboard