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 / DateTime Controller Va...
Power Apps
Unanswered

DateTime Controller Value Is Not Changing When The Toggle Value is True

(0) ShareShare
ReportReport
Posted on by 79

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.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    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 Profile Picture
    153,079 Most Valuable Professional on at

    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

  • ChiranJay Profile Picture
    79 on at

    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.

  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at

    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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard