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

2 If Formula Statements - Not Working

Hello PowerApps Community,

 

By chance would someone be able to point me in the right direction with my challenge. I had a request come in that asked if I could restrict a button based on another button's action. For example, the users at my organization would determine if a review would be necessary on a project. Once they did that via a toggle switch control, that toggle switch would disable the submit form button and enable a notify creator button. That part of the formula statement is working beautifully.

 

However, I cannot get the "submit" button to become visible once the notify button is pressed. Any suggestions would be greatly appreciated. The following formula is in the DisplayMode property for the "Submit" button. 

 

 

If(Toggle1.Value = true, DisplayMode.Disabled, If(NotifyButton.Pressed, DisplayMode.Edit))

 

 

 

Button Function.JPG 

10 REPLIES 10
Highlighted
Resolver II
Resolver II

HI,

 

Not sure if I fully understand your case but maybe to change the status of the DisplayMode you should create a context variable when clicking on your "notify reviewer" button (eg: UpdateContext({SubmitVisVar:true}) ), so your new formula would be like:

 

If(Toggle1.Value = true, DisplayMode.Disabled, If(SubmitVisVar=true, DisplayMode.Edit))

You'd need to figure it out where else that variable needs to change to false to keep consistency.

 

That's an option...now if clicking on the "Notify reviewer" button finishes the task and you have to reset the form...I would reset the Toggle1 to false and only use that for the DisplayMode property.

 

Hope that helps  

Highlighted

My 20cents worth

 

I would do similar to above but change the visible to be based on the toggle button and removed the review button all together.

 

On the toggle I would set the onchange to be something like:

 

If(Toggle1.Value = true, UpdateContext({VarVis1,true}),UpdateContext({VarVis1,false}))

 

on the visible property to the button set it to be VarVis1

 

Now if the toggel is moved the button will appear or disappear based on it

 

Note on teh OnVisible to the form you alse need to put UpdateContext({VarVis1,true})

 

UpdateContext({VarVis1,false) to make the button invisible

Highlighted
Helper III
Helper III

Thank you both for the replies. I will try both out. I started thinking about using a variable as well so at least I feel better internally that 2 minds are thinking similar things, haha!

 

I tried to explain the challenges with this functionality to all users but they would like something like this. What makes it more challenging, is some projects will not require a review which is why the submit button has to stay. They would like to click on an action which allows them to fill in some detail and then force them to select the notify reviewer button and then once they perform that action the submit button enables allow them to pass the record update on to our database.

 

I'll try the options out and see if the result is acceptable. I will keep all posted. Thanks for your help!

-Tom

Highlighted


@leyburn19 wrote:

My 20cents worth

 

I would do similar to above but change the visible to be based on the toggle button and removed the review button all together.

 

On the toggle I would set the onchange to be something like:

 

If(Toggle1.Value = true, UpdateContext({VarVis1,true}),UpdateContext({VarVis1,false}))

 

on the visible property to the button set it to be VarVis1

 

Now if the toggel is moved the button will appear or disappear based on it

 

Note on teh OnVisible to the form you alse need to put UpdateContext({VarVis1,true})

 

UpdateContext({VarVis1,false) to make the button invisible


This can be simplified to:

 

UpdateContext({VarVis1:!VarVis1})

Using an exclamation before a Boolean variable in PowerApps flips the state for you making it incredibly simple to change a true false on another button.

 

Set Notify Reviewer to the line of code I pasted above.

 

Set the DisplayMode of the Submit button to:

 

If(VarVis1 = true, DisplayMode.Edit, DisplayMode.Disabled)
Highlighted

One tweak to what @JRaasumaa wrote:

 

If(VarVis1, DisplayMode.Edit, DisplayMode.Disabled)

 

VarVis1 evaluates to true or false so you don't have to check if it = true

 

I will also add a bonus. You don't have to put an If inside of an If. This more advanced syntax and hiding View problems are both covered in one video. 

PowerApps If Statement

 

Hope it helps

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted

@JRaasumaa,

 

Your proposal gets me about 50% there. Though the challenge is as follows:

 

  1. If user determines no review is required, then they do not move toggle and submit button stays visible and no notify button displays (I have this part working).
  2. If user determines review is necessary, the user will select the toggle to engage a text field for email (text field become editable).
  3. Once the toggle is switched on, the notify button becomes active (appears) and the submit button becomes disabled.
  4. User will select notify button which launches an email flow and once the notify button is pressed the submit button now becomes usable (this is the part I cannot get working).
  5. If user decides review is not required, and flips switch, everything goes back to normal as stated in #1.

** I cannot remove the submit button all together, it has to stay as part of the app functionality. The users in my org want it there so they can first notify the reviewer then update the project details via the submit button.

 

@JRaasumaa, your solution has got me the closest to acceptable functionality and I appreciate everyone's feedback. If anybody has any additional formula modifications I would be more than happy to try to reach the goal.

 

I will revisit this formula tomorrow for more in depth testing.

 

Thanks all,

-Tom

Highlighted

@Shanescows,

 

Ahh! I feel star struck, haha! I've learned alot from your videos in the past Shane, how cool of you to respond to my post out of the tons out there, lol!

 

Alright, regathering myself. I sat myself down yesterday and watched your video. I changed a few things based on the tips and tricks you talked about but as I stated in JRaasumaa's reply, I'm still not there.

 

I'll post some scree shots and formula statments later today for feedback.

 

Thanks so much for your post Shane, made my day!

-Tom

Highlighted

Glad my videos are helpful. 🙂 Hopefully I can be helpful here also. 

 

In item #4 above. Why not have the OnSelect for the Notify Button launch your flow then set a variable and then enable the button. 

 

YourFlow.Run(stuff you passed); UpdateContext({VarVis1:!VarVis1})

 

Or something close to that. 

 

Did you see my video on PowerApps Flow Tutorial? In the video, I do things differently but make my button at the end visible only after my Flow has done its magic.

 

 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Highlighted
Helper III
Helper III

@thomasgarcia83

 

maybe i'm missing something, but why not just have the submit button run the notify formula/flow plus update the record if the toggle is enabled, and only update the record if the toggle is disabled? are your users insisting that there be two separate buttons?

 

example:

SubmitButton.OnSelect: If(Toggle1.Value=true, [notify formula];[record update formula], [record update formula])

or

SubmitButton.OnSelect: If(Toggle1.Value=true, [notify formula]);
[record update formula]

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,344)