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 / Update Data Card text ...
Power Apps
Unanswered

Update Data Card text field on select of button

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

@RandyHayes Hey Randy,  Any idea on this one  -

 

Hello:

I have a form with text input fields "Latitude" & "Longitude".  I am trying to have the user select a button that will populate these fields with their current lactation, Lat & Long.

 

Currently I have the default value of each field set to Location.Latitude & Location.Longitude which works, but I don't want it to populate these fields by default until the user clicks a button which will then update the DataCard text in the form fields.

 

Thanks in advance for your help!

 

Delucasmith - 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,563 Super User 2026 Season 1 on at

    Hi @Anonymous ,

     

    You then may want to use variables: varLat, varLong

     

    These can then be set as the default values for the datacards.

     

    By default, when starting the app, these will be blank. Pushing a button with the below code for the OnSelect property will give them the current values:

     

    Set(varLat,Location.Latitude); 
    Set(varLong, Location.Longitude);

     

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

    @Anonymous 

    Yes, since you already have the lat and log shown in your text input control in your form, then simply set the Reset property of your text input control to: yourSubmitButtonName.Pressed

    This will reset the coordinates when they press the submit button.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks! This works however, what can I do if there are already coordinates in the spl column which should remain by default?  So if coordinates (lat & Long) already exist in the SPL, then those will be displayed, and if user selects the button it will update.

  • BCBuizer Profile Picture
    22,563 Super User 2026 Season 1 on at

    Hi @Anonymous ,

     

    In that case you can use the Coalesce function in the Default property of the DataCardValue control to first check if there's a value in the data source before using the value in the variable. For example:

     

    Coalesce(Parent.Default, varLong)

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks guys.  these are helpful, but a need one more step.  When user selects dropdown and changes value to "Shipped", i need the Lat & Long data deleted on form submission.  Essentially, once the item is shipped, the Lat & Long data is no longer needed.

     

    Something like this I would imagine? - 

     

    If(DataCardValue22_2.Selected.Value = "Shipped", ...

     

    Then I would like to delete the data in the Lat & Long fields in the SPL.

     

    Also, this formula below works, but when I select the button when there is data already in the SPL, it sets it to the default data - how can i get it to reset to current location and change the data on form submit?  

    Coalesce(Parent.Default, varLong)

     

    Thanks again!

  • BCBuizer Profile Picture
    22,563 Super User 2026 Season 1 on at

    Hi @Anonymous ,

     

    You can apply the same logic to the default property:

     

    If(
     DataCardValue22_2.Selected.Value = "Shipped", 
     "",
     Coalesce(Parent.Default, varLong)
    )

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard