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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue with IF statemen...
Power Apps
Answered

Issue with IF statement (If False Then Write)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

I have a question regarding a vlookup in powerapps.
My Lookup is simple, if a certain field has a certain value, a Lookup is active, if not, I'd like the datacard to be editable.

So far this is how my "Text" Value looks like for the Label : 

 

 

 

If(
DataCardValue271_1.Selected.Value = "ABCDEFG";
LookUp(
Table1;
Column1 = TextInput2.Text;
Column2
);
DisplayMode.Edit
)

 

 

 

For me the issue is where there is written "DisplayMode.Edit", do you have any idea how I can make the field editable if the result of the IF is false 😀

Thank you and have a good week ! 

EDIT : 
It looks like you can't edit a Label, silly from me, 
However, now that I changed from Label to Text Entry I can modify the text, however do you know if I can lock the Text Entry if the IF is true (while performing lookup at the same time)  ?

Categories:
I have the same question (0)
  • Verified answer
    RusselThomas Profile Picture
    4,014 on at

    Hi @Anonymous ,

    The only place you can use a DisplayMode constant is in the DisplayMode: property of a control - so you can split the above formula into two expressions with the same logic but different outputs - one for text, one for displaymode - and place each logic piece in its corresponding property.

     

    That said, Labels are never 'editable' - they are just labels - so if you want the value to be view-only on one condition and editable in another, then you may want to use a TextInput control instead and use its Default: and DisplayMode: properties for the corresponding text and displaymode logic.

     

    It's not clear whether the control you want to be editable is inside or outside the form, but just bear in mind any controls you place inside the card should inherit their DisplayMode from the card by default, so you can adjust the card DisplayMode property instead of the control itself and it will inherit - just remember this will make anything else inside the card with a Parent.DisplayMode setting also go into edit mode when you adjust the card value - if this is not what you want, just use the DisplayMode: property on the actual input control itself.

     

    Text logic; to go onto Default: for a Text Input, or Text: for a label - just bear in mind you can't edit a label;

     

    If(DataCardValue271_1.Selected.Value = "ABCDEFG";
     LookUp(Table1; Column1 = TextInput2.Text; Column2)
    )

     

    Display Mode logic; to go onto the DisplayMode: property of either the card or the specific control;

     

    If(DataCardValue271_1.Selected.Value = "ABCDEFG";
     DisplayMode.View;
     DisplayMode.Edit
    )

     

    Hope this helps,

    RT

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes your reply answers perfectly the topic. 

    I changed it to text and set display mode as you said, thank you and have a good day, thank your for the quick answer !

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard