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 will not update ...
Power Apps
Answered

Patch will not update certain records

(0) ShareShare
ReportReport
Posted on by 820

Hi

I have strange situation

In one my project exact code works in other not. 

The code should update record in dataverse but instead it updates all records in dataverse table  with the last edited value in my gallery. The code looks simple. new_busena is a choice type column

 

Patch(Remontai,

ForAll(
Filter(Gallery2_2.AllItems,Checkbox1.Checked) ,

{
new_remontaiid:new_remontaiid,
new_busena:ComboBoxBusena.Selected.Value
//new_darbuotojas:LookUp(Darbuotojai,'Darbuotojo kodas'=ComboBoxDarbuotojas_1.Selected.'Darbuotojo kodas')


}
)
);

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Please consider changing your Formula to the following:

    Patch(Remontai,
     ForAll(
     Filter(Gallery2_2.AllItems,Checkbox1.Checked) As _item,
     {
     new_remontaiid: new_remontaiid,
     new_busena: _item.ComboBoxBusena.Selected.Value
    //new_darbuotojas:LookUp(Darbuotojai,'Darbuotojo kodas'= ComboBoxDarbuotojas_1.Selected.'Darbuotojo kodas')
     }
     )
    );

     

    Not sure where your new_remontaiid value is coming from, but if it is the gallery...then prepend it with _item. as well.

     

    I hope this is helpful for you.

  • julijazas Profile Picture
    820 on at

    @RandyHayes 

    I have already tried this. I can not call control _item.ComboboxBusena because inside the gallery i have a horizontal container and in that horizontal container i have 2 more containers that splits the whole gallery into 2 parts to make it responsive and my ComboboxBusena sits inside one of those containers

    The structure as follows:

    Gallery

        >Horizontal container

              >HorizontalContainer1

                   >ComboboxBusena

              >HorizontalConainer2

     

    new_remontaiid is a GUID from Remontai table

     

     

     

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Yes, you'll not be able to access the control in the container.  The only way to pull that out is to bring the value to the gallery level.

    If it is just text that you need from the combobox, then throw a label in the gallery template and set the Text property to: ComboBoxBusena.Selected.Value

    Make the label non-visible.

    Then reference the label text in your formula.

  • julijazas Profile Picture
    820 on at

    @RandyHayes 

    Seems i am having issue patching choice field. That does not work in this way:

    new_busena:lblComboboxBusena.Text

    Says expecting record value instead

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Yes, you need to supply a record for a choice column.

    new_busena: {Value: lblComboboxBusena.Text}

     

     

  • julijazas Profile Picture
    820 on at

    @RandyHayes 

    Writing formula

    new_busena: {Value: lblComboboxBusena.Text}

    Throws me same error - expecting record value instead...

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    That is a record!  Where exactly in your formula is it stating that?  If you could provide a screenshot of the formula with the red underlines showing, that would be helpful.

  • julijazas Profile Picture
    820 on at

    @RandyHayes 

    Whenever a ad that line all code bocomes underlined

     

    jja_0-1661268855539.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jja 

    Ah...your column names do not match!  The error is "Expecting a record value instead".  This is a tell-tale sign from the patch function that the names of your columns do not match the exact names of the columns in your datasource.

    Look at your dataverse table schema and get the real name of the column.  Then use that in your formula - it will all work then.

  • julijazas Profile Picture
    820 on at

    @RandyHayes 

    you mean it does not like new_busena?

    jja_0-1661271330474.png

     

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard