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 :
Power Platform Community / Forums / Power Apps / Patch & Update Function
Power Apps
Unanswered

Patch & Update Function

(0) ShareShare
ReportReport
Posted on by 372

Hi,

 

I have this logic:

firda59_0-1701930654826.png

I get value in ComboBox using defaultsiselecteditem from SP list 2, and Item using ["aaaa", "bbbb", "cccc"].

 

I want if:

1. Value from SP list 2 already exists in ComboBox, then just update the data 
2. I just add new value in combobox with that item, then patch new data

3. if combobox still blank, then just dont patch/update

 

 

I used this formula, not error but cant work.

Formula:

ForAll(
UpdateDocument_1.AllItems,
If(
IsBlank(
First(
Filter(
'PE Workload',
'Job Description' = JobDesc_Update.Text
)
).'Task (Task0)'
),
// If 'Task (Task0)' is blank, then patch data
Patch(
'PE Workload',
Defaults('PE Workload'),// You may need to adjust this based on your list structure
{
'Job Description': JobDesc_Update.Text,
'Task (Task0)': Task_2.Text,
PIC: Text(PIC_PE_2.Selected.Value),
Title: ProductID_Update.Text,
Customer: Customer_Update.Text,
'% Progress': 0
// Add other fields as needed
}
),
// If 'Task (Task0)' is not blank, then update data
UpdateIf(
'PE Workload',
'Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text,
{
PIC: Text(PIC_PE_2.Selected.Value)
// Add other fields as needed
}
)
)
)

 

 

How to do it? Thank you!!!

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at
    Re: Patch & Update Function

    Hi @firda59 

     

    Try this formula,

     

    If( 
    IsBlank(ComboBox1.Selected.Value), /* If ComboBox is blank, do nothing */,
    If(
    IsEmpty(
    Filter(
    'PE Workload',
    'Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text)), /* If Task (Task0) is not found, patch new data */
    Patch(
    'PE Workload', Defaults('PE Workload'),
    {
    'Job Description': JobDesc_Update.Text,
    'Task (Task0)': Task_2.Text,
    PIC: Text(PIC_PE_2.Selected.Value),
    Title: ProductID_Update.Text,
    Customer: Customer_Update.Text,
    '% Progress': 0 /* Add other fields as needed */
    } ), /* If Task (Task0) is found, update data */
    UpdateIf(
    'PE Workload',
    'Job Description' = JobDesc_Update.Text &&
    'Task (Task0)' = Task_2.Text,
    {
    PIC: Text(PIC_PE_2.Selected.Value) /* Add other fields as needed */ } )
    )
    )

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

  • firda59 Profile Picture
    372 on at
    Re: Patch & Update Function

    Hi @Rajkumar_404 ,

     

    I try that formula but cant work, so I modify, and I got this formula:
    ForAll( UpdateDocument_1.AllItems,
    If(IsBlank(PIC_PE_2.Selected.Value),
    {},
    If(LookUp('PE Workload','Job Description' = JobDesc_Update.Text,'Task (Task0)') = Task_2.Text,
    UpdateIf('PE Workload','Job Description' = JobDesc_Update.Text && 'Task (Task0)' = Task_2.Text,{'Task (Task0)': Task_2.Text,PIC: Text(PIC_PE_2.Selected.Value)}),
    Patch('PE Workload',Defaults('PE Workload'),{'Job Description': JobDesc_Update.Text,'Task (Task0)': Task_2.Text,PIC: Text(PIC_PE_2.Selected.Value),Title: ProductID_Update.Text,Customer: Customer_Update.Text,'% Progress': 0}))))

     

    I can update data, I can skip update/patch the data if combobox blank, but for patch function, It will patch all data again which combobox not blank. So there are double data. Do you know how to fix it? Thankyou!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard