cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akharns
Level 8

basic event processing

Sorry for asking an incredible simple question (I think).  Not sure why this baffles me.

 

I have tried to test event-driven logic as follows, and I have not gotten it to work.

 

1. Create input text box Input_Text

2. Create input text box Output_Text

3. Create button Push.  

4. For Push Button, on select, output_text.text=input_text.text

 

What's wrong with this?  

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: basic event processing

yes, that's the only way I've ever gotten these kinds of changes to work for me.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
8 REPLIES 8
shailendra74
Level 10

Re: basic event processing

Hi @akharns 

 

Couple of ways to do this:

 

#1

 

  1. onSelect of button write the code - UpdateContext({INPUTTEXT: Input_Text.Text})
  2. set default property of Output_Text to INPUTTEXT

 

#2

 

  1. set the default property of output_text to Input_Text.Text

 

Thanks.

Super User
Super User

Re: basic event processing

What's wrong is that PowerApps is at its heart a declarative system not a procedural language.  So you can't have an event like a button press change a property of another object like a Text box directly.  The way to do this in Powerapps is to set the default text for output = to a variable value and then set the variable value equal to the other textbox when you press the button. That way none of the object properties on the screen are driectly altered by the actions of another object.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
akharns
Level 8

Re: basic event processing

I was really doing this only to debug the event firing feature.  I want to change attributes of Galleries and Forms (visible & size) based on actions taken in other controls (combo boxes or galleries).  I thought my little experiment would verify the functioning of these events, so I could troubleshoot the actions that were to be tied to them.



I think I hear you say that I need to create variables to control these cross-control actions.

Super User
Super User

Re: basic event processing

For most of them yes.  I don't think I've found any properties that can be modified directly at runtime.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
akharns
Level 8

Re: basic event processing

This discussion seems to conflict with the following :



Understand canvas-app variables in PowerApps

If you've used another programming tool, such as Visual Basic or JavaScript, you may be asking: Where are the variables? PowerApps is a little different and requires a different approach. Instead of reaching for a variable when you build a canvas app, ask yourself: What would I do in Excel?

In other tools, you may have explicitly performed a calculation and stored the result in a variable. However, PowerApps and Excel both automatically recalculate formulas as the input data changes, so you usually don't need to create and update variables. By taking this approach whenever possible, you can more easily create, understand, and maintain your app.

Super User
Super User

Re: basic event processing

That post is true as far as it goes.  Variables are much less prevalent in PowerApps.  But the anology breaks down because Excel doesn't have objects with properties like PowerApps. In terms of formulas and calculations its true.  Values don't have to be stored in Variables.  They can be embedded right into the function.  The problem is this makes a lot of the functions almost unreadably long, so I often still use variables to summarize values for readability. But in this case its esssential, because that's the only way to actually get these properties to change at runtime.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
akharns
Level 8

Re: basic event processing

I have it working now.  Here is my solution:

1.  Text box TestDisplay, property Text: TestString  -  This reads the context variable TestString

2.  Text box TestInput, event On Change: UpdateContext({TestString:TestInput})  -  This updates the context variable TestString





I'll wait for final feedback before closing this.  Thanks, everybody, for your help.

Super User
Super User

Re: basic event processing

yes, that's the only way I've ever gotten these kinds of changes to work for me.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 529 members 6,050 guests
Please welcome our newest community members: