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:
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!
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.
@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
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,962
Most Valuable Professional