Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

How to get field to advance to the 1st of the next month

Avatar

Level 1

I am trying to figure out how to get a date field (effDate1) to advance to the first of the next month from the previous date field (retireDate1). For example, if I enter 03/20/2015 in the field titled retireDate1 - the next date field, titled effDate1, needs to be the 1st of the following month - 04/01/2015. Any help is greatly appreciated!!

FormCalc

Date Pattern: MM/DD/YYYY

3 Replies

Avatar

Level 7

if (HasValue(retireDate1)) then


  var retireDate1_ = Date2Num(retireDate1.formattedValue, "MM/DD/YYYY")


  retireDate1_ = retireDate1_ + 1


  while (Substr(Num2Date(retireDate1_,"MM/DD/YYYY"),4,2 ne "01") do


    retireDate1_ = retireDate1_ + 1


  endwhile


  $ = Num2Date(retireDate1_, "MM/DD/YYYY")


endif


See if that works for you.

Avatar

Level 1

syntax error near token 'do'

I should be able to figure this out, Friday brain, but I feel it's close.

Avatar

Level 7

I noticed that after I copy/pasted from the forum, my quotes started acting weird in LC. May have to check that.