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 / How to correct the Enu...
Power Apps
Answered

How to correct the Enum error for Display mode

(0) ShareShare
ReportReport
Posted on by 2

I am trying to apply the below code on the Button DisplayMode, But getting error of Enum

 

If(And(CountRows(GalleryCartOrder.AllItems)>=1,Sum(GalleryCartOrder.AllItems, Value(LineTotalAmt.Text)) > 0),
DisplayMode=DisplayMode.Edit,
DisplayMode=DisplayMode.Disabled)

 

MIA27_0-1714228133675.png

 

Please advise what correction can be done to get the result as required. 

 

Categories:
  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Try removing the DisplayMode= from the two possible outcomes of the If. You are setting the value of the property because you are in the property. So you don't need to say what the values are applied to.

  • MIA27 Profile Picture
    2 on at

    It worked in the test screen.

    But when applied the actual screen, where I want if the 4 criteria matches then only Edit mode else disabled mode.

    The below does not bring error but all the time it remains in edit mode

     

    If(
    And(
    CountRows(GalleryCartOrder.AllItems)>=1,  //must have item in the gallery
    Sum(GalleryCartOrder.AllItems, Value(LineTotalAmt.Text)) > 0, //must have value as user should not select 0 qty
    !IsBlank(TextBox2_21), // this text box has important ref, so should not be blank
    !IsBlank(DatePicker1_7) //date field should not be blank
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
    )
     
    No error, but all time it remain in edit mode.
     
    Please guide
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Try removing all but one of the conditions and make sure that one will do both edit and disabled. Then add them back in one at a time. That should tell you which one is causing the problem.  Otherwise it al looks right to me.

  • MIA27 Profile Picture
    2 on at

    I test with only.

     

    If(
    !IsBlank(TextBox2_21),
    DisplayMode.Edit,
    DisplayMode.Disabled
    )
     
    Found the issue , if I manually remove !, then it work and put !, the effect on the screen shows.
    But the same when in actual I type and delete it has no effect on the displaymode.
    While means it does make the impact of IsBlank .
     
    can we use other option like empty or Len function to test
     
    pls. guide
     
  • Verified answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Instead of referencing the control you need to reference the value of the control.  Try the following instead

    If(
    !IsBlank(TextBox2_21.Text),
    DisplayMode.Edit,
    DisplayMode.Disabled
    )

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 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard