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 / Covert miles to feet d...
Power Apps
Answered

Covert miles to feet dynamically between 2 textboxes and avoid circular reference

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to create a "live" conversion between two text fields so that the user can enter either feet or miles and the conversion between the textboxes will happen depending on whichever measure they are filling out.

 

The logic:

I added a datacard with 2 textboxes.

TextBox1 (miles) Loads the Parent.Default (I'm only storing the miles in the database).

TextBox2 (feet) converts whatever is in TextBox1 (miles):

 

(If(!IsBlank(TextBox1.Text),TextBox1.Text*5280))

 

 

How do I also make the reverse happen without hitting a circular reference?

Categories:
  • SBax Profile Picture
    1,348 on at

    I've achieved similar before with miles and kilometres.

     

    I couldn't figure out how to avoid the circular issue either so ended up with a toggle to lock one field, if it's "on" and the other if it's "off" then used a formula to look at the toggles value and did the conversion based on that

  • Verified answer
    rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @Anonymous 

     

    you could do the following:

    In both the text boxes set the OnChange to:

    textbox miles: UpdateContext({varFeet: Value(Self.Text) * 5280})

    textbox feet: UpdateContext({varMiles: Value(Self.Text) / 5280})

     

    Set there Defaults to

    textbox miles:  varFeet

    textbox feet: varMiles

     

    Result

    convert_it.gif

     

    Hope it helps,

    R

     

     

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks. I also added a variable that only switches to true OnChange of one of those textboxes and I reset it to false when loading the form. This allows me to load the miles to an existing form. i.e if(!conversion,Parent.Default,varMiles)

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard