Custom matrix

Smartsite 7.7 - ...

Smartsite 7.7 adds 4 built-in matrices to the usergroups library. These are specific implementations of the Matrix action. Custom matrices can be added to the dashboard as useractions.

Action parameters

Name

Required Release From Description
dataquery Yes 7.7 The database query used to create the matrix.
legend No 7.7 The legend parameter is displayed in the top left cell of the matrix. Use this parameter to clarify tokens and colors used in the matrix data and styling.

The dataquery should return each cell in the matrix, ordered first by row, then by column. The query must declare an alias for the following fields:

  • xkey
    Unique key for each column
  • xlabel
    Label for the column
  • ykey
    Unique key for each row
  • ylabel
    Label for the row

Further aliasses can be used to fill and format each cell:

  • data
    The data that will be displayed in each cell. Best keep this short to keep the matrix compact
  • cellclass
    The css class for the cell

The following classes are implemented in the matrix.css by default

dot_1 dot Red dot
dot_2 dot Yellow dot
dot_3 dot Transparent dot
dot_4 dot Blue dot
dot_5 dot Green dot
dot_6 dot Grey dot
color_1 1 Red background
color_2 2 Green background
color_3 3 Blue background
color_4 4 Yellow background
color_5 5 Magenta background
color_6 6 Cyan background
color_7 7 Black background
color_8 8 Dark grey background
color_9 9 Middle grey background
color_10 10 Light grey background

Example

The Usergroups - userpaths matrix uses the following query:

select g.nr as xkey, g.name + ' (' + convert(nvarchar(10),g.nr) + ')' as xlabel, p.nr as ykey, 
	case when p.Notes is null then p.Path else p.path + ' (' + p.Notes + ')' end as ylabel,
	case when gp.AccessModes = 4 then 'W' 
		when gp.AccessModes = 2 then 'R' else null end as data,
	case when gp.AccessModes = 4 then 'color_4' 
		when gp.AccessModes = 2 then 'color_2' else 'color_9' end as cellclass
from usergroups g
left join UserPaths p on 1=1
left join UserGroupsPaths gp on (
	gp.nrUserGroup = g.nr 
	and gp.nrUserPath = p.nr
)
order by p.path, g.name

Resulting in: