Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
Key Performance Indicator (KPI) Definitions
The DB Analytics system is extensible through the use of KPI definitions that are specified in SAMPro. Viewing the record called 'View KPI Definitions' brings up a list of the current KPI definitions. This list contains an entry for each Analytic Chart, Analytic Table, Analytic List, or Drilldown. Each KPI definition contains all the information necessary for DB Analytics to create a functional Analytic.
Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
Main
The first visible screen after clicking on a record in the KPI Definition List shows a number of fields:
KPI Id |
The unique name of the KPI that is shown in the KPI Definition List. |
KPI Name |
The name of the KPI that is shown in DB Analytics. |
Category |
The category that the KPI will be listed under when adding a new analytic in DB Analytics. |
Class Name |
The class name is used by DB Analytics to distinguish between different types of KPIs. |
Description |
The description of a KPI that will be shown in DB Analytics |
First Version No |
Version of SAMPro where the KPI was first introduced. |
Version Number |
Current Version Number. |
Case Number |
Databasics Fogbugz case that resulted in the KPI being created. |
Obsolete? |
Indicates if the KPI is obsolete. |
KPI Definition User x |
Fields to allow custom properties to be specified. |
The class name provides information to DB Analytics about what to do with a certain KPI. Current classes are:
GenericChart
GenericTable
GenericList
Drilldown
A GenericChart class indicates that DB Analytics should use the Highcharts software to graphically render a graph or chart using the KPI definition.
A GenericTable class indicates that DB Analytics should use the DataTables jQuery plugin to create a table to display the KPI definition.
A GenericList class indicates that DBAnalytics should create a Generic List from the KPI definition.
Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
A Drilldown Class indicates that DB Analytics should put the definition into the Drilldown function list that will be used to look up a drilldown action when a chart or table is clicked on.
There are three buttons on the main page:
ExportRecord allows the user to export the current KPI as an .obj file that can be sent to other users.
ImportRecord allows the user to import an .obj file as a KPI definition.
MakeFunction allows the user to create a user defined function that is used to control who has access to the
KPI.
Definition
The Definition screen allows a user to specify the SQL query that will be used to retrieve the data for an analytic. Variables formatted as '@[Variable]@' and filters formatted as '@f[Filter]@' can be used in the definition. Each filter or variable used in the definition must in turn be specified on the properties tab.
There are eight universal tokens that can be used in all KPI definitions and filter lookups. They are @UserId@, @SecurityId@, @PMId@, @UserRn@, @BranchId@, @DisciplineId@, @SalesRepId@, @GLEntityGroupId@. UserId and UserRn correspond to wbusr_id and wbusr_rn when logged in as a web user. Otherwise they correspond to usr_id and usr_rn.
Another special token is the @Drilldown@ token that can be used in the KPI definition query. This token is ignored if the KPI is not linked as a drilldown, but if it's used as a drilldown, and the drilldown has a drilldownWhere property specified [ex: drilldownWhere= jb_id = @JobId@;] , then the drilldownWhere property will be substituted into the KPI query when it is run, and the proper value will be substituted from the parent of the drilldown. This allows any KPI to be built and used as a drilldown without creating a second KPI definition that just has a few variables added.
Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
Files can be specified so that a user can have access to them in a GenericTable or GenericTable drilldown. The syntax for specifying a file is 'file=[Document Id]' The Document Id will be used to find the correct document in the document archive, and copy the file into a web accessible directory. The file will open once it has been transferred.
Files that are of type .dbr cannot be viewed on the web and must be converted. Specifying a document id like 'email=[Document Id]' will indicate to the dashboard the file needs to be converted and emailed to the address associated with the user who is logged on. The proper message will be created and sampro will send an email containing a PDF version of the dbr.
The statement “JOIN scrty on [tablename].scrty_rn = scrty.scrty_rn” must be used in order to enforce SAMPro data security. The WHERE clause must also include the line “and @SecurityId@”. The where clause can contain the @PMId@ token to filter the data by the user's project manager id. Including the @BranchId@, @DisciplineId@, @SalesRepId@, @GLEntityGroupId@ will filter the query by the branches, disciplines, sales reps, and GL entity groups specified in the user record. All of the above tokens must be properly joined to their respective tables (brnch, dscplne, slsrp, glennttygrp) in order to execute.
The format of the data varies with the type of KPI:
Tables as either analytics or drilldowns will simply display all the data from the query.
Charts as either analytics or drilldowns have a reserved first column that will be used as the series name of each
row of data. This series name is the label for the data in the created chart.
Properties
Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
There are four categories of properties for a KPI definition:
Filter
A filter has a setting key that can be used as a variable in the SQL statement. The naming convention is '@f[Filter]@'. Filters can be changed by a user in DB Analytics by going to the settings page of an analytic and putting a value in the text field. The general syntax for SAMPro filtering applies. The users can also lookup a value for a filter in DB Analytics by clicking the search icon next to the filter input.
Properties:
name |
The name of the filter that will be displayed next to the text input on the Analytic settings page. |
columnname |
The name of the column in the table that the filter supplies a value for. Must use the convention |
description |
Description of the filter. |
value |
Prefilled default value for the filter. |
type |
The type of setting. Not used. Char by default. |
lookup |
If set to exclusive (lookup=exclusive), DB Analytics will not consider any other filters from the same |
options |
Allows the user to list the values they want to be able to choose from as a comma separated list. |
filtercolumn |
If set to true (filtercolumn=true), the filters on the page that have the same table specified in the |
filtertable |
If set to true (filtertable=true), the filters on the page that have the same table specified in the |
tablename |
A property that specifies the table that a filter applies to. Used only with filtertable and |
where |
Specifies how the @LookupJoin@ or tablejoin property value is being used to join the filter lookup. |
tablejoin |
A property that specifies the (multiple) columns that a filter is being joined to. Used with Example: |
cleartablestate |
A property that when set to true will wipe out the table state (removing sorting, column reordering, |
Special Filters (case sensitive):
@LookupJoin@ Can be specified to create the proper joins for filter lookups. Must specify the tablename of
Data-Basics DBAnalytics 2/21/2017 Version 1.1.001p16.4
|
the filters that will be joined, the value (what is being joined), and the where clause (how it is Example1: tablename=clntste;value=clntste.clntste_rn=rmte_wbusrclntste.clntste_rn; Example2: |
@LookupWhere@ |
Can be used to set the where clause for a set of filter lookups. Example: |
@CustomLabelX@ |
Where X = [1..5]. Used to represent the Label in wbprfle_cstmX_lbl. This will be replaced with |
@CustomLabelValueX@ |
Where X = [1..5]. Used in Drilldowns to represent the data passed as a token as |
Filters with a columnname of 'usr.usr_id', 'dscplne.dscplne_id', 'brnch.brnch_id', 'lctn.lctn_id', 'prjctmngr.prjctmngr_id' will be automatically prefilled with the proper values for that DBAnalytics user. These filters can be overridden by the user.
Variable
A variable has a setting key that can be used as a variable in the SQL statement. The naming convention is '@[Variable]@'. Variables can be changed by a user, and are often used to set date ranges. There are a number of special variables that are recognized by DB Analytics and have different functionality.
Properties:
name |
The name of the variable that will be displayed next to the text input on the Analytic settings page. |
description |
Description of the variable. |
value |
Prefilled default value for the variable. |
type |
The type of variable.
|
options |
Allows the user to list the values they want to be able to choose from as a comma separated list. |
|
(options=red,blue,green) |
hidden |
Default false. If set to true (hidden=true), the variable does not show on the Analytic settings page. It |
cleartablestate |
A property that when set to true will wipe out the table state (removing sorting, column reordering, |
Special Variables (case sensitive):
@DateOption@ |
Allows the user to specify a date range that will be reevaluated each time an analytic gets new
(Case and spacing insensitive). These values must be supplied to the user by setting the options |
@DateStart@ |
Specify the start date for the Analytic. Must have type=date and takes dates in the form YYYY- |
@DateEnd@ |
Specify the end date for the Analytic. Must have type=date and takes dates in the form YYYY-
|
@PeriodOption@ |
Allows the user to specify a fiscal period range that will be reevaluated each time an analytic gets
(Case and spacing insensitive). These values must be supplied to the user by setting the options |
@Period@ |
Fills a select list with all the fiscal periods used by SAMPro. Will be greyed out if |
@GLEntityGroupId@ |
Fills a dropdown list with the list of GL Entity Groups available for the user. Upon selection, the |
Setting
A setting cannot be used as a variable in the SQL statement. Settings are used only in DB Analytics and generally have to do with controlling how a given chart or table is displayed. Settings are recognized by name in DB Analytics.
Properties:
name |
The name of the setting that will be displayed next to the text input on the Analytic settings page. |
description |
Description of the setting. |
value |
Prefilled default value for the setting. |
type |
The type of setting. |
options |
Allows the user to list the values they want to be able to choose from as a comma separated list. |
hidden |
Default false. If set to true (hidden=true), the setting does not show on the Analytic settings page. |
title |
The title of the dialog that opens from a @Drilldown@ setting. Can use token replacement. |
filteronclick |
Used with @TabColumnFiltering@ to indicate that the designated Analytic on a page should filter |
table |
Used with @Upload@ to specify the table that the newly uploaded document will be attached to |
id |
Used with @Upload@ to identify the token that will be used by SAMPro to specify the value of the |
category |
Used with @Upload@ to categorize the type of the uploaded file. |
modal |
Used with @Drilldown@ to make a drilldown modal. (modal=true) |
column |
Used with @Drilldown@ to indicate the name of the column that should have a link to a drilldown |
filter |
Used with @TabColumnFiltering@ to indicate the name of the filter that will be replace with data |
drilldownWhere |
Used with @Drilldown@ to specify a custom where clause snippet to use in place of the |
|
Example: drilldownWhere= jb_id = @JobId@; |
icon |
Used with @Drilldown@ to specify an icon in the menu. Available options: add, pageadd, redo, edit, |
submenu |
Used with @Drilldown@. Indicates a sub menu for the menu that uses the value specified as the |
menuhidden |
Used with @Drilldown@ to specify that a drilldown should not show up in the menu. It should be be |
Special Settings (case sensitive):
@Drilldown@ |
The drilldown setting specifies what actions will take place when a chart or table is clicked on. The value property is the id of the drilldown to be opened.
There are five types of drilldowns set by using the type property. The type can be chart, table, sampro, upload, or email. If the type is set to be sampro (type=sampro), any SAMPro function that a user can run will be executed |
@UpdateInterval@ |
Can be used to set a default value for the update interval by using the value=[default] property. It is not used otherwise and is generally hidden. “Update Interval” is a field that is always present on the Analytic settings page even without a setting. |
@ChartTitle@ |
Can be used to set a default value for the chart title by using the value=[default] property. It is not used otherwise and is generally hidden. “Chart Title” is a field that is always present on the Analytic settings page even without a setting. |
@ChartSubtitle@ |
Can be used to set a default value for the chart subtitle by using the value=[default] property. It is not used otherwise and is generally hidden. “Chart Subtitle” is a field that is always present on the Analytic settings page even without a setting. |
@DataSource@ |
This setting is replaced with a dropdown list of the names of the current database connections. The two possible connections are the default database and a KPI database. The default value can be set (value=default or value=kpi) and hidden if desired. |
@TabColumnFiltering@ |
Designates an Analytic on a page as having filter control over the other Analytics on a page. |
@SettingsPage@ |
Allows the settings page for an individual analytic be disabled, or point instead to the tab settings page. If the value is set to 'disabled' the settings page cannot be accessed. If the value is set to 'merged' clicking the settings button on an analytic will instead show the tab settings page |
@eTo@ |
Has a 'value=' property that specifies the email address of the recipient of the email drilldown. Can either use an email address or an available registry setting that corresponds to an email address. If a valid email is not given, the 'email-default' registry setting is used. |
@eSubject@ |
Has a 'value=' property that specifies the subject of the email created by the email drilldown. |
@eBody@ |
Has a 'value=' property that specifies the body of the email created by the email drilldown. |
@Upload@ |
Uses the 'table=', 'id=' and 'category=' properties to identify how SAMPro should deal with the uploaded files. |
@ButtonControls@ |
Used to turn off control buttons of an analytic. Can specify refresh,close,maximize,settings. |
Chart Settings (case sensitive):
Used with charts and drilldowns that use Highcharts charting software such as GenericChart or a Drilldown opened with type=chart.
@ChartType@ |
Gives the user the ability to specify the format of the chart. Options are pie, bar, column, scatter, line, spline, area, areaspline, stackedbar, stackedcolumn. (options=bar,column,pie) A default can be set with the value property. |
@InvertData@ |
Gives the user the option to invert the data so that a series becomes a category and a category becomes a series. The options are true or false and a default value should be set. This property allows a user to see the data grouped by the categories typically in the legend. |
@xAxisTitle@ |
Gives the ability to specify a title for the x-axis of a chart. A default can be set with the value property. Token replacement can be used for this setting. |
@yAxisTitle@ |
Gives the ability to specify a title for the y-axis of a chart. A default can be set with the value property. Token replacement can be used for this setting. |
@LegendTitle@ |
Gives the ability to specify a title for the chart legend. |
@SeriesHidden@ |
Gives the ability to hide a series on a chart by default. The hidden chart is not immediately visible but can be displayed by clicking the series name in the legend. The hidden series should be given as a comma delimited list in the value property that corresponds directly to the displayed name of a |
@ChartColors@ |
Gives the ability to specify the colors used in creating a chart. The value for this setting is a comma delimited list that uses html colors (red, blue, green,etc.) or hexadecimal notation (#FF00FF). |
@PivotData@ |
Changes the way data is formatted before being displayed. Data of the form |
Table Settings (case sensitive):
Used with tables and drilldowns that use Datatables to display tables such as GenericTable or a Drilldown opened with type=table.
@Table[AVG,SUM,MIN,MAX]@ |
Gives the user the ability to add the Average, Minimum, Maximum, Sum for the indicated column. Example: @TableAVG@ : value=Billings; hidden=true; |
@ColSpan@ |
Gives the user the ability to add a second header row above the main header that can span multiple columns. Can be used to group similar columns together. |
@ColHideLock@ |
Gives the user the ability to remove GenericTable columns from the Show/Hide menu. |
@ColHide@ |
Gives the ability to hide a column on a table by default. The hidden column can be |
@InvertData@ |
Gives the user the option to invert the data so that the first column becomes the |
@PivotData@ |
Changes the way data is formatted before being displayed. Data of the form |
@ColRename@ |
Allows the user to rename a column dynamically after the result set is determined in |
List Settings (case sensitive):
Used to indicate the settings for a Generic List Line.
@ListLineText@,@ListLineText[n]@ |
Specifies the text of the row for a Generic List. The value of this property will be the displayed text. The text can use token replacement to display variables. |
Input
An input provides a method for data input within a data table (Drilldown tables and generic tables). The changed data will be submitted to the Java servlet and a stored procedure that will handle the data update will be executed. The naming convention for an input is '@i[Input]@'.
Properties:
type The type of input field that the user will see. Possible options:
radio
dropdown
|
|
typeattributes |
Specify html attributes of the given type of input field. Example: [typeattributes=rows:10,cols:24;] |
options |
The data values for dropdowns and radio buttons. A comma separated list with no spaces that contains the values that will be saved to the database when a corresponding option is selected. |
optiontitles |
The display values for dropdowns and radio buttons. A comma separated list with no spaces that contains the values that will be shown to the user. The values correspond to the options values. |
column |
The name of the column in the table that will be open to user input. |
procedure |
The name of the stored procedure to execute when the user clicks the 'Save Changes' button after making changes to an input. |
params |
A comma separated list of tokens or hardcoded values that will be replaced with values from the KPI's list of tokens and submitted as the parameters of the stored procedure. |
onchange |
Defines what action should take place after a user clicks the 'Save Changes' button and the input method executes successfully. Default is to overwrite the initial cell with changed data. Possible
|
button |
The name of the button within the cell that the user will click to make an input change. Default is 'Edit'. |
Revisions
The revisions screen is where all changes to a KPI definition should be recorded. The revisions are exported and imported as part of the KPI definition. The date, author, SAMPro version, and case should be recorded, as well as a short description of what was changed.
ChartAPI
The ChartAPI screen allows direct manipulation of the Highcharts API. Users should refer to the Highcharts API to determine what options they want to set. The format of the ChartAPI screen is a table where each individual row corresponds to a member found in the Highcharts API reference.
Example:
PropertyKey: xAxis ; PropertyValue: { labels: { rotation: 90 } }
This example would rotate the labels of the categories on the x axis by 90 degrees. The property value field uses properly formatted JSON strings that correspond directly to how they are used in the Highcharts API. These settings will be merged with the user specified chart settings found in the settings menu of a widget. Multiple rows in the chartAPI screen can be specified, they are concatenated into a single JSON string before being passed to DB Analytics.
Drilldowns
Drilldowns must have a KPI definition with an id that corresponds to the @Drilldown@ value property. A drilldown KPI definition must have the class name of 'Drilldown' or be of class GenericTable or GenericChart and be accessible to the user to be recognized as a valid drilldown. The first drilldown will have access to the unique tokens @SelectedCategory@ and @SelectedSeries@ (or @SelectedCategoryParent@ and @SelectedSeriesParent@) in their
SQL statements that correspond to the series and category of the point that was selected. Subsequent chart drilldowns will have access to the selected categories and series of the grandparent by using @SelectedSeries2@ and @SelectedCategory2@ (or @SelectedSeriesGrandParent@ and @SelectedCategoryGrandParent@). The most recent selected category is always accessible with @SelectedCategory@, while the nth parent is accessible by using @SelectedCategory[n]@.
The selected series works in the same manner. The drilldowns will have access to all the
tokens of the parent chart, as well as the tokens of any parent drilldown. Drilldowns can have more drilldowns, as long as they are configured properly. Each drilldown must be linked to the next drilldown by use of the @Drilldown@ token.
This is the only property that will need to be set for each drilldown. However, if a drilldown is a chart, some of the special chart settings will need to be used in order for the chart to be customizable. Drilldowns after the first drilldown will have access to tokens that are value pairs that correspond to the heading and cell value of the row that was selected in the table. Duplicate names for columns (in subsequent drilldowns) will be replaced by the data from the most recent drilldown.
KPI definition drilldowns can be of type chart, table, email, notes, upload, or download. This property is not set in the drilldown KPI definition, but is rather controlled solely through the @Drilldown@ type setting of the parent.
Drilldowns of the type sampro do not need a KPI definition. Drilldown definitions of type upload must have the property @Upload@. Drilldown definitions of type email must have the properties @eTo@, @eSubject@, and @eBody@.
Two special drilldowns are generally available. These are the 'View Notes' drilldown (type=notes) and the 'View Documents' drilldown (type=upload/download). Corresponding KPI definitions are distributed with the DBAnalytics installation. The drilldowns allow a user to view and add notes and documents for a record. These drilldowns need three unique columns in the parent in order to function properly: @RefId@, @RefTable@, and @RefRn@. The three unique columns will be hidden automatically on the client side.
A drilldown can also specify a drilldownWhere property that will be used to filter a drilldown KPI query as long as it includes the @Drilldown@ token and has the proper joins to the tables used in the drilldownWhere property.
Registry Settings
Dashboard
See Registry DBAnylytics Dashboard.
DBAnalytics
See Registry DBAnalytics.
sys-dbanalytics
The registry for DBAnalytics will first look at sys-dbanalytics, then at the User Registry table to get registry settings specific to the user.
FMAnywhere
See Registry FMAnywhere.
sys-fmanywhere
The registry for FMAnywhere will first look at sys-fmanywhere, then at the Web Profile registry table for the user, then the Web User registry table to get registry settings specific to the user.
FMAnywhere KPI definitions must be linked to a certain set of table to properly identify the web user and what data they should have access to. The tables rmte_wbusrclntste and rmte_wbusrsrvcectgry are populated when a web user logs into FMAnywhere and give the list of a web users sites and service categories. The joins into the table will resemble the following:
join rmte_wbusrclntste on rmte_wbusrclntste.clntste_rn = clntste.clntste_rn
join rmte_wbusrsrvcectgry on rmte_wbusrsrvcectgry.srvcectgry_rn = wrkordr.srvcectgry_rn
where rmte_wbusrclntste.wbusr_id = @UserId@ and rmte_wbusrsrvcectgry.wbusr_id = @UserId@