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:
  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard