Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Can I create a field that calculates number of days from a date field?

Avatar

Level 3

Hi all,

I need a field that will calculate the number of days elapsed whatever date is entered into the date field, and update that number of days based on the calendar/computer calendar date.  Does that make sense?

https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf

I set up the form so that my boss can add or subtract clients from the list.  Each client needs to have its own "Days since added to the list" number. Sorta like a little aging report.

Is this possible?

Many thanks,

Laura

3 Replies

Avatar

Level 7

there are lots of posts about dates that should help you - try this one: http://forums.adobe.com/message/5289406#5289406

Avatar

Level 3

Thank you for the reply!

I'm sorry to be such a non-tech, but I don't know enough to figure out how to change the script from adding 30 days to a date to calculating the number of days between two sets of dates.  Can you recommend a source?

many thanks!

Laura

Avatar

Level 3

Wow, I'm so stumped.  I tried to copy a bit of formcalc into the exit event for my current date field to try to make this happen, but I can't get it to work.

My  attempt at scripting is embarrassing, but here it is:

form1.sf1.CCSub.CCGroup.#subform[0].DateField2::exit - (FormCalc, client)

form1.sf1.CCSub.CCGroup.#subform[0].NumericField2.rawValue = Date2Num(DateField1, "MM-DD-YY") - Date2Num(DateField2, "MM-DD-YY")

and here's the file:

https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf

Can anyone help me get this right?

Sign me: One Lost Designer

Thanks!