web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerApps IF function
Power Apps
Answered

PowerApps IF function

(0) ShareShare
ReportReport
Posted on by 155

Is there a way to put the result of a if function into another variable?

Categories:
I have the same question (0)
  • tbrantley Profile Picture
    155 on at

    If select all is equal to "Yes" then IPreview3.PNG'm wanting to change the value of "Air Compressor" to "Yes".

  • m_takatsuka Profile Picture
    33 on at

    Hi

    Set the following on the On change event of Select All.
      Updatecontext ({resetswitch: true})
    ... ture is a constant rather than a string.
    ... resetswitch is an example as it is a variable name.

    Enter air compressor's defalt property as yes.
    Enter the reset property of the Air Compressor as resetswitch.

    When the value of select All is changed, the variable resetswitch becomes true in the on change event.
    The value of Air Compressor is reset when the variable resetswitch becomes true and it becomes the default value.

    Even when controlling with IF, I think that it will be a way to put variables in Updatecontext.

    I hope it will work

  • tbrantley Profile Picture
    155 on at

    I'm not having any luck getting that to work. I could be doing something wrong.

     

    Preview1.PNGPreview2.PNG

  • m_takatsuka Profile Picture
    33 on at

     

    Hello

    I will tell you because I actually made an example with powerapps.
    Please fix the properties of the two controls as follows.

    Control Select All (pre-trip)
    Onchange:
    If (
    Radio1.Selected.Value = "yes", UpdateContext ({resetswitch: true}), UpdateContext ({resetswitch: false}))

    --- Replace Radio 1 after the following IF statement with the name of Select-All control ---

     

    Items:
    ["Yes", "no"]

    Control PRE-AirCompressor
    Default:
    "Yes"

    Items:
    ["Yes", "no"]

    Reset:
    Resetswitch

    In my Powerapps as above, if you select Select All to be Yes, PreAircompressor will automatically become Yes.
    Please let me know once again if it does not work.

     

    Looking at the example of the screen, perhaps I think that if you reset the reset property of PRE - AirCompressor control to false to resetswitch it will work.

     

    I hope that your work will work.

     

  • tbrantley Profile Picture
    155 on at

    I got your example to work!

     

    How come when I set the default value of air compressor to "No" it doesn't work?

     

    Thanks so much for your help!

  • Verified answer
    m_takatsuka Profile Picture
    33 on at

    You are welcome!
    I wish I could have served you.

    The behavior when default of Air compressor is set to NO is as follows.
    · When Select All is set to YES, Air compressor becomes NO in conjunction with this.

    The IF statement that matched the original question would be useful for doing this control.
    You can control the default and reset properties of Air compressor with IF statement.

    For example, let's look at the OnChange property of the Select All control;
    If (SelectAll.Selected.Value = "yes", UpdateContext ({resetswitch: true}), UpdateContext ({resetswitch: false}))

    This is followed by the default property of the Air Compressor control;
    If (resetswitch = true, "yes", "no")
    (The reset property remains as resetswitch)

    In the above case, the value of Air compressor is the same as the value of Select All radio button.
    If you combine resetswitch variable with other variables, you think that you can change the value of the radio button more flexibly.

     

    Does this answer you?

     

  • tbrantley Profile Picture
    155 on at

    Yes! Thanks for explaining!

     

    I'm new to powerapps, only been using for two or three days now!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard