cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Variables Assignment Issue

I have a strange and specific issue that is making the value of my variable 0 no matter what number is written in the text box it is coming from. There are a few layers to this and I will explain below, any help is appreciated.

 

In the OnStart property of the App, I have a variable declared as this:

Set(varIncrement, Value(Last(DowntimeDB).Title))

 

This variable is then assigned to the text input "txtNumber_3" as Value(varIncrement).

 

Upon clicking a button, varIncrement increases by 1 value using this code:

Set(varIncrement, varIncrement + 1)

 

The problem begins here. I am trying to create a new variable from the value inside txtNumber_3 for another screen, the code is:

Set(varExtraIncrement, txtNumber_3.Text)

 

When I try to assign this new variable to a new text input, the value is always 0 no matter what. Am I doing something wrong throughout this whole process of variable overriding? Again, any help would be appreciated as I'm stuck!

 

Thanks. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Variables Assignment Issue

That shouldn't be an issue unless you are trying to increment it at the same time you are setting varExtraIncrement.  As I said, I'm not able to reproduce your issue.  It works fine in my setup so I'm not sure how to help.



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

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Variables Assignment Issue

Where are you doing the create for your second variable?  I just did a mockup of your issue and it works fine for me if I set the variable as I navigate to the next screen like this

Set(varExtraIncrement, TextInput1.Text);Navigate(Screen1,ScreenTransition.Fade)


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

Re: Variables Assignment Issue

@Pstork1 thanks for the response. In the first screen before proceeding to the next screen, I have a Proceed button. Here in the Proceed button, I am declaring the new variable varExtraIncrement, just as you have shown in your response.

I then put Value(varExtraIncrement) in the text input on the next screen, the value always being 0.

 

I'm still unsure why this is happening. 

Super User
Super User

Re: Variables Assignment Issue

AS you can see from my code I'm doing the same thing and it works on my setup.  Is that the only Set you have for VarExtraIncrement?  Or could it be being reset by some other action?



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

Re: Variables Assignment Issue

No, varExtraIncrement is being set only once in the Proceed button. I am sure it is not being reset anywhere as the code I have shown in the initial question are the only places varIncrement and varExtraIncrement are declared and manipulated in the app.

 

Could it be something to do with varIncrement being overwritten to increment the variable by one? Or is that not the issue? 

Super User
Super User

Re: Variables Assignment Issue

That shouldn't be an issue unless you are trying to increment it at the same time you are setting varExtraIncrement.  As I said, I'm not able to reproduce your issue.  It works fine in my setup so I'm not sure how to help.



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

View solution in original post

Anonymous
Not applicable

Re: Variables Assignment Issue

This actually seems to be the issue. The Proceed button contains the code for both incrementing varIncrement and setting varExtraIncrement. I will experiment with this now and see if I can resolve it. Thank you for your help. 

Anonymous
Not applicable

Re: Variables Assignment Issue

This worked well. I placed the code for declaring varExtraIncrement elsewhere and it worked. Thank you for your help!

Helpful resources

Announcements
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

Top Kudoed Authors
Users Online
Currently online: 94 members 3,425 guests
Please welcome our newest community members: