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
Solved! Go to Solution.
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.
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"))
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.
I did not realize that, with your suggestion it now works perfectly.
Thanks
User | Count |
---|---|
180 | |
119 | |
87 | |
44 | |
41 |
User | Count |
---|---|
246 | |
156 | |
127 | |
77 | |
73 |