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.

Merging seperate date and time fields into a unique text field.

Avatar

Former Community Member
I have a dropdown Calendar Date field and a dropdown Time Field in a form and I want to create an additional Text Field that displays the combination of these two fields as a unique form field that would look like this...



Arrival Date: 1/27/2009 Arrival Time: 11:30 AM



Record Number: This would be calculated from the two fields as (012720091130)



Also when you press the submit button the XML file name would be the Record Number (this would be a coded filename to correspond to the time of arrival).



Any Ideas?
4 Replies

Avatar

Former Community Member
Creating the Arrival time string should be easy. Its a case of adding a number of strings together. Assuming the date is held ina field called dateField and the time is in a field called timeField the javascript expression woudl look like this:



TargetField.rawValue = "Arrival Date: " + dateField.rawValue + " Arrival Time: " + timeField.rawValue;



To get the recordNumber you will have to parse the unwanted chars out of the strings then add the two together just like above.



The data file name will be the same as the PDF file that it came from. You cannot change the name of it easily without certifying the document (and that brings in its on set of problems).

Avatar

Former Community Member
Thanks,

The calc JavaScript arrivaldate.rawValue + arrivaltime.rawValue worked but is there a way to remove the "-" in the date and the ":" in the time part of the data within the calc script? Also, the minutes are removed if they are 00 (e.g. 08:00 AM will be displayed as 08).



Thoughts?

Avatar

Former Community Member
You can parse them (as it is just a string) and get back what you want. Javascript has a more robust set of string manipulation funtions.

Avatar

Former Community Member
I discoverd the correct syntax for a single form calc...

concat(substr(arrivaldate,6,2),substr(arrivaldate,9,2),substr(arrivaldate,1,4),substr(arrivaltime,1,2),substr(arrivaltime,4,2))



However, there is one final problem. The minutes do not show up unless they are non-zero. Any ideas on how to make sure the zero minutes carry over?