cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NigelP
Super User
Super User

How Can I find out when a Text Field (Label) changes

Hi 

 

I have a menu component that returns the selected item when a user selects an item in the menu.  The selected Item is put into a Label field on the screen. Set(gTemptext, MenuComponent.Selected.Item), the in the Label Field Default is gTempText.

 

How can I find out when the item has been selected ( and hence the contents of the Label field has changed) so I can initiate another action dependant upon the menu tem selected ?

Thanks

 

Nigel

 

Label does not have an OnChange Event / property which fires when the text in the label changes.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @NigelP ,

Do you want to detect if the Label value has been changed within your app?

 

Based on the needs that you mentioned, I think the Timer control could achieve your needs. I have made a test o n my side, please take a try with the following workaround:

Add a Timer control within your app, set the Duration property to following:

1000

Set the AutoStart property and Repeat property to following:

true

Set the OnTimerEnd property of the Timer control to following:

If(
   OldValue = Label1.Text,
   Set(OldValue, Label1.Text),
  'Type your Refresh formula here';Set(OldValue, Label1.Text)            /* <-- OldValue variabe value <> Label1.Text, your Refresh formula would be executed */
)

Set the Visible property of the Timer to following:

false         /* <-- Hide your Timer control */

Please take a try with above alternative solution, check if it could help in your scenario.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
RezaDorrani
Dual Super User
Dual Super User

Hi @NigelP 

 

you would have to add that logic on the dependent action field

 

Example label will change based on selection made in component 

eg label - "red"    label - "blue"

 

and lets say you want to set color property for another field based on label changing

 

then on color porperty of other field use

 

If(Label = "red", Color.Red, If (Label= "blue", Color.Blue))

 

This is just an example

 

Regards,

Reza Dorrani

 

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

Hi @RezaDorrani 

 

Thanks for the reply.

 

In my use case when the label field changes, I want to trigger a refresh of a query which (re)populates a collection.

 

Regards

 

Nigel 

Anonymous
Not applicable

Hi there,

 

If you want to refresh a query which populates a collection, and you are using this label field property, it should be done automatically. So, whenever the set property changes the query should be updates as well.

v-xida-msft
Community Support
Community Support

Hi @NigelP ,

Do you want to detect if the Label value has been changed within your app?

 

Based on the needs that you mentioned, I think the Timer control could achieve your needs. I have made a test o n my side, please take a try with the following workaround:

Add a Timer control within your app, set the Duration property to following:

1000

Set the AutoStart property and Repeat property to following:

true

Set the OnTimerEnd property of the Timer control to following:

If(
   OldValue = Label1.Text,
   Set(OldValue, Label1.Text),
  'Type your Refresh formula here';Set(OldValue, Label1.Text)            /* <-- OldValue variabe value <> Label1.Text, your Refresh formula would be executed */
)

Set the Visible property of the Timer to following:

false         /* <-- Hide your Timer control */

Please take a try with above alternative solution, check if it could help in your scenario.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,833)