cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WAstarita
Level: Powered On

OnSelect not firing on certain screen

I have a screen where no OnSelect events will fire, though the Powerapps studio, web or mobile.  

 

It is a simple statement CalMonthCurrentDate.Text = "1", Originally it was CalMonthCurrentDate.Text = Text(DateValue(StartDate)+6, ShortDate).  I shorted it to eliminate variables.

 

I've wired many different controls with this statement and none of them work.  If I put a Navigate instead, that works fine. 

 

Any suggestions?  Is there any advanced way to debug these?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff rgruian
Power Apps Staff

Re: OnSelect not firing on certain screen

 

I am trying to understand what you are hoping to do in that OnSelect property. You mentioned a "statement" "CalMonthCurentDate.Text = 1 " -- are you trying to force a value into a property of a control, imperatively? (i.e. "set" the property?)

 

If that is what you are trying to do, PowerApps does not work that way. The "=" operator is an equality operator, not an assignment operator. Unlike imperative languages like JS, C++, Java, C#, etc. where you tell objects what to do, PowerApps's expression language is a declarative dataflow language, in which you declare what data flows into each property, and how it needs to be transformed on its way into the property. This is very similar to how Excel formulas work: you declare how each cell's value needs to be computed; and the dataflow engine does the rest of the work, iteratively flowing data where it needs to go, and evaluating all affected formulas to a steady state.

 

If the goal is to set the Text property of CalMonthCurrentDate to "1", you will need to declare that value ("1") as the default value flowing into the control. For example for a Textbox control, bind its Text property to "1". For a TextInput control, bind its Default property to "1". If you are dealing with a stateful control, such as a TextInput control, and you want to "reset it" to some value such as "1" from an OnSelect property of another control, you need to pulse the Default property from that formula:

 

    TextInput1.Default = DefaultValue

    Button123.OnSelect = UpdateContext({DefaultValue: ""}); UpdateContext({DefaultValue: "1"})

 

Please see the formula reference for more information.

https://powerapps.microsoft.com/en-us/tutorials/formula-reference/

 

I hope this helps.

 

 

 

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

3 REPLIES 3
Highlighted
mr-dang
Level 10

Re: OnSelect not firing on certain screen

Perhaps it is that DateValue only works on Text. You can try reversing the order that you have it:

DateValue(Text(StartDate,"mm/dd/yyyy"))
Microsoft Employee
@8bitclassroom
Power Apps Staff rgruian
Power Apps Staff

Re: OnSelect not firing on certain screen

 

I am trying to understand what you are hoping to do in that OnSelect property. You mentioned a "statement" "CalMonthCurentDate.Text = 1 " -- are you trying to force a value into a property of a control, imperatively? (i.e. "set" the property?)

 

If that is what you are trying to do, PowerApps does not work that way. The "=" operator is an equality operator, not an assignment operator. Unlike imperative languages like JS, C++, Java, C#, etc. where you tell objects what to do, PowerApps's expression language is a declarative dataflow language, in which you declare what data flows into each property, and how it needs to be transformed on its way into the property. This is very similar to how Excel formulas work: you declare how each cell's value needs to be computed; and the dataflow engine does the rest of the work, iteratively flowing data where it needs to go, and evaluating all affected formulas to a steady state.

 

If the goal is to set the Text property of CalMonthCurrentDate to "1", you will need to declare that value ("1") as the default value flowing into the control. For example for a Textbox control, bind its Text property to "1". For a TextInput control, bind its Default property to "1". If you are dealing with a stateful control, such as a TextInput control, and you want to "reset it" to some value such as "1" from an OnSelect property of another control, you need to pulse the Default property from that formula:

 

    TextInput1.Default = DefaultValue

    Button123.OnSelect = UpdateContext({DefaultValue: ""}); UpdateContext({DefaultValue: "1"})

 

Please see the formula reference for more information.

https://powerapps.microsoft.com/en-us/tutorials/formula-reference/

 

I hope this helps.

 

 

 

Radu Gruian [MSFT] ** PowerApps Staff

View solution in original post

WAstarita
Level: Powered On

Re: OnSelect not firing on certain screen

I did not realize that, with your suggestion it now works perfectly.

 

Thanks

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,780)