cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Divya_R
Frequent Visitor

How to execute "Run OnStart" step while variable value changes

Hi Team,

 

I have created a boolean global variable on start of app and updating the value of that variable with a textbox on another screen.

 

However, when I change the value, it needs a trigger of "Run OnStart" to update the variable value.

 

There's an admin who have access to that screen and can update the value and that value should remain intact inside the app for others.

 

variable on start of app

Set(
    isEnabled,
    TextBox2.Value
);

 

Is there any alternative way to fix this? Can I refresh the app with Refresh() function? 

 

Really appreciate any help with this!

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Divya_R ,

 

There is no way to execute OnStart during App running, unless you close and open the App again.

 

The point is, OnStart is one of all those On... properties that could use to append behavior formulas in Canvas Apps. Any formulas that in OnStart could also use in the other properties like OnSelect/OnChange/OnVisible/On... to execute again, only need to copy and paste. On... properties means when... to execute something, no doubt that you could use the same formulas in different places to do a same thing.

 

Below is the doc about behavior formulas for reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-formulas-in-depth

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

View solution in original post

10 REPLIES 10
RandyHayes
Super User
Super User

@Divya_R 

I am not sure what the purpose of your formula is in this case.  You are referencing a .Value property of a textbox...that control doesn't have such a property!

 

Can you expand on that?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes,

 

Thanks for your quick response. 

 

I don't see .Text property of textbox and there's only .Value

Divya_R_0-1634764931059.png

 

 

 

 

RandyHayes
Super User
Super User

@Divya_R 

Then it is not a text input control.  Instead of looking on that side of the screen, look at the property pane on the right side and send a screenshot of that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes ,

 

PFB,

 

Divya_R_0-1634765293437.png

 

RandyHayes
Super User
Super User

@Divya_R 

Ah, you're not in a canvas app, you're in Teams!

 

So, your initial formula seems to indicate that your isEnabled variable would be a true or false value, but apparently you are setting it to what ever text is typed into that textinput control.

 

If all of that is the case, then just set the OnChange action of the Textinput control to:

Set(
    isEnabled, Self.Value
);

This will update your variable.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Divya_R
Frequent Visitor

Hi @RandyHayes,

 

I tried, but seems there's an incompatibility issue. 

 

TextBox - OnChange 

 

Set(
      isEnabled, Self.Value
);

 

and on start of app

Set(
    isEnable, Texttbox.Value
)

 

Divya_R_0-1634765959414.png

 

However, I got it working with Toggle and directly using Toggle.Checked in on start of app.

 

Set(
   isEnable, Toggle.Checked
);
RandyHayes
Super User
Super User

@Divya_R 

Well, that was where I was heading - you originally said it was a boolean variable, but you were setting it to the text of the text input control - not a boolean value.

If you use a toggle, that will be boolean.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @RandyHayes,

 

I get it. Thanks so much 🙂 

 

But is there any way to refresh the app which triggers "Run OnStart" job? so as soon as I update the variable it refreshes the value on start of app?

Hi @Divya_R ,

 

There is no way to execute OnStart during App running, unless you close and open the App again.

 

The point is, OnStart is one of all those On... properties that could use to append behavior formulas in Canvas Apps. Any formulas that in OnStart could also use in the other properties like OnSelect/OnChange/OnVisible/On... to execute again, only need to copy and paste. On... properties means when... to execute something, no doubt that you could use the same formulas in different places to do a same thing.

 

Below is the doc about behavior formulas for reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-formulas-in-depth

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,094)