web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Display Mode with If Statement

(0) ShareShare
ReportReport
Posted on by 55

Hello,

I have a text input that I want to be editable in some conditions and only viewable under other conditions, based on a value in a Sharepoint list. The display mode for the text input is set to:

If(var[redacted].OpenOrClosed="Closed",DisplayMode.View,DisplayMode.Edit)

When I go into the app, the app is still allowing me to edit even when the item is considered "closed" in sharepoint. I want to just have a box to have any inputted text (from when it is not considered "closed") displayed, but I do not want to be able to edit.

 

Any ideas?

I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Display Mode with If Statement

    Hi @dsopshin,

    Could you please tell me that how you fire this variable?

     

    Generally, the issue you encountered is that Power Apps could not capture the OpenOrClosed of a special record when you go into the app, so you need to validate the OpenOrClosed of this special record.

     

     

  • dsopshin Profile Picture
    55 on at
    Re: Display Mode with If Statement

    @v-qiaqi-msft 

    Thanks for the response! The variable is triggered using OnStart - it comes from the ID being included in a flow to a URL (from a PowerAutomate email). 

    This is what's in OnStart:

    If(
     !IsBlank(Param("ID")),
     Set(
     varItem,
     LookUp(
     '[sharepoint]',
     Title = Value(Param("ID"))
     )
     )
    );

     Everything else that uses this variable works correctly (pulling the correct data into the app using the ID).

  • v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Display Mode with If Statement

    Hi @dsopshin,

    Try to set the LookUp() formula to the DisplayMode property as below:

    If(
     !IsBlank(Param("ID")),
     LookUp(
     '[sharepoint]',
     Title = Value(Param("ID"))
     ).OpenOrClosed="Closed",
     DisplayMode.View,DisplayMode.Edit
    );
  • dsopshin Profile Picture
    55 on at
    Re: Display Mode with If Statement

    @v-qiaqi-msft 

    Thanks for the quick response! Unfortunately that is giving me an error. 

    The ; at the end errors to "Expected Operator. We expect an operator..." 

    If I remove the ; ,the entire thing gets an error. 

     

    It looks like (within the If Statement) the LookUp is a True Value, the DisplayMode.View is a Logical Test, and DisplayMode.Edit is another True Value. I tried adding an If(And( to keep everything as part of the logical test, but I got another error there. 

     

    Any other ideas? Thanks!

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at
    Re: Display Mode with If Statement

    Hi @dsopshin,

    Each region has different operators, so you need to post your formula and the error message.😃

     

    My mistake that the formula has something wrong, please modify as below:

    If(
     !IsBlank(Param("ID"))&&
     LookUp(
     '[sharepoint]',
     Title = Value(Param("ID"))
     ).OpenOrClosed="Closed",
     DisplayMode.View,DisplayMode.Edit
    )

     

    If there is still something wrror, do remember to show me your formula and the specific error message.

    Keep in touch.

  • dsopshin Profile Picture
    55 on at
    Re: Display Mode with If Statement

    This worked perfectly! Thank you so much for all of the assistance!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard