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 / UpdateIf Multiple cond...
Power Apps
Answered

UpdateIf Multiple conditions to update collection in gallery view

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

anicholls_0-1650815905786.png

I am using all of the fields in the gray area as update value fields, the user will type text or select from the drop down what they want the checked records to be overridden with. When you hit apply updates you will see the selected records update only IF there is a value other than blank or empty in the filters shown; otherwise i want the value to remain as is when i hit apply. Right now if I run this only the Audit Name field is updating and it is updating regardless if a selection is made form the drop down or not. Please help:

 

UpdateIf(
colGridData,
ThisRecord in colSelected,
If(
!IsEmpty(SAuditName_1.Selected),
{Audit_x0020_Name: SAuditName_1.Selected},


!IsEmpty(SMgmtBoardMembers_1),
{Mgmt_x0020_Board_x0020_Members: SMgmtBoardMembers_1.Text},


!IsBlank(SMgmtAreaHead_1),
{Mgmt_x0020_Area_x0020_Head: SMgmtAreaHead_1.Text},


!IsBlank(SSrMgmtOwner_1),
{'Sr Mgmt Owner': SSrMgmtOwner_1.Text},


!IsBlank(SProcessOwner_1),
{'Process Owner': SProcessOwner_1.Text},


!IsBlank(SControlOwner_1),
{Control_x0020_Owner: SControlOwner_1.Text},


!IsBlank('SAddtlContact(s)_1'),
{Addt_x0027_l_x0020_Contact_x0028: 'SAddtlContact(s)_1'.Text},


!IsEmpty(SRollUpChainRptg_1.Selected),
{Roll_x0020_Up_x0020_Reporting_x0: SRollUpChainRptg_1.Selected},


!IsEmpty(SReportingChain_1.Selected),
{Reporting_x0020_Chain: SReportingChain_1.Selected},


!IsEmpty(SDepartment_1.Selected),
{Department: SDepartment_1.Selected},


!IsEmpty('SSub-department_1'.Selected),
{'Sub-Department': 'SSub-department_1'.Selected},


!IsEmpty(SProcess_1.Selected),
{Process: SProcess_1.Selected},


!IsEmpty(SAuditID_1.Selected),
{'Audit Id': SAuditID_1.Selected}
)
);
Clear(colSelected);
Reset(checkboxall);
Reset(SAuditName_1);
Reset(SControlOwner_1)

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Another attempt at what I am trying to do, if the dropdown uptop does not have a value then don't update the value in the gallery leave as is. This isn't working either it is just updating the value to blank:

     

    anicholls_0-1650822024394.png

     

  • Verified answer
    v-liwei-msft Profile Picture
    Microsoft Employee on at
    Hi @Anonymous ,
     
    Could you please tell me if you use the if function first judge"! Isempty (sauditname_1. Selected)" and get the result of" {audit_x0020_name: sauditname_1. Selected} "when this condition is true. After that, your if function cannot traverse the subsequent conditions and results?
    There can be multiple conditions in the if function, but after it meets the first condition, it will only return the result of the first condition, and the remaining conditions and results will not continue to appear. So you can use the patch function to merge multiple records into one record, and nest multiple if functions in the patch function.
    I will give you my solution for your reference:
    UpdateIf(
    colGridData,
    ThisRecord in colSelected,
    Patch(
    If(
    !IsEmpty(SAuditName_1.Selected),
    {Audit_x0020_Name: SAuditName_1.Selected}
    ),
    If(
    !IsEmpty(SMgmtBoardMembers_1),
    {Mgmt_x0020_Board_x0020_Members: SMgmtBoardMembers_1.Text}
    ),
    If(
    !IsBlank(SMgmtAreaHead_1),
    {Mgmt_x0020_Area_x0020_Head: SMgmtAreaHead_1.Text}
    )
    If(
    !IsBlank(SSrMgmtOwner_1),
    {'Sr Mgmt Owner': SSrMgmtOwner_1.Text}
    )
    If(
    !IsBlank(SProcessOwner_1),
    {'Process Owner': SProcessOwner_1.Text}
    )
    If(
    !IsBlank(SControlOwner_1),
    {Control_x0020_Owner: SControlOwner_1.Text}
    )
    If(
    !IsBlank('SAddtlContact(s)_1'),
    {Addt_x0027_l_x0020_Contact_x0028: 'SAddtlContact(s)_1'.Text}
    )
    If(
    !IsEmpty(SRollUpChainRptg_1.Selected),
    {Roll_x0020_Up_x0020_Reporting_x0: SRollUpChainRptg_1.Selected}
    )
    If(
    !IsEmpty(SReportingChain_1.Selected),
    {Reporting_x0020_Chain: SReportingChain_1.Selected}
    )
    If(
    !IsEmpty(SDepartment_1.Selected),
    {Department: SDepartment_1.Selected}
    )
    If(
    !IsEmpty('SSub-department_1'.Selected),
    {'Sub-Department': 'SSub-department_1'.Selected}
    )
    If(
    !IsEmpty(SProcess_1.Selected),
    {Process: SProcess_1.Selected}
    )
    If(
    !IsEmpty(SAuditID_1.Selected),
    {'Audit Id': SAuditID_1.Selected}
    )
    )
    )

    I think this link will help you a lot :Patch function in Power Apps (contains video) - Power Apps | Microsoft Docs

     
    Beat Regards,

    Levi

     
  • v-liwei-msft Profile Picture
    Microsoft Employee on at
    Hi @Anonymous   ,
    Could you please tell me if my reply help you solve this problem? I would be grateful if you can reply to me at your earliest convenience.
     
    Beat Regards,

    Levi

  • AmgadAhmed Profile Picture
    2 on at

    thanks for help 

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

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard