cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Parent.Default and Global Variables with a Button Counter

Hello,

 

I created a counter with buttons that either +/- a text input with the Set(GlobalVariable, GlobalVariable+1) on the button and in the Text Input default field I have GlobalVariable. Simple enough and works as expected. The problem is that this is a form that submits to a sharepoint list and when I navigate from the gallery portion of the app to the selected item (editform) it does not populate the list data of that item. 

 

tbush33_0-1601001972508.png

 

I tried changing the default value on the text input to: If(varMode="Edit", Parent.Default, GlobalVariable)

The varMode is a global variable used in a tutorial I found online that sets the onVisible property of the form to either NewForm or EditForm based on a button the user selects.

 

The problem with this method is that it does not allow me to edit the field with my counter buttons because it does not recognize the field as GlobalVariable anymore.

 

My question is, do any of you know a way to use a counter button to increase or decrease a number in a text input that can be edited later?

 

Thanks,

Travis

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Parent.Default and Global Variables with a Button Counter

I think I figured it out....I am not sure if it is the best method, but it is working in my situation.

 

I did not realize that the global variable did not need to be assigned to a control. After determining I would be able to just add the parent.Default to the global variable (parent.Default + GlobalVariable). It was that simple.

 

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Parent.Default and Global Variables with a Button Counter

Is the Textbox part of the form or independent. Also can you show the formula for the variable

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Highlighted
Frequent Visitor

Re: Parent.Default and Global Variables with a Button Counter

I would like it to be part of the form. It is in one of the data cards for the form. Here is the formula for the varMode Global Variable:

 

If(varMode="Edit",EditForm(Shift_Report),NewForm(Shift_Report))

 

Then I have a Create New button that has Set(varMode,"New")

 

and then the right arrow in the gallery to edit the item Set(varMode,"Edit")

 

Thanks!

Highlighted
Frequent Visitor

Re: Parent.Default and Global Variables with a Button Counter

I just tried using updateContext({Counter:Counter+1}), but I think that is just the same as using a Global Variable because it still makes me use the default property on the text input.

Highlighted
Frequent Visitor

Re: Parent.Default and Global Variables with a Button Counter

I think I figured it out....I am not sure if it is the best method, but it is working in my situation.

 

I did not realize that the global variable did not need to be assigned to a control. After determining I would be able to just add the parent.Default to the global variable (parent.Default + GlobalVariable). It was that simple.

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,598)