cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NigelP
Kudo Kingpin
Kudo Kingpin

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 II
Dual Super User II

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 

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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (44,998)