PL-100 · Question #158
You are developing a canvas app to monitor time. The app includes a Text Input control named TIC1 and a Timer control named TIM1. You need to set TIM1 to a default value. What should you do?
The correct answer is C. In the OnChange property of TIC1, set the value of the Text property for TIC1 to a context variable. To set a Timer control's default value based on a Text Input, a context variable should be used to store the Text Input's value, which the Timer can then reference.
Question
Options
- AWrite code in the OnChange property of TIC1 that assigns the value of the Duration property of the
- BIn the OnChange property of TIC1, set the value of the Text property for TIC1 to a context variable
- CIn the OnChange property of TIC1, set the value of the Text property for TIC1 to a context variable
- DAssign the Text property of TIC1 to the OnSelect property of a TIM1.
How the community answered
(28 responses)- A18% (5)
- B7% (2)
- C71% (20)
- D4% (1)
Why each option
To set a Timer control's default value based on a Text Input, a context variable should be used to store the Text Input's value, which the Timer can then reference.
This option incorrectly suggests assigning a Duration property (which typically belongs to a Timer or Media control) back to the OnChange of TIC1, which is not a valid way to set a timer's default value from text input.
This option is identical to option C. Given that C is the designated correct answer, any distinction for B is irrelevant due to the duplicate text.
In Power Apps, using a context variable within the OnChange property of TIC1 allows the entered text value to be stored and then referenced by other controls like TIM1. This enables dynamic updating of the TIM1's default property (e.g., Duration) based on user input, ensuring the timer reflects the specified value from TIC1.
Assigning TIC1.Text to TIM1.OnSelect would execute code when the timer is selected, not set its default value or duration, making it functionally incorrect for the stated goal.
Concept tested: Power Apps context variables and control property interaction
Source: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-variables
Topics
Community Discussion
No community discussion yet for this question.