cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dorinda
Impactful Individual
Impactful Individual

Complicated conditions to disable Text Input Field

@RandyHayes @mdevaney ,

I have formulas like this one

If(

    If(

        Value(label_year.Text) < Value(CurrentYear.Text),

        false,

        Value(CurrentMonth.Text) <= ThisItem.Month Or Value(label_year.Text) > Value(CurrentYear.Text)

    ),

    DisplayMode.Disabled,

    DisplayMode.Edit

)

 

Basically if the current year and current month are in the past they should be set to Disabled, otherwise they should be set to Edit.  As you can see 2019 and 2020 in blue both are editable.

id.jpg

The other issue with this is now in 2022 or any later year that fields that should be open to enter information is greyed out and the open ones in blue when you type anything immediately grey out even if you are not finished.  This is what is in that Original field If(IsBlank(TextInput2_6), DisplayMode.Edit, DisplayMode.Disabled)

 

id2.jpg

 I am stumped why this is not working

 

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Dorinda 

The formula that seemed to do the trick was:

If((IsBlank(ThisItem.RevForeCast) && (Date(ThisItem.Year, ThisItem.Month, 1) > Date(Year(Now()), Month(Now()), 1))) || 
    (Date(ThisItem.Year, ThisItem.Month, 1) = Date(Year(Now()), Month(Now()), 1)), Edit, Disabled)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
gabibalaban
Dual Super User
Dual Super User

Hi @Dorinda ,

 

Try a different approach to avoid the "complicated condition". 😊. What about ...

 

 

If(
Value(label_year.Text)*12+ThisItem.Month < Value(CurrentYear.Text)*12+Value(CurrentMonth.Text),
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

 

 

Hope it helps !

WarrenBelz
Super User
Super User

@Dorinda ,

This should work

If(
   Value(label_year.Text) > Value(CurrentYear.Text) ||
   (
      Value(CurrentMonth.Text)>= ThisItem.Month &&
      Value(label_year.Text) = Value(CurrentYear.Text)
   ),
   DisplayMode.Edit,
   DisplayMode.Disabled
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

RandyHayes
Super User
Super User

@Dorinda 

The formula that seemed to do the trick was:

If((IsBlank(ThisItem.RevForeCast) && (Date(ThisItem.Year, ThisItem.Month, 1) > Date(Year(Now()), Month(Now()), 1))) || 
    (Date(ThisItem.Year, ThisItem.Month, 1) = Date(Year(Now()), Month(Now()), 1)), Edit, Disabled)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,220)