Creating a Custom Calendar (the old way)
NOTE: This procedure applies to calendars created prior to Spectre 7.0(35). They are supported but considered deprecated. For the latest information, see About Spectre Calendars.
You can define a custom calendar as a separate cBase file that allows you to define a custom "period" type column that maps any given date to a user-defined period. The source text file should have one row per period, where the date on each row is the start date for that period. The type of period dictates other numbers that are required to uniquely identify the period, and what those numbers are called. For example:
- a Fiscal Month calendar would have: Date, Year, Month
- a Fiscal Quarter calendar would have: Date, Year, Quarter
- a Fiscal Week calendar would have: Date, Year, Week
- a Fiscal Week calendar, where the week numbering restarts at the start of each month would have: Date, Year, Month, Week.
If you want more than one period type, define multiple custom calendars.
NOTE: The data must be sorted down on Date. Either the text file itself should be generated sorted, or a sort operation should be specified in the Build file. The Date entry on each period must be the first standard Gregorian day in that period, or null if that period has no days.
- Create a tab-delimited text file that has at least one column named "Date" and save it into Workbench.
Add any of the following optional columns required to uniquely identify the period:- Year
Half
Quarter
Month
Week
Example of a partial text file:
- Right-click the text file and choose Generate Spectre Build Script.
- In the Save As dialog box, choose a location for the Build script (/build recommended), make changes to the file name if desired, and click Save.
Workbench generates a build file and opens the file in the Build Script Editor. - Make adjustments as required:
- Ensure the Type is correct for each column (Spectre makes a best guess while creating the Build file). Date column Type must be set to date and any optional columns are set to integer.
- Set the output location (bottom left).
-
Choose Run > Run or click the Run button (green circle with white arrow) from the toolbar.
You now have a custom cBase calendar that you can use for a period column in other Build scripts.
Additional NOTES on constructing calendar data sets:
- Include only the columns needed to uniquely identify a period. For example, a custom Week calendar requires the Date, Year, and Week number.
- The data set should have one row per period and that row should define the period start date.
- The data set should be sorted on the Date column before the build.
- The data set must have a row for every period you expect to use in the data, so you may want to generate some number of historical periods, and some future periods as well, and plan to regenerate the calendar periodically.
- To reference the calendar cBase from another Build script, use the form:
column "Period" type="period" calendar="my-custom-calendar.cbase"