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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,637)