Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Question About Calculation

Avatar

Level 3

A previous forum user help me out by giving me this code:

form1.#subform[0].Term_Start_Date::exit - (FormCalc, client)

// Get the number of days from the epoch for the starting date

var startNumber = Date2Num(Term_Start_Date.rawValue,"YYYY-MM-DD")

// Add the lease term to the startNumber

var diff = startNumber + LeaseTerm.rawValue

// change back to a date

Term_End_Date.rawValue = Num2Date(diff, "YYYY-MM-DD")

This allows me to calculate a lease date based on start date and lease length. It works like a dream. My question is currently once I choose the lease term and the lease start date I must manually click on the Term_End_Date to have it populate properly. I have this code in the "exit*" section. Is there anyway to have the field auto populate once a user pick a begining date, essentialy eliminating the need for a user to click on the Term_End_Date field?

Thanks to the memeber's.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You could put it on the change event of the start date field. That will populate the enddate when a start date is chosen. Now if they decide to change the lease period after the start date has been selected the calculation will not fire..... is that acceptable?

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

You could put it on the change event of the start date field. That will populate the enddate when a start date is chosen. Now if they decide to change the lease period after the start date has been selected the calculation will not fire..... is that acceptable?

Paul

Avatar

Level 3

Yes it works, I guess you have to live with some limitations...thanks!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----