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 / Fail to change the val...
Power Apps
Unanswered

Fail to change the value of selected item by using UpdateIf()

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone. Today, I was asked to add a function on my app: when a item has been created and someone edit it in app, the value of "editcount" in datasource should change to 1 from 0. I used a function UpdateIf('Cer-List',ID=SelectedCerItemID,{OData__x7f16__x8f91__x6b21__x6570_:1}) to realize it, the SelectedCerItemID is the Id of the item which is been selected in the gallery. However, the value cannot be change when it is been selected!

For instance, there are two items and their id is 1 and 2 respectively, I make my code like" UpdateIf('Cer-List',ID=1,{OData__x7f16__x8f91__x6b21__x6570_:1}) ",and I select 1 in gallery——the editcount value won't change.However,If I select 2 in gallery and still make Id=1,The value changes to 1!

(btw. I am a Chinese user and "OData__x7f16__x8f91__x6b21__x6570_"means "editcount" in Chinese)

If any one can offer me advice to fix it, I 'll be really appreciate!Thank you in advance.

 

Categories:
I have the same question (0)
  • v-zhoqian-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Do you want to change the data in datasource?

    If so, you can try the Patch function.

    Patch function in Power Apps (contains video) - Power Platform | Microsoft Learn

     

     

     

     

    Best Regards,

    Habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-zhoqian-msft ,

     

    I tried Patch but my quetion still exist. Once I selet an item in gallery, there will be an OnSelect function like: Set(CerItemID, ThisItem.Id)   And my Patch function is Patch('CerList',Lookup('CerList',ID=CerItemID),{EditCount:1}). Would you please use your powerapp and sharepoint list to have a try, to see if you have the same problem as this?Thank you very much!

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

    Hi @Anonymous ,

     

    There is no problem in my test.

    Will an error message appear? Or there is no error, but the value has not been modified?

     

    This seems to be ThisItem.ID

     

    vzhoqianmsft_0-1683622758506.png

     

     

     

    Best Regards,

    Habsburg Qian

    If this post helps, then please consider Accept it as the solution to help the other members find it.

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 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard