To show how dates can be used in Oasis, we can start with a table that contains dates such as this one that lists out some details of the British Monarchy:
The default import mechanism, which includes type detection, results in the following table in Oasis:
Note that under each column title in smaller italics the type is shown. The first and last columns are detected as type text, whereas the other columns are detected as a date type. The ‘D’ next to the date is a formatting code. Behind the scenes, the date is converted to an ISO format and saved in the database this way. The ‘D’ shows how the date should be presented in the table, which here means a month/day/year format. Almost any time and date formatting is possible.
The blank entries in some columns may cause an issue when we want to show a bar showing the length of a reign, so lets add a calculated column ‘Reign Ended’ that shows either the Abdicated date or the Died date. For Charles III, we’ll use todays date.
The resulting table looks like this:
The formula used for the ‘Reign Ended’ calculated column is this:
a="Abdicated".getFullYear(); b="Died".getFullYear(); (isNaN(a)?(isNaN(b)?Date():"Died"):"Abdicated").toISOString()
This formula shows some of the capabilities of the math engine used by Oasis. Some points to note:
- the
a=...;
andb=...;
are defining variables. - the
.getFullYear()
notation executes a function associated with date content (“Died” or “Abdicated” in this case). Since these are date type columns, the function is recognized. - the
isNaN(x)
function returns true or false depending on x. Here, a or b not getting a date would cause this to be true. - the ? and : are used in a
boolean?value1:value2
format. That is if the boolean expression is true, value 1 is used else value 2 is used. This is how we use one of “Abdicated”, “Died” or the current date depending on available values. - the
toISOString()
is needed to provide a formatted output used by the Date type column. Else an object is returned that does not show in the table.
From this we can use the Chart Design in Oasis to create this chart:
Because all the series are dates, the Y axis interprets all the numbers as dates automatically.
An alternative and sometimes more useful view is a Gantt chart. The table designer in Oasis enables graphical content to be placed in a table cell.
Note the following:
- All but four of the original columns have been removed
- One column – in this case the calculated ‘Reign Ended’ column has been repurposed to show graphical information and moved to be shown as the third column.
- Settings for this column can be adjusted to show an advanced chart containing multiple bars and milestones. In this case we have:
- two bars: one shows birth to death, the other from reign start to reign end.
- five milestone markers for birth, reign start (yellow star), coronation (green diamond), abdication (red down triangle), and death
- bars and markers can be styled with shading, border colors and sizes
- bars and markers can also be positioned relative to each other
We can show all these together in a dashboard: The original table, with the charts below and a checkbox filter.
So for example selecting a subset shows:
Oasis understands the relationship between all items and so can create an interactive dashboard like this.
This post showed how the date type can be used in Oasis. Also showed use of a calculated column, chart and table designer, and a dashboard.