Chapter 13. Forex Example: Using the Time Dimension

The date dimension with the lowest granularity at the day level is the standard part of GoodData platform. If you need to work with hours, minutes and seconds, you need to create a new time dimension and connect it to your dataset. The GoodData CL Tool introduced a good version of the time dimension and automated it's addition into a project. This chapter shows how to work with this default time dimension. We'll need two files from the CloudConnect examples archive. See Chapter 3, Initial Setup for more information about the CloudConnect examples.

The first phase (phase=0) of the Forex demo CloudConnect graph loads the data to the time dimension.

Forex CloudConnect Graph

Figure 13.1. Forex CloudConnect Graph


[Note]Note

You can reuse both MAQL DDL and the CSV data files for creating your own time dimensions in your projects. You'll most probably need to replace the references to Forex in the MAQL DDL file to a custom name of your time dimension. You can also use the CL Tool to create your data model with a time dimension and load the time dimension's data once. Then you can use the CloudConnect for ongoing data refreshing.

The main Forex dataset obviously references the time dimension. It also contains so called time fact that holds the number of seconds since the beginning of a day. This fact is useful for computing time differences. The time dimension also has a label time_second_of_day that holds exactly the same number and that can be used as reference to the time dimension's dataset.

The Forex demo uses the Reformat component for computing the extra values that fill the time fact and the reference to the time dimension.

Forex Reformat Component

Figure 13.2. Forex Reformat Component


See Reformat for more information about the powerful Reformat component.

[Note]Note

The Reformat CloudConnect component is one of the most frequently used components in CloudConnect transformations.

The main Forex demo dataset then uses the computed columns for referencing the time dimension dataset.

Forex Dataset Field Mapping

Figure 13.3. Forex Dataset Field Mapping