Hello,
Currently, I am unable to apply the "if" condition to disable and edit the text box based on the entry date in PowerApp.
Below is my scenario:-
Data in PowerApp screen
Forecasting date:- mm/dd/yyyy
1st Week:-
2nd Week:-
3rd Week:-
4th Week:-
Condition:- the displaymode for 1st Week data box should work as--- if the forecasting date is less than 7 then the 1st Week data box can be edited, in case the date is greater than 7 then the 1st Week data box should be disabled.
Similarly, for 2nd, 3rd and 4th Week data box the displaymode should work as 15,23 and 31 respectively in place of 7.
Note:- Forecasting date (DataCardValue21) and 1st Week (DataCardValue17)
Please find the snapshot and let me know if someone needs any more explanations.
Help me with the solution.
Thank you.
Hello Daves,
The below input showed me an error. (Please refer the snapshot)
From 1st to 4th Week text box will have data in numericals and Forecasting date text box will be in date format. All the text box(1st to 4th Week) depend on Forecasting date value.
Note:- Forecasting date (DataCardValue14).
for my case the 1st week text box should be in edit mode from 1st to 7th day of the month, rest all days the 1st week text mode should be disabled.
ex:- from 1st to 7th March, the text box can be edited in displaymode and rest of the month in disable mode.
for 2nd Week text box should be in edit mode from 7th to 14th day of the month, rest all days the 2nd week text mode should be disabled.
for 3rd Week text box should be in edit mode from 15th to 21st day of the month, rest all days the 3rd week text mode should be disabled.
for 4th Week text box should be in edit mode from 22nd to 31st day of the month, rest all days the 4th week text mode should be disabled.
Let me know in case of any confusion or unclear part in my question.
Hi @Sumeesh
You can construct the dates with the Date function while adding 1 to the month value.
If( Today() >= Date(
Year(DateCardValue21.SelectedDate),
Month(DateCardValue21.SelectedDate) + 1,
1
)
&& Today() <= Date(
Year(DateCardValue21.SelectedDate),
Month(DateCardValue21.SelectedDate) + 1,
7
),
DisplayMode.Edit,
DisplayMode.View)
Let me know if you don't come right.
Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please like it and mark this as the answer to close the topic and make it easier to find for other people with similar questions. AND we get points for it 😉
Thank a lot Daves. It helped me.
Can you help me with one more solution:-
Case:- the 1st Week data entry should be editable if the forecasting data will be between 1 to 7th date of the month. (for ex:- 1st Week data entry should be editable from 1st to 7th March and disabled for later dates)
Regards,
Sumesh
1) data box- mean the entry box
2) For example -
Case:- if i select the forecasting data as 2nd Feb 2020 then the 1st Week should be editable and if i select the forecasting data as 8th March 2020 then the 1st Week should be disabled.
1st Week should be editable from 1st to 7th of every Month and later days should be in disabled DisplayMode.
Hope this will clarify your doubts. Thank you
Hi @Sumeesh ,
The following should work if entered into the DisplayMode Property of the text input.
If(
DateCardValue21.SelectedDate < DateAdd(
Today(),
-7,
Days
),
DisplayMode.View,
DisplayMode.Edit
)
You can also use the DateDiff function instead of the DateAdd to determine how far past the date you have passed.
Let me know if you don't come right.
Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1
**If you found this reply helpful, please like it and mark this as the answer to close the topic and make it easier to find for other people with similar questions. AND we get points for it 😉
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473