Ticket #29212
Question
Is there anyway out of the box that I can get a date input field to default to Last Weeks Sunday?
Answer
Yes this is possible. I am assuming you want this defaulted date for a maintainer form. If so, here's the general steps. 1. Create a calculation that based on the current date always calculate and return last weeks Sunday (You can use the built-in SQL server specific functions we have for dates when creating the calculation from the 'Functions' button, otherwise a quick google search should provide you a list of these of all the SQL Server date arithmetic functions available) 2.Once you have that calc created, in the maintainer page HTML set the value="" attribute for the date input equal to this calculated date. ex. <input ....... value="${row.CALCULA001}" /> If you are only using add mode in this maintainer, that would be all you'd need to do. Otherwise if this is a display and maintain rows and update/delete modes are enabled, then you could simply add some Freemarker to say only when the page is in add mode to use the calculated date for the value, otherwise if in update or delete mode just display the actual date for the record.
Asked on July 11, 2019