cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Track if button was pressed.

I'm kinda stumped on what I am trying to build. I have a screen that pops up based on logic of if certain or so many questions were answered "yes." But I also have a button where someone can manually bring up the screen, if they feel it is necessary. I want to track if that screen was brought up and submit it with a yes or no value to a text column in SharePoint. Now, I have it working for the logic, but I'm stumped on how to track it the button was pressed on not. I thought about an OnVisible to do an UpdateContext for a variable, but then it can't reset after each submission. And if I do an OnVisible to set it false, then if someone navigates backwards into the app and then comes back to the OnVisible screen, it would set that value back to "No" even if they clicked the button. Anyone have ideas on what I could try? The issue is I need it to reset back to a "no" on submissions.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Track if button was pressed.

@ngreen 

From what I can tell you have 2 screens:

 

Screen1:  Always appears.  Holds the button to navigate to Screen2

Screen2:  Appears only when conditions are met on Screen1.

 

Write the following code in the OnStart property of your app.

 

Set(ShowScreen2,"No")

 

Then in the OnSelect property of the button on Screen1 write the following code

 

Set(ShowScreen2,"Yes");Navigate(Screen2,None)

 

The OnStart property will ensure your variable always intializes as "No".  We use a SET variable allows you to store a value globally.  That means the value remains stored even as the user progresses to other screens.  In this case it is an ideal alternative to UPDATECONTEXT for the reasons you have already mentioned.

 

Then later on you can submit the ShowScreen2 variable to the proper column whne the user submits the form.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

 

View solution in original post

5 REPLIES 5
Highlighted
Resident Rockstar
Resident Rockstar

Re: Track if button was pressed.

Hi @ngreen,

I suggest that in the OnSelect event of your button you set a variable (let's call it gloButtonPuhsed) to true.

Then, right after submitting your data to SharePoint, reset your variable gloButtonPushed to false.

Would that work for you ? Or maybe I didn't catch up what you're trying to do...

Emmanuel

Super User
Super User

Re: Track if button was pressed.

@ngreen 

From what I can tell you have 2 screens:

 

Screen1:  Always appears.  Holds the button to navigate to Screen2

Screen2:  Appears only when conditions are met on Screen1.

 

Write the following code in the OnStart property of your app.

 

Set(ShowScreen2,"No")

 

Then in the OnSelect property of the button on Screen1 write the following code

 

Set(ShowScreen2,"Yes");Navigate(Screen2,None)

 

The OnStart property will ensure your variable always intializes as "No".  We use a SET variable allows you to store a value globally.  That means the value remains stored even as the user progresses to other screens.  In this case it is an ideal alternative to UPDATECONTEXT for the reasons you have already mentioned.

 

Then later on you can submit the ShowScreen2 variable to the proper column whne the user submits the form.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

 

View solution in original post

Highlighted
Helper III
Helper III

Re: Track if button was pressed.


@R3dKap wrote:

Hi @ngreen,

I suggest that in the OnSelect event of your button you set a variable (let's call it gloButtonPuhsed) to true.

Then, right after submitting your data to SharePoint, reset your variable gloButtonPushed to false.

Would that work for you ? Or maybe I didn't catch up what you're trying to do...

Emmanuel


How would you reset the variable outside of the screen though? UpdateContext doesn't work if you aren't on the page. Reset doesn't work with variables. My submit button is on a different screen.

Highlighted
Helper III
Helper III

Re: Track if button was pressed.

Awesome! Set is the function that I was missing. Thank you so much! I don't know why I forgot about it, but it works exactly as I need. Thanks again for helping me solve another one of my questions

Highlighted
Super User
Super User

Re: Track if button was pressed.

@ngreen 

No problem dude!  Always happy to help.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,805)