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

Add days to finishing data from a field

Hi,

 

I have three fields in my editform1; Estimated Start Time (Data Field: "Estimated_x0020_Start_x0020_Time"), Estimated Finish Time (Data Field: "Estimated_x0020_Finish_x0020_Time") and Duration in Weeks (I multiply this by 7 in "Label1" to convert into Days).

 

I have tried using the DateAdd("Estimated_x0020_Start_x0020_Time", label1, Days) in the Default property of Estimated Finish Date, but it gives me an error:

 

DateAddProblem2.JPG

 

I have found this thread on the forum, which is exactly what I am looking forward: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Adding-hours-to-date/m-p/417714#M12...

 

 

However, I cannot seem to add Isblank(xxxxx.update) --- .update does not work for me?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Add days to finishing data from a field

@Anderslskov
You should reference the DatePicker called DateValue2 like this

DateAdd(DateValue2.SelectedDate, Value(label1.Text), Days)

Thanks for sending the close up picture. Life is tough coding on a mobile phone!

—-
Please Accept as Solution if this is post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

10 REPLIES 10
Super User
Super User

Re: Add days to finishing data from a field

@AndersIskov 

I think the error is occurring for a few reasons.  The first is you are referencing the start time control instead of its value.  Same things goes for the label1.

DateAdd("Estimated_x0020_Start_x0020_Time", label1, Days) 

 

I would suggest something that looks like this instead.  Notice how I appended ".SelectedDate" to get the contents of the control?  Also, check out how I converted the contents of label1 from a Text data time to a Number

DateAdd('Estimated_x0020_Start_x0020_Time'.SelectedDate, Value(label1.Text), Days) 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

a

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

AndersIskov
Level: Powered On

Re: Add days to finishing data from a field

It seems it does not recognise .SelectedDate, I have tried with 'Estimated Start Time' and 'Estimated Start Time_DataCard1' as well as the one below. Doesn't seem to work

 

 

DateAddProblem3.JPG

Super User
Super User

Re: Add days to finishing data from a field

@Anderslskov
I think we want to reference the name of the date picker control for start time here rather than the Card. Try the code below please and ensured SelectedDate is capitalized exactly the same way. If it does not work please share a screenshot showing the left menu with you start time data card expanded.

DateAdd(‘Estimated Start Time_DataCardValue’.SelectedDate, Value(label1.Text), Days)

Note: I am troubleshooting via mobile phone so I am doing my best with limited screen space lol

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
AndersIskov
Level: Powered On

Re: Add days to finishing data from a field

I have tried a few things, but not sure exactly which DataCardValue I am supposed to use. Here is the screenshot:

 

 

DateAddProblem4.JPG

 

 

I expanded the Estimated Start Time card in the menu to the left

 

 

EDIT:

Since you are on the phone here is a close up picture 🙂

 

DateAddProblem5.JPG

Super User
Super User

Re: Add days to finishing data from a field

@Anderslskov
You should reference the DatePicker called DateValue2 like this

DateAdd(DateValue2.SelectedDate, Value(label1.Text), Days)

Thanks for sending the close up picture. Life is tough coding on a mobile phone!

—-
Please Accept as Solution if this is post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

AndersIskov
Level: Powered On

Re: Add days to finishing data from a field

@mdevaney 

Now I get the error:

 

"This rule creates a circular reference between properties, which is not allowed. A property cannot reference itself or other properties affected by its value.

Location:

Estimated Finish Time_Datacard2.Default"

 

The fact that you can actually program on a mobile shows how much I have to learn 😄

AndersIskov
Level: Powered On

Re: Add days to finishing data from a field

@mdevaney 

 

So I found out that it is working perfect when I simply use Value(DataCardValue27.Text), however, when our excelsheet was made we write weeks, which is not supported by the DateAdd() function, so I simply created a label1 that has: "DataCardValue27 * 7" in the Text property in order to convert into days.

Super User
Super User

Re: Add days to finishing data from a field

Excellent. Does that mean we have solved the problem for now?
AndersIskov
Level: Powered On

Re: Add days to finishing data from a field

@mdevaney

Yes! 🙂

For the user friendliness of the application, would you know how I can convert the weeks into days automatically?

That is what I tried to do with label1, but it didn’t work

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,780)