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 to set the value o...
Power Apps
Answered

How to set the value of a datacard in a form

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I have a powerapp generated from a sharepoint list.

 

The EditForm has a datacard called DataCardApproval. DatacardApproval has a TextInputBox called dataCardValueappoval. 

 

I have two icons on the screen , When i click each of the Icons I want it to update the value in dataCardValue,

 

I have this in the onSelect for one of the icons: DataCardValueApproval.Text="0";

 

The idea is to let the user click the icon rather than needing to type in the "0", and have it save back to sharepoint when the  user saves from the edit screen.

 

Wit the code above, when the user clicks the icon nothing happens. The text in DataCardValueApproval remains unchantged.

 

Any Ideas?

Categories:
  • Verified answer
    tianaranjo Profile Picture
    497 on at

    Set your icon to a context variable - Icon - OnSelect - UpdateContext({IconChecked: true})

    Set your data card Default text - If(IconChecked, "0", Parent.Default)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    you can achieve this also by setting new variable by clicking on the icon and then set set the value of variable to the value attribute of the datacard.

     

    So first of all go to the settings of the Icon to the attribute OnSelect and write this code. (Var = variable name)

    Set(Var,Var+1)

    Then go to the DataCardValueXY and find the attribute Default

     

    Default=Var

     

    So after you do this the default value of DataCardValueXY will be Var+1 each time you press the Icon. So you have to limit it by customizing the code a bit.

    Set(Var,If(Var="1",Var-1,Var+1))

     

    That works as I expereinced it.

     

    The other thing is, that the default value could be faulty as it doesnt update properly each time from my experience. So in this case you would need to use another action to update the DataCardValueXY.

     

    Something like OnSelect property of icon

    Set(Var,If(Var="1",Var-1,Var+1));DataCardValueXY.Text=Var

    but i have never tested this scenario so no promises of functionality 🙂

     

     

    Hope it helps.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard