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

Help with If statement

Hi

I have the following on my DefaultMode of my form allowing me or MyReviewer to be able to edit this section and it works:

If(VarUser = MyReviewer || VarUser = "MyEmail", FormMode.Edit, FormMode.View)

I now need to change the defaultmode so if this reviewer has responded I want to set the form mode to view something like this:

If(IsBlank(VarRecord.PartGReview),FormMode.View, FormMode.Edit)

 Firstly I'm not sure how i combine both statements, but secondly I would like the ability to retain the ability to edit the form and make it view only for all other users.

 

Thank You 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Help with If statement

I think i missed that you want it to only be view mode for anyone who is not reviewer or yourself. In that case you would need:

 

If(VarUser = "MYEMAIL", FormMode.Edit, If(varUser = MyReviewer, If(!IsBlank(varRecord.PartGReview), FormMode.View, FormMode.Edit), FormMode.View))

 

View solution in original post

9 REPLIES 9
Highlighted
Super User III
Super User III

Re: Help with If statement

@Lefty 

Does this solution work?

If(VarUser = MyReviewer Or VarUser = "MyEmail" And !IsBlank(VarRecord.PartGReview), FormMode.Edit, FormMode.View)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Post Prodigy
Post Prodigy

Re: Help with If statement

HI @mdevaney 

I was just replying to my original post:

 

I think I have got it working, without me having edit rights, so just need help with that (I need edit even when the form mode is view for everyone ), unless anyone spots any flaws with this:

 

 

If(!IsBlank(VarRecord.PartGReview),FormMode.View, FormMode.Edit  Or 
If(VarUser = MyReviewer || VarUser = "MYEMAIL", FormMode.Edit, FormMode.View))

 

 

I tried this and doesn't work:

 

If(VarUser = "MYEMAIL", FormMode.Edit Or
If(!IsBlank(VarRecord.PartGReview),FormMode.View, FormMode.Edit  Or 
If(VarUser = MyReviewer || VarUser = "MYEMAIL", FormMode.Edit, FormMode.View)))

 

I'll give your suggestion a try now

 

Highlighted
Post Prodigy
Post Prodigy

Re: Help with If statement

HI @mdevaney 

 

Afraid this doesnt set the form to view only, my understanding of the statement is
if VarUser is me and that field is not blank, the form mode is edit, else its view?

 

maybe my 2nd post with the code i've half got working, explains better what I am trying to do, sometimes its difficult explaining things precisely.  

Highlighted
Post Prodigy
Post Prodigy

Re: Help with If statement

Hi @mdevaney 

 

Any further help will be appreciated 

Highlighted
Memorable Member
Memorable Member

Re: Help with If statement

Hi Lefty,

As i understand from the below Comments ,

Your Requirement is like below (Correct me if, I am wrong).
if LoggedIn user is equal to your mail ID and VarRecord.PartGReview is not blank then Form Mode should me Edit Mode, but if LoggedIn User = MyReviewer ID and VarRecord.PartGReview is not blank then Form Mode is View Mode else Form Mode id Edit Mode. 

 

below Formula help for this Condition that I mentioned above

If(VarUser = "MYEMAIL" && !IsBlank(VarRecord.PartGReview), FormMode.Edit ,
If(!IsBlank(VarRecord.PartGReview) && VarUser="MyReviewer",FormMode.View, FormMode.Edit)).


Please check and Mark as answer if this solution help you to resolve your issue

Highlighted
Post Prodigy
Post Prodigy

Re: Help with If statement

Hi @VijayTailor 

 

Thanks, I will use your understanding to explain this further:

 

If LoggedIn user is equal to your mail ID and VarRecord.PartGReview is not blank then Form Mode should me Edit Mode (basically i want the form mode to be edit for myself at all times),
but if LoggedIn User = MyReviewer ID and VarRecord.PartGReview is not blank then Form Mode is View Mode else Form Mode id Edit Mode.
If LoggedIn User = MyReviewer ID and VarRecord.PartGReview is blank then Form Mode is Edit Mode else Form Mode View

and for all other users it should be view anyways.

Highlighted
Super User III
Super User III

Re: Help with If statement

@Lefty 
Looks like I missed your follow-up posts on Friday @VijayTailor has taken over.  That's OK, I'll let him carry this forward.

Highlighted
Frequent Visitor

Re: Help with If statement

I think you are going to need some nested If statements.

The code you said was working besides always giving yourself FormMode.Edit:

If(VarUser = "MYEMAIL", FormMode.Edit Or
If(!IsBlank(VarRecord.PartGReview),FormMode.View, FormMode.Edit  Or 
If(VarUser = MyReviewer || VarUser = "MYEMAIL", FormMode.Edit, FormMode.View)))

 

How i think it can work.

If(VarUser = "MYEMAIL", FormMode.Edit, If(varUser = MyReviewer && !IsBlank(varRecord.PartGReview), FormMode.View, FormMode.Edit))

 

Let me dissect this to explain a little:

If(VarUser = "MyEmail", 
FormMode.Edit,True Value: if it IS you it will always be edit
If(varUser = MyReviewer && !IsBlank(varRecord.PartGReview),Else Value: if its not you, check if it is your reviewer AND the partGreview is not blank
FormMode.View,True value: if BOTH of these conditions are true
FormMode.Edit))Else Value: If either of these are NOT true 

 

Highlighted
Frequent Visitor

Re: Help with If statement

I think i missed that you want it to only be view mode for anyone who is not reviewer or yourself. In that case you would need:

 

If(VarUser = "MYEMAIL", FormMode.Edit, If(varUser = MyReviewer, If(!IsBlank(varRecord.PartGReview), FormMode.View, FormMode.Edit), FormMode.View))

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

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 (5,671)