Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

How to correct the Enum error for Display mode

(0) ShareShare
ReportReport
Posted on by

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. 

 

  • Verified answer
    Pstork1 Profile Picture
    65,999 Most Valuable Professional on at
    Re: How to correct the Enum error for Display mode

    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
    )
  • MIA27 Profile Picture
    on at
    Re: How to correct the Enum error for Display mode

    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
     
  • Pstork1 Profile Picture
    65,999 Most Valuable Professional on at
    Re: How to correct the Enum error for Display mode

    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
    on at
    Re: How to correct the Enum error for Display mode

    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
  • Verified answer
    Pstork1 Profile Picture
    65,999 Most Valuable Professional on at
    Re: How to correct the Enum error for Display mode

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard