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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to correct the Enu...
Power Apps
Unanswered

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:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,697 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
    68,697 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
    68,697 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

Forum hierarchy changes are complete!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard