==== Rules Matrix ==== The Rules Matrix is used to evaluate Business Rules. Different matrices with custom columns can be produced. Then, the matrix rows are populated. These rows can be evaluated using the [[:en:software:tim:actionhandler:matrixhandler|MatrixHandler]]. The row with the highest hit rate is used as the result row (it doesn't have to be a complete match). ---- === Creating a Matrix === A matrix can be created in the [[:en:software:tim:administration_client|administrationsclient ]]. In order to see the relevant tab, the current user must have the [[:en:software:tim:roles| role]] as **rulesadministrator**. {{ :en:software:tim:en_matrix_reiter.jpg?1200 |en_matrix_reiter.jpg}} With "Add matrix" a custom number of matrices can be created. When selected, a new pop-up window is opened, in which the matrix structure can be defined. First, the matrix needs a name (in this example "decision"). Also, the owner group of the matrix must be defined. All users in this group are able to see and change the matrix. Only groups to which the current user belongs are shown. {{ :en:software:tim:en_new_matrix.jpg?400 |en_new_matrix.jpg}} ---- === Define Columns === For the next step, a user-defined number of columns is created. Every column needs a name and a column type. A column type defines the type of content. Normal column types are used for evaluation, and "result" column types are used only for results and are not considered in the evaluation. There are several different column types: ^Column Type^Description| |**STRING** |A normal character string where text can be defined.| |**RESULT_STRING** |**Result column** / A normal character string where text can be defined.| |**LONG** |This column is for integers.| |**RESULT_LONG** |**Result column** / This column is for integers.| |**FLOAT** |This row is for floating decimals.| |**RESULT_FLOAT** |**Result column** / This row is for floating decimals.| |**BOOLEAN** |This column is for true/false values.| |**RESULT_BOOLEAN** |**Result column** / This column is for true/false values.| |**IDENTITY** |In this column, users that are created in the system can be chosen.| |**RESULT_IDENTITY** |**Result column** / In this column, users that are created in the system can be chosen.| The following example shows a matrix with three columns to be searched through. Each column has a different column type. There is also a result column, in which a user will be presented as the result.\\ \\ {{ :en:software:tim:en_columns_new.jpg |en_columns_new.jpg}}Clicking on "save" creates the matrix, which can now be populated. ---- === Populating the Matrix === The following image shows an already-populated matrix. In this view it is possible to delete the entire matrix, to edit the matrix, to add new lines and to delete lines.\\ \\ {{ :en:software:tim:en_matrix_overview.jpg |en_matrix_overview.jpg}} ^Element^Description| |**1** |This button is used to delete the entire matrix.| |**2** |This view shows all filled cells of the matrix.| |**3** |This button is used for editing the matrix. It is not possible to change the column type of existing columns; however,they can be deleted an added anew.| |**4** |This button is used to delete rows.| |**5** |Here, new lines can be added.| If one wants to add a new row, a pop-up appears. Various fields may be shown depending on the column type. For example, For string, a simple box appears. In identity, a list of all users is displayed. A list populated with either true or false is displayed when using Boolean. If an asterisk "*"is selected, this is treated as a wildcard and any value will be used for matching. [[:en:software:tim:en_fill_matrix_combined.png?id=en%3Asoftware%3Atim%3Arules_matrix&media=en:software:tim:en_fill_matrix_combined.png|{{ :en:software:tim:en_fill_matrix_combined.png }}]] === Using the Matrix per Actionhandler === How to use the matrix per Actionhandler is described here: [[:en:software:tim:actionhandler:matrixhandler|MatrixHandler]] === Evaluation Algorithm === In principle, all of the cells within the matrix will be evaluated individually. If a perfect match is found within a column, three points are given. For a partial match in the character chain (i.e. is AR is written in the rule, but AR-01 is found in the formula/variable) 2 points are given and for the Wildcard *, one point is given. The cells with the highest point values deliver the results. If multiple cells with the same point value exist, then the result is delivered by the uppermost cell. === Evaluation Examples === For the basics of this evaluation, we will set up the filled example table from above with three search values and one results column. The following table shows the results of some fictitious evaluations resulting from the previously-described rules: * The line with the best match is presented as the result. * If more than one line matches, the first match from the top is presented as the result. ^Search Value 1^Search Value2^Search Value3^Result| |Freising|true|20|**Group_1** | |Freising|true|89|**wiki** | |Freising|true|*|**wiki, Group_1** | |Freising|false|20|**Group_1** | |Freising|false|8267|**Group_1** | |Freising|false|8|**wiki** | |München|true|213|**Prozess Manager** | |Timbuktu|false|89|**Prozess Manager** | |München|true|8|**wiki** | |München|true |*|**Prozess Manager, wiki** | |*|*|89|**wiki, Prozess Manager** | \\