You are viewing limited content. For full access, please sign in.

Question

Question

Date field calculation breaks when Saved as Draft

asked on July 8, 2019

I have a date field, PayPeriod_EndDate, that is calculated based on another date field, PayPeriod_StartDate. For the start date, all dates are disabled, except for the 1st and 16th of any given month. If the selected start date is the 1st, the end date should be the 15th. If it's the 16th, the end date is the last date of the month. The calculation works until the form is saved as draft. When opening the draft the end date is always 12/30/1899. Here's the calculation on the end date:

=IF(DAY(PayPeriod_StartDate)<16, DATE(YEAR(PayPeriod_StartDate),MONTH(PayPeriod_StartDate),15), DATEVALUE(DATE(YEAR(PayPeriod_StartDate),MONTH(PayPeriod_StartDate)+1,1)-1))

TimeSheetForm_EndDateCalc_Draft.PNG
0 0

Answer

SELECTED ANSWER
replied on July 9, 2019 Show version history

Hi Mandi,

In your formula the DATEVALUE was used in a wrong way.

According to https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/#../Subsystems/Forms/Content/FieldCalculations.htm?Highlight=datevalue, the DATEVALUE formula expects string as parameter and returns a date object. In your formula, you passed DATE(...) as parameter which is already a date object.

So you just need to remove the DATEVALUE formula like this:

=IF(DAY(PayPeriod_StartDate)<16, DATE(YEAR(PayPeriod_StartDate),MONTH(PayPeriod_StartDate),15), (DATE(YEAR(PayPeriod_StartDate),MONTH(PayPeriod_StartDate)+1,1)-1))

0 0
replied on July 10, 2019

Thank you so much for catching that! That resolves the issue.

0 0

Replies

replied on July 9, 2019

What version of Forms are you using so we can take a look? 

0 0
replied on July 9, 2019

Laserfiche Forms Essentials Version 10.3.1.635

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.