How to implement custom periods

  • Posted on: 10 February 2012
  • By: Anders

Outline

The Analyze PRO platform comes with a range of periods that you can utilize to create period parameters. These periods are defined in a XML file located at [APP_ROOT]/Common/XML/DataCentral/timesheet.xml. (Old versions)
[APP_ROOT]/Storage/Custom/DataCentral/timesheet.xml (5.5 or newer versions)
This file contains the periods that the platform provides for you to use and reuse.

Adding custom periods

During platform upgrades this file will be overwritten, so if you want to create additional period types we strongly recommend using the custom option:
The Analyze PRO plaform comes with a custom directory that will not be overwritten during updates. In this folder you can place your own timesheet.xml file with your own custom formats:

[APP_ROOT]/Custom/DataCentral/timesheet.xml (Old versions)
[APP_ROOT]/Storage/Custom/DataCentral/timesheet.xml (5.5 or newer versions)

Online:
System Aministration --> File Manager --> DataCentral --> timesheet.xml
Note: To use the new time period you need to make a copy of the parameter and datasets to be able to use it. Since the packages are locked for editing.

If the file is not present in your environment, just copy the file from the Common location and remove all nodes that is not your custom nodes.

The file should always be of this format:

 

<?xml version="1.0" encoding="utf-8"?>
<timesheet>
<periods>
<period name="lastday">
<label locale="no">
<caption><![CDATA[I går]]></caption>
</label>
<label locale="en-gb">
<caption><![CDATA[Yesterday]]></caption>
</label>
<label locale="sv-SE">
<caption><![CDATA[I går]]></caption>
</label>
<label locale="nl-NL">
<caption><![CDATA[Gisteren]]></caption>
</label>
<label locale="da-DK">
<caption><![CDATA[I går]]></caption>
</label>
<label locale="de-DE">
<caption><![CDATA[Gestern]]></caption>
</label>
<startDate><![CDATA[=Date({"mask":"RdayS","offset":-1});]]></startDate>
<endDate><![CDATA[=Date({"mask":"RdayE","offset":-1});]]></endDate>
<startTrendDate><![CDATA[=Date({"mask":"RdayS","offset":-2});]]></startTrendDate>
<endTrendDate><![CDATA[=Date({"mask":"RdayE","offset":-2});]]></endTrendDate>
</period>
<period>
(...)
</period>
</periods>
</timesheet>
 
The first node of a period is the period name="[uniqueName]". This is the unique key of the period and this string needs to be unique throughout the platform.
The next nodes are the localized labes that represent the period. These strings does not need to be unique.
The last four nodes of a period is the actual date formats:
 
These format are actually Scripting Engine functions (=date();) and defines the start and end date of the period.
They also define a trend period attached to the period that can be utilized when mapping these parameters to a datatable.
Usage of trendperiods from timesheets are not scope of this guide.
 
Try out your date formats in the Scripting Engine expression tester before saving this file so you make sure that the period returns the appropriate format.
Check out the =date(); function guide for more details on this function.

Finishing up / testing

These periods are cached in the webserver application object so after you have saved your custom file you need to restart the application to import them into the application.
One way to restart the application is to open and save the web.config file. You can also restart the IIS service but this will also restart all other applications on the same webserver.
 
Once the application is restarted you can open the Data Central and edit one of you period parameters and identify that you new custom period shows up in the list of available periods for the parameter.
To make the option available to end users you need to check the checkbox in front of you period and save the parameter definition.

tp5harp
Change of path for timesheet.xml for version 5.6

Hi All,

I upgraded Business Analyze to 5.6, and my custom time periods stopped working.  This is because it now has to be placed in a different folder.

[APP_ROOT]/Storage/Custom/DataCentral/timesheet.xml

Hope this helps others.

Trevor

Log in or register to post comments