cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Ewoud
Level: Powered On

Add days to a different date field

Hi there, I am trying to add 30 days to a datefield. The extra 30 days should be calculated using a different date field. I found a few other topics about this but they seem not to work for me. Especially this topic seems similar to my question. But when I use the same code I get an error. It's Dutch but it's saying it has unexpected characters. 

 

DatePicker 1 corresponds to the field 'Datum uitdienst' and DatePicker2 corresponds to the field 'Datum e-mail verwijderen'. I want DatePicker2 to add 30 days to DatePicker1. DatePicker1 has a default value of Today() to show current day but this date will change once the user starts filling in the form.

date.jpg

 

What am I doing wrong here?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Add days to a different date field

Hi @Ewoud

Looking at your screenshot, it looks like DatePicker1 is a card rather than a date picker control.

Can you expand the DatePicker1 node (the bit highlighted in yellow), and find the name of the date picker? It'll look something like DataCardValueXXXX - similar to the control that I marked in blue.

 

image.png

Next, use this control name in your formula like so and it should hopefully solve the problem.

DateAdd(DataCardValueXXXX.SelectedDate; 30; Days)

 

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Add days to a different date field

Hi @Ewoud

 

Can you replace the commas with semi-colons in your formula, and see if that removes the error?

 

DateAdd(DatePicker1.SelectedDate;30;Days)
Ewoud
Level: Powered On

Re: Add days to a different date field

Hi @timl,

 

Thanks for the suggestion. Unfortunately it throws me a different error. Something about an invalid name and not recognizing the ID.

date2.jpg

 

But then I changed the value of Datepicker into the name of the field which is 'Datum uitdienst'. It looks like that works, sort of. As you can see it doesn't add 30 days but just 8 days. And when I fill in the form and change the date of 'Datum uitdienst' nothing happens, and it also shows a default date of 31-12-2001.

 

I also tried to use DataCardValue5 but that also gives an error.

Ewoud
Level: Powered On

Re: Add days to a different date field

Sorry, forgot to add the second image.

datum3.jpg

Super User
Super User

Re: Add days to a different date field

Hi @Ewoud

Looking at your screenshot, it looks like DatePicker1 is a card rather than a date picker control.

Can you expand the DatePicker1 node (the bit highlighted in yellow), and find the name of the date picker? It'll look something like DataCardValueXXXX - similar to the control that I marked in blue.

 

image.png

Next, use this control name in your formula like so and it should hopefully solve the problem.

DateAdd(DataCardValueXXXX.SelectedDate; 30; Days)

 

View solution in original post

Ewoud
Level: Powered On

Re: Add days to a different date field

Hi @timl,

 

You are a genius. I tried a formula that didn't contain the 'SelectedDate' part. But now that I did it works like a charm.

 

Thank you very much for your help!

Super User
Super User

Re: Add days to a different date field

Thanks @Ewoud! I'm glad the problem is solved.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,712)