Convert Attributes to Time Fields in Data Source Field Specifications
If your data contains time-related fields (attributes) that are not stored in a recognized time format, you can convert the fields to time fields using the Fields tab of the data source configuration. As long as any string field contains date or time data, you can set its type to Time and specify a time pattern recognized by Composer.
The process described here is not the recommended process. Instead, Composer recommends that you convert the data using a derived field, as described in Convert Attributes to Time Fields Using Derived Fields.
Composer uses Java's SimpleDateFormat for time conversions. See SimpleDateFormat.
Group functionality does not work for fields for which the type is manually set to Time. You cannot specify these fields as the Group, Group By, or Trend fields for a visual. You can use these fields in filters and apply them as filters on the time bar. However, you may find that the results shown in your visual are incorrect. This may happen because the manually configured time formats are different and, consequently, not in lexicographic order. For example, suppose you have two strings:
- String
20170801
(August 1, 2017) matches the time formatyyyyMMdd
. - String
08012018
(August 1, 2018) matches the time formatMMddyyyy
.
When filtering time data by these fields, Composer treats the time values as numbers. So, when filtered in ascending order, 08012018 will sort before 20170801, which is not correct (August 1, 2018 occurred after August 1, 2017, not before). The resulting visual will not be correct.
To convert an attribute field to a time field in the field table of a data source configuration:
Make sure you are logged in as a Composer administrator.
Select Sources on the UI menu (
). The Data Sources page appears.
In the My Data Sources table on the Data Sources page, locate and select the data source configuration you want to edit. The data source configuration wizard appears.
Select the Fields tab in the data source configuration wizard.
Locate the time field in the list of fields.
Change the value in the Type column for the field to Time.
The Configure column changes to display two selectable drop-down menu lists: Time Pattern and Granularity as well as the Time Zone option.
Specify the time format (pattern) for the field. The Time Pattern list (with Default displayed) provides two options: Default and Custom. Select the Custom option to specify a unique time format in a text box.
Specify a granularity for the time field. The Granularity list lets you select the default unit of time to use for this time field.
Valid granularity options are Millisecond, Second, Minute, Hour, Day, Week, Month, Quarter, or Year. If some of these granularity options do not appear, verify that the granularity specified for this field on the Fields tab of the data source definition is set at the correct granularity level.
The refinement level of the field data in a data store defines the minimum level of granularity that should be set for the field. Specifying granularity for a field that is lower than the refinement level of the field data will not produce a visual with data grouped at the requested lower level. For example, if a field's data is stored in hours, requesting the granularity of that data lower than hours will produce the values up to the hour level, and the more detailed level information will be zeros (i.e., 0 minutes, 0 seconds, and 0 milliseconds).
Specify the time zone for the time field. The Time Zone option lets you select a time zone: The time zone label will be displayed in visuals and dashboards for this data source.
When your changes are complete, select
,
, or
(depending on the tab) to save the data source configuration and close the wizard.
Comments
0 comments
Please sign in to leave a comment.