Support Article
Space issue in correspondence letters after date values
SA-40681
Summary
When a date value with few formats like Date-Long (which displays June 20,2017) are used, a space is getting appended after the value.
Error Messages
Not Applicable
Steps to Reproduce
- Configure Correspondence with Date Property.
- In correspondence change the format of property to Date-Long.
Root Cause
Error in Date-Long control.
Resolution
Replace Date-Long control (Available rule) with the below code:
<%
tools.putParamValue("DateFormat","4");
ClipboardProperty curProp = tools.getActive();
if ( (curProp.getType() == PropertyInfo.TYPE_DATETIME || curProp.getType() == PropertyInfo.TYPE_DATE) && curProp.size() > 0 && curProp.hasValidValue() && curProp.toDate()!=null) {
String sDatetime="";
String type = tools.getParamValue("DateTimeFormat");
String strTimeZone = "GMT";
sDatetime = PRDateFormat.format(null, strTimeZone, PRDateFormat.DEFAULT_DATE_LONG, curProp.toDate());
tools.putSaveValue("result",sDatetime);
}
else {
String sDatetime="";
Date tempDate = PRDateFormat.parseInternalDateTime(tools.getActiveValue());
if(tempDate != null)//Check if its a valid date time
{
String type = tools.getParamValue("DateTimeFormat");
String strTimeZone = tools.findPage("pxRequestor").getString(".pyUseTimeZone");
sDatetime = PRDateFormat.format(null, strTimeZone, PRDateFormat.DEFAULT_DATE_LONG, curProp.toDate());
tools.putSaveValue("result",sDatetime);
}
else{
tools.putSaveValue("result",tools.getActiveValue());
}
}
tools.getParameterPage().remove("DateFormat");
%><pega:reference name="$save(result)" />
Published October 10, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.