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 / How exactly to update ...
Power Apps
Unanswered

How exactly to update a collection?

(0) ShareShare
ReportReport
Posted on by 943

Hi all,

 

I need to update my collection after its being edited.

 

This is the formula i'm using right now:
UpdateIf(FormColl, Gallery1.Selected.'Service Order Id' = FormColl.SO_Number,
{SO_Number: TextInput1.Text,
AssignedEngineer: TextInput2.Text,
Description:TextInput3.Text,
SiteName: TextInput4.Text,
ActualEngineer: Dropdown2.Selected.Value,
AssignedDate: TextInput6.Text,
ActualDate: DatePickerAct.SelectedDate + Time(Value(HourPickerAct.Selected.Value), Value(MinutePickerAct.Selected.Value), 0),
Visit: TextInput7.Text,
Status: "Saved Local",
Question1: Question1.Text,
Respond1: Respond1.Selected.Value,
Remarks1: Remarks1.Text,
Question2: Question2.Text,
Respond2: Respond2.Selected.Value,
Remarks2: Remarks2.Text,
Question3: Question3.Text,
Respond3: Respond3.Selected.Value,
Remarks3: Remarks3.Text,
Question4: Question4.Text,
Respond4: Respond4.Selected.Value,
Remarks4: Remarks4.Text
});

I dont't know what is wrong,

Please help.

 

Regards,

pytbyt

Categories:
I have the same question (0)
  • PavanKumar Profile Picture
    479 on at

    HI, There are multiple ways you can update in powerapps

    1. Updateif - if you want to update one or more values (but not the entire record)

    2. Update or Patch - if you want to update the whole record.

     

    try using Patch once and see if the issue still persists and let me know.

     

    Regards,

    Pavan Kumar Garlapati

  • PytByt Profile Picture
    943 on at

    Hi @PavanKumar 

    Thanks for the reply, 

     

    Can i get a sneak peek for using those update & updateif function in real case similiar like me?

    That'll really help.

     

    Thanks,

    pytbyt

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

    Hi @PytByt ,

    UpdateIf is used to update one/one fields that meet the formula.

    For example:
    table:formula:

    UpdateIf( IceCream, Quantity > 175, { Quantity: Quantity + 10 } )

    result:

     

    Using this formula will only change the Quantity value of 200 and 300, not other fields.

     

    I suggest you use Patch function.

    What's more, FormColl.SO_Number represents a table.

    The formula needs a field.

    Try this:

    Patch(FormColl, Gallery1.Selected.'Service Order Id' = SO_Number,
    {SO_Number: TextInput1.Text, 
    AssignedEngineer: TextInput2.Text, 
    Description:TextInput3.Text, 
    SiteName: TextInput4.Text, 
    ActualEngineer: Dropdown2.Selected.Value, 
    AssignedDate: TextInput6.Text, 
    ActualDate: DatePickerAct.SelectedDate + Time(Value(HourPickerAct.Selected.Value), Value(MinutePickerAct.Selected.Value), 0), 
    Visit: TextInput7.Text, 
    Status: "Saved Local", 
    Question1: Question1.Text,
    Respond1: Respond1.Selected.Value,
    Remarks1: Remarks1.Text,
    Question2: Question2.Text,
    Respond2: Respond2.Selected.Value, 
    Remarks2: Remarks2.Text,
    Question3: Question3.Text,
    Respond3: Respond3.Selected.Value, 
    Remarks3: Remarks3.Text,
    Question4: Question4.Text,
    Respond4: Respond4.Selected.Value, 
    Remarks4: Remarks4.Text
    });

    Here are doc about patch, update, updateif for your reference:
    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

     

    Best regards,

    Community Support Team _ Phoebe Liu

  • PytByt Profile Picture
    943 on at

    Hi @v-yutliu-msft 

    Thank you very much for your reply and explaination.

    I will try your solution and get back to you again later.

     

    Regards,

    pytbyt

  • PytByt Profile Picture
    943 on at

    Hi @v-yutliu-msft 

     

    I'm back with error: Invalid Argument type.

     

    The things is, i want to update 2 collection on the same time. So i use 1 single button, and i put this formula on its OnSelect Property:

    Patch(HeaderColl, GalleryCDS.Selected.'Service Order Id' = SO_Number,
    {SO_Number: TextInput1.Text,
    AssignedEngineer: TextInput2.Text,
    Description:TextInput3.Text, SiteName: TextInput4.Text,
    ActualEngineer: Dropdown2.Selected.Value,
    AssignedDate: TextInput6.Text,
    ActualDate: DatePickerAct.SelectedDate + Time(Value(HourPickerAct.Selected.Value), Value(MinutePickerAct.Selected.Value), 0),
    Visit: TextInput7.Text, Status: "Saved Local"});

    ForAll(GalleryInspectionEdit.AllItems, Patch(LineColl, DataTableServiceHeader.Selected.SO_Number = SO_Number,
    {SO_Number: TextInput1.Text,
    No_Questions: NumberQuestion.Text,
    Questions: TitleQuestion.Text,
    Responds: RadioRespond.Selected.Value,
    Remarks: TextInputRemarks.Text}));


    What should i do?
    I dont know what went wrong since its my first time using collection.

    Edit: 
    I use the formula above to patch my collection after its data being edited.
    I use the data table control to temporary store the data so it can be selected (or there any way around to select a data record in a collection?)
    I use ForAll function to make sure that all data items that have been edited is collected (cmiiw).

     

    Please help me.

     

    BR,

    pytbyt

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard