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 / patch to Dataverse not...
Power Apps
Answered

patch to Dataverse not working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I have created collection form my Dataverse table.

 

 

ClearCollect(MySales,salestable_A)

 

 

I made a excel like editable gallery.

That is working well. My gallery update MySales correctly.

My gallery is made to edit like excel and also to add a data form my item tabe. 

 

What I would like to do is to Patch(Update) MySales data to my Dataverse table "salestable_A". 

Following formula is to Update "salestable_A" but this is not working.

I have red line form ForAll and to the end.

Can somebody advice me what is wrong on my formula?

 

If(!IsBlank ---

is  to update  "salestable_A". 

I need to create to add new one also but I would like to solve update first.

 

ForAll(
 MySales, 
 If(!IsBlank(ThisRecord.salestable_A_id),

 Patch(salestable_A,
 ThisRecord,
 {cr9d1_qty: ThisRecord.cr9d1_qty,
 cr9d1_price: ThisRecord.cr9d1_price
 }
 )
 ));

 

 

 

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Please use this formula:

    ForAll(
    
     MySales,
    
     If(!IsBlank(ThisRecord.salestable_A_id),
    
     
    
     Patch(salestable_A,
    
     LookUp(salestable_A, Column = ThisRecord.Column),
    
     {cr9d1_qty: ThisRecord.cr9d1_qty,
    
     cr9d1_price: ThisRecord.cr9d1_price
    
     }
    
     )
    
     ));

     

    After you put the table in the collection and modify the data, they are not equal.

    So you cannot use ThisRecord as the second parameter of the patch() function.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft 

     

    Thank you so much for your help.

    I still have error message.😫

     

    apps.png

    apps2.png

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    What is the error message?

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft 

     

    Hello, Thankyou for your continued support.

    This is my error message.😅

     

    pic001.png

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I noticed that you used "ThisItem" in the formula.

    Could you tell me why you use it?

     

    You could try to delete 'ThisItem.' first to check if the formula works correctly.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft 

    Hello,

     

    Thank you for your help!

    I have delete  'ThisItem.'.

    Still not working

     

    mssss_1-1616372132486.png

     

     

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Could you tell me:

    What's data type of 'cr9d1_r_daily_report_ope_sales_figures_id' column in dataverse table?

    What's data type of 'qty' in dataverse table?

     

    In addition, please check that the column names are correct.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-xiaochen-msft 

    Thank you for your help!
    This is my Dataverse setting.

     

     

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    I will suggest you to rename the columns of your collection. (Use RenameColumns() function)

    The column names of the table are the same as the column names of the collection, which may cause errors.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    You could also use MyTable[@fieldname] instead of fieldname .

     

    Best Regards,

    Wearsky

     

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard