When you insert a parameter of any type (Date, Timestamp, Integer) into a report, it will display as String type. This sample illustrates how to retain TimeStamp format after it is inserted as parameter.
Major steps include the following:
- Create a report template (RetainTimeStampFormat.rml) using the datasource (TimeStampSample_PropertiesDS.ds).
- Insert two parameters as follow:TimeIn = ${TimeIn##2007-04-15 10:00:00}InsertTimestampWithoutPropertiesDS = ${InsertTimestampWithoutPropertiesDS##2007-04-15 10:00:00}
- Use the code below to show that without using Properties DS, the parameter will be inserted as String instead of Timestamp:${InsertTimestampWithoutPropertiesDS}Use the code below to show that using the Properties DS, the parameter will be inserted as Timestamp:TimeInUse the code below and specify a customized Date/Time format to show that using the Properties DS, the parameter can be inserted as Timestamp with formatting:TimeInSet Date/Time Custom Pattern to “yyyy-MMM-dd hh:mm:ss”
To download the necessary files for this recipe, refer to the attached ZIP package.
RetainingTimestampFormatAfterInsertAsParameter.zip (3.6 KB)