cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lefty
Post Prodigy
Post Prodigy

Help with if statement

Hi

This is what I am trying to do, I have a submit button and on the DisplayMode property of the button I am trying to:

If the logged in user is Reviewer4, the button should be clickable (edit), else it should be disabled for all other users. I can get this to work.

But when Reviewer4 clicks the button to submit the form, I have another variable vWait, which needs to disable the button even for Reviewer4 , until it successfully submits or if it fails, I can't get the syntax correct to cater for 2 different if statements:

If(
VarUser = Reviewer4, DisplayMode.Edit, DisplayMode.Disabled);// semi colon or comma and it complains
If(vWait, DisplayMode.Disabled,DisplayMode.Edit)

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Lefty ,

Try this

If(
   VarUser = Reviewer4 && !vWait
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@WarrenBelz 

I've just had a thought,

if put the following on the Visible property of the button, then only this user will see the button:

VarUser = Reviewer4

Then on the DisplayMode of the button I can simply put:

 

vWait, DisplayMode.Disabled,DisplayMode.Edit

 

Your thoughts?

View solution in original post

12 REPLIES 12
Paulo_VS
Advocate I
Advocate I

Hi guy,

Where are you putting the code?

Do you has a printscreen?

@Paulo_VS 

 

The code as mentioned is being set on the DisplayMode of the submit button

 

I'm sure I've got the syntax wrong, and just needs tinkering

@Lefty


Where is the user profile defined? 

 

User profile? I think you have misunderstood my question, there is no requirement for user profile.

Paulo_VS
Advocate I
Advocate I

So what would Reviewer4 be, how does a user that Reviewer4 characterizes, what field does this validation take?

Lefty - ["If the logged in user is Reviewer4...."]

@Paulo_VS 

Reviewer4 is a person field from its datasource (SPO list)

Reviewer4 is entered by an approver in the previous section, and the Reviewer4 receives an email - All of this works

 

The button I have enabled for Only Reviewer4 to click, for everyone else is it disabled - This also works.

 

Now I need to add a further logic, when Reviewer4 clicks the submit button the button needs to be disabled for them also, while the submission of the form is taking place, this is via the vWait variable, but I cannot get the syntax correct for both statements

Hi @Lefty ,

Try this

If(
   VarUser = Reviewer4 && !vWait
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

HI @WarrenBelz 

 

I tried something like that, but correct me if I'm wrong in my understanding:

If(
   VarUser = Reviewer4 && !vWait // This is saying, if Reviewer4 and vWait is true, the displaymode will be edit? If yes, That's not quiet what I want.... I'll continue outside of this....
   DisplayMode.Edit, 
   DisplayMode.Disabled
)

 .... if VarUser is Reviewer4 the button needs to be clickable, but once the user (Reviewer4) clicks the button, I need the button to be disabled for Reviewer4 as also, to prevent them from clicking the button several times.

Hi @Lefty ,

I am guessing a bit here, but if you set vWait to true when Reviewer4 clicked the button, it would disable it. Would that affect anything else in your logic?

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

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

Top Solution Authors
Top Kudoed Authors
Users online (85,025)