Hi All,
I have SharePoint List which has a form that customized using PowerApps.
In this form I have:
1. Date and Time controller - Email Draft Needed By (Date and time format - Date & Time)
2. Toggle - Same Day Due - Yes/No
Properties
Email Draft Neede By Card Name > Email Draft Needed By_DataCard1
Controller Name > dtpEmailDraftNeededBy
dtpEmailDraftNeededBy > DefaultDate
Same Day Due Card Name > Same Day Due_DataCard1
Controller Name > tglSameDayDue
I want to add few hours to the DefaultDate property of the Email Draft Needed By when the Same Day Due toggle is 'YES'.
I used the below formula
If(IsBlank(Parent.Default)&&tglSameDayDue.Value=false,Today()+1,If(IsBlank(Parent.Default)&&tglSameDayDue.Value=true,Text(DateAdd(Now(), 4, Hours),"dd-mm-yyyy hh:mm"),Parent.Default))
The issue is that this formula didn't add hours to Now().
Can someone please let me know what I have done wrong?
Thanks.
Hi @chiranjay ,
Firstly, if you are using this as a DefaultDate of a Date Picker, it has to be a date, so Text() will not work. Also Date fields are not necessarily blank so, try this (put in your Date Field name)
With(
{
wDay: DateAdd(Today(),1,Days),
wHour: DateAdd(Now(),4,Hours)
},
If(
Value(ThisItem.YourDateFieldName) > 0,
ThisItem.YourDateFieldName,
tglSameDayDue.Value,
wHour,
wDay
)
)
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.
Visit my blog Practical Power Apps
Apologies for the late reply.
Unfortunately your solution didn't work @WarrenBelz
Could you please let me know what's wrong with the below function()
If(IsBlank(Parent.Default)&&tglSameDayDue.Value=false,Today()+1,If(IsBlank(Parent.Default)&&tglSameDayDue.Value=true,Text(DateAdd(Now(), 4, Hours),"dd-mm-yyyy hh:mm"),Parent.Default))
I have applied this function to the DefaultDate property of the Email Draft Needed By(DateTime Picker) when the Same Day Due toggle is 'YES'.
This Email Draft Needed By DateTime Picker is configured to show the dates only from SharePoint list properties. To solve the hours issue, I'm using this part of the function
Text(DateAdd(Now(), 4, Hours)
I can't figure out what I am missing in here.
Thanks in advance.
Hi @chiranjay ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
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.
Visit my blog Practical Power Apps
Hi @chiranjay ,
Is Parent.Default a Date ? If so you need
With(
{
wDay: DateAdd(Today(),1,Days),
wHour: DateAdd(Now(),4,Hours)
},
Coalesce(
Parent.Default,
(!tglSameDayDue.Value && wDay) || wHour
)
)
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.
Visit my blog Practical Power Apps
WarrenBelz
146,631
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,991
Most Valuable Professional