Interface ResultMatrix

All Superinterfaces:
AppPages, ComplexCalculationResult, Portlet, Serializable

public interface ResultMatrix extends ComplexCalculationResult, AppPages, Portlet
This class is used to transport a calculated matrix-style result It is basically a list of maps with the addition that the column names are clearly named and can have a format This means: - the UI knows exactly which columns to display (even if some maps do not have those as keys) - the entry maps can have more "columns" (or keys) than those that are displayed; maybe useful for calculation
Author:
cat
  • Method Details

    • getTitle

      String getTitle()
      Gets the current title
      Returns:
      The current title
    • setTitle

      default void setTitle(String title)
      Sets the title that will be shown as window title of the result matrix in the client
      Parameters:
      title - The title
    • withTitle

      ResultMatrix withTitle(String title)
      Sets the title that will be shown as window title of the result matrix in the client
      Parameters:
      title - The title
    • getPreferenceName

      String getPreferenceName()
      Gets the preference name
      Returns:
      The preference name
    • isPreferencesDisabled

      boolean isPreferencesDisabled()
      Tells whether saving of matrix grid preferences is disabled.
      Returns:
      true if saving of grid preferences is disabled. Default is false
      Since:
      7.2 Bijou PR2
    • setDisablePreferences

      default void setDisablePreferences(boolean disablePreferences)
      Allows to disable saving preferences of the matrix grid (columns, sorting, filtering). If not disabled, the preferences may be be saved with the global dashboard preferences or attached to a specific preferences name defined with setPreferenceName()/withPreferenceName()
      Parameters:
      disablePreferences - true means saving grid preferences is disabled. Default is false
      Since:
      7.2 Bijou PR2
    • withDisablePreferences

      ResultMatrix withDisablePreferences(boolean disablePreferences)
      Allows to disable saving preferences of the matrix grid (columns, sorting, filtering). If not disabled, the preferences may be be saved with the global dashboard preferences or attached to a specific preferences name defined with setPreferenceName()/withPreferenceName()
      Parameters:
      disablePreferences - true means saving grid preferences is disabled. Default is false
      Since:
      7.2 Bijou PR2
    • isSortingDisabled

      boolean isSortingDisabled()
      UI sorting of matrix grid
      Returns:
      true if sorting is disabled on all columns. Default is false
    • setDisableSorting

      default void setDisableSorting(boolean disableSorting)
      Set sorting capability in UI grid
      Parameters:
      disableSorting - true: sorting is disabled in UI on all columns
    • withDisableSorting

      ResultMatrix withDisableSorting(boolean disableSorting)
      Set sorting capability in UI grid
      Parameters:
      disableSorting - true: sorting is disabled in UI on all columns
    • isEscapeHTML

      boolean isEscapeHTML()
      Is HTML escaping enabled?
      Returns:
      true if the matrix should display raw text as is (i.e. not try to interpret it as HTML)
    • setEscapeHTML

      default void setEscapeHTML(boolean escapeHTML)
      Set HTML escaping flag. Default: false (i.e. values will be interpreted as HTML)
      Parameters:
      escapeHTML -
    • withEscapeHTML

      ResultMatrix withEscapeHTML(boolean escapeHTML)
      Set HTML escaping flag. Default: false (i.e. values will be interpreted as HTML)
      Parameters:
      escapeHTML -
    • setPreferenceName

      default void setPreferenceName(String preferenceName)
      Sets the so-called preference name. I.e. all result matrixes with the same preference name will share the same preference setting. The preference setting can be managed as usual in the client and can be set as global to predefine a good setting
      Parameters:
      preferenceName - The preference name
    • withPreferenceName

      ResultMatrix withPreferenceName(String preferenceName)
      Sets the so-called preference name. I.e. all result matrixes with the same preference name will share the same preference setting. The preference setting can be managed as usual in the client and can be set as global to predefine a good setting
      Parameters:
      preferenceName - The preference name
    • addColumnTranslation

      default void addColumnTranslation(String column, Map<String,String> translations)
      Adds translated labels for the given column.
      Parameters:
      column - The column name (as defined e.g. in the constructor)
      translations - A map with the translations. The key of the map is the locale, like "de".
    • withColumnTranslation

      ResultMatrix withColumnTranslation(String column, Map<String,String> translations)
      Adds translated labels for the given column.
      Parameters:
      column - The column name (as defined e.g. in the constructor)
      translations - A map with the translations. The key of the map is the locale, like "de".
    • getColumnTranslations

      Map<String,String> getColumnTranslations()
      Gets current column translations in raw format
      Returns:
    • addColumn

      default void addColumn(String column)
      Adds a column to the existing set of columns
      Parameters:
      column - The columns name
    • withColumn

      ResultMatrix withColumn(String column)
      Adds a column to the existing set of columns
      Parameters:
      column - The columns name
    • addColumn

      default void addColumn(String column, String tooltip)
      Adds a column to the existing set of columns including a tooltip
      Parameters:
      column - The columns name
    • withColumn

      ResultMatrix withColumn(String column, String tooltip)
      Adds a column to the existing set of columns including a tooltip
      Parameters:
      column - The columns name
    • addColumns

      default void addColumns(Collection<String> columns)
      Adds columns to the existing set of columns
      Parameters:
      columns - Collection of columns names
    • withColumns

      ResultMatrix withColumns(Collection<String> columns)
      Adds columns to the existing set of columns
      Parameters:
      columns - Collection of columns names
    • withFrozenColumns

      ResultMatrix withFrozenColumns(Collection<String> frozenColumns)
      Sets the specified columns as frozen.

      Calling this method again will replace the previously set frozen columns. If duplicate columns are specified, they are ignored (no error/warning is thrown).
      All specified columns must be part of the ResultMatrix's columns. If any column is not part of the ResultMatrix's columns, an exception is thrown.

      Example:

      
           def resultMatrix = api.newMatrix()
                .withColumns('Column1', 'Column2', 'Column3')
                .withFrozenColumns('Column1')
      
           //Column1 will be frozen in the UI
       
      Parameters:
      frozenColumns - Collection of column names to be frozen. Passing null parameter will unfreeze all columns.
      Returns:
      ResultMatrix with the updated frozen columns.
      Throws:
      ResultMatrixGroupingException.NotPartOfColumnsAttributeException - If any column in frozenColumns is not part of the ResultMatrix's columns.
      Since:
      13.0 - Rampur
      See Also:
    • addRow

      void addRow(Map<String,Object> row)
      Adds a data row. The keys of the row-map should match the column names defined earlier
      Parameters:
      row -
    • getTotalRow

      Object getTotalRow()
      Retrieves a value assigned to the totalRow property within the ResultMatrix.
      Returns:
      totalRow An Object representing the totalRow value assigned by the withTotalRow method.
      Since:
      13.0 - Rampur
      See Also:
    • withTotalRow

      ResultMatrix withTotalRow(Object totalRow)
      Assigns any data to the totalRow property within the ResultMatrix. Uses the same format as a standard ResultMatrix row, you can also use a styled cell using styledCell().

      Enables you to add, for example, SUM calculations into this row.
      Note: Multiple calls of withTotalRow(Object) will override the previously set totalRow data.
      Example:

      
        matrix.withTotalRow([
               "MaterialNumber": "2100616",
               "ShipToNumber": "2003248",
               "SpecialPrice": 2.65,
               "ListPrice": 253,
               "SupplementalPrice": 1.99,
               "SupplementalRate": "0.66",
               "Percent": "98"
           ])
       
      Parameters:
      totalRow - Any value defined by the Configuration Engineer (CE).
      Returns:
      ResultMatrix with updated totalRow value.
      Since:
      13.0 - Rampur
      See Also:
    • getGroupBy

      List<String> getGroupBy()
      Returns:
      list of columns' names dedicated for grouping
      Since:
      12.0 - Clover Club
      See Also:
    • getExpandedGroups

      List<String> getExpandedGroups()
      Returns:
      list of columns' names defining expanded level(s) of presented groupBy data
      Since:
      14.0 - Caribou Lou
      See Also:
    • getGroupByData

      List<List<Map<String,Object>>> getGroupByData()
      Returns:
      collection of data grouped by predefined columns
      Since:
      12.0 - Clover Club
      See Also:
    • getAggregationStrategy

      Map<String,Object> getAggregationStrategy()
      Returns:
      Map of numeric column's name with aggregation value assigned to it
      Since:
      12.0 - Clover Club
      See Also:
    • withGroupBy

      ResultMatrix withGroupBy(Collection<String> columns)
      Definition of columns' names dedicated for grouping. Columns passed in the collection need to be present in ResultMatrix columns' attribute. If, at least one column, is not part of the ResultMatrix columns' attribute, the ResultMatrixGroupingException.NotPartOfColumnsAttributeException will be thrown. Repetitive columns' names are removed.

      Example:

      
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
           resultMatrix.withRows(entries)
           resultMatrix.withGroupBy(['TextColumn1', 'TextColumn2'])
      
           // TextColumn1 and TextColumn2 are now columns by which the grouping will be done
           // The groupBy columns can be accessed by getGroupBy()
           def groupByColumns = resultMatrix.getGroupBy()
      
       
      Parameters:
      columns - collection of columns' names for grouping, if null or empty the ResultMatrixGroupingException.NullOrEmptyException will be thrown.
      Returns:
      ResultMatrix with groupBy columns.
      Since:
      12.0 - Clover Club
      See Also:
    • withExpandedGroups

      ResultMatrix withExpandedGroups(Collection<String> columns)
      Definition of columns' names dedicated for expand level while grouping (same for each row, nested levels are not supported).
      Columns passed in the collection need to be present in ResultMatrix groupBy's attribute.
      If, at least one column, is not part of the ResultMatrix groupBy's attribute, the ResultMatrixGroupingException.NotPartOfGroupByAttributeException will be thrown.
      If global expand data in grouping is off (isGroupByDataExpanded() equals to false) then getExpandedGroups() will be ignored. Repetitive columns' names are removed.

      NOTE: The methods flow in the ResultMatrix creation needs to be kept in order:
      (1) first define groupBy columns withGroupBy(Collection),
      (2) then turn on the global group by data expand withGroupByDataExpanded(boolean),
      (3) and finally set the expand level withExpandedGroups(Collection).
      (!) No support for setting a level which is nested.
      Example:
      
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
      
           resultMatrix
                .withRows(entries)
                .withGroupBy(['TextColumn1', 'TextColumn2', 'NumericColumn3'])
                // The global expand group by data is turn off by default, thus needs to be turn on first
                // before setting the group by data expand level
                .withGroupByDataExpanded(true)
                .withExpandedGroups(['TextColumn1', 'TextColumn2'])
      
           // TextColumn1, TextColumn2 and NumericColumn3 are columns by which the grouping will be done
           // group by data will be expanded in two levels: TextColumn1 and TextColumn2
      
           // The expandedGroups columns can be accessed by getExpandedGroups()
           def expandedGroups = resultMatrix.getExpandedGroups()
      
       
      Parameters:
      columns - collection of columns' names for expand level while grouping, if null the ResultMatrixGroupingException.NullException will be thrown.
      Returns:
      ResultMatrix with expandedGroups columns' names.
      Since:
      14.0 - Caribou Lou
      See Also:
    • withColumnAggregation

      ResultMatrix withColumnAggregation(String numericColumn, ResultMatrixGrouping.AggregateFunctionType aggregateFunctionType)
      Aggregation strategy definition done by column-name-holding-numeric-values only (numericColumn) and aggregation type (aggregateFunctionType). Static import allowing for enum recognition is needed here: ResultMatrixGrouping.AggregateFunctionType. Aggregation type can be set by one of the AggregateFunctionTypes: AVG, SUM, COUNT, MAX or MIN

      Example:

      
           // static import is needed to use predefined enum with aggregation type
           import static net.pricefx.server.dto.calculation.ResultMatrixGrouping.AggregateFunctionType.SUM
      
           // ResultMatrix with predefined columns, entries and groupBy columns
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
           resultMatrix.withRows(entries)
           resultMatrix.withGroupBy(['TextColumn1', 'TextColumn2'])
      
           resultMatrix.withColumnAggregation('NumericColumn3', SUM])
      
       
      Parameters:
      numericColumn - column with numeric data to proceed aggregation. If column contains non-numeric data or is not present in ResultMatrix's columns collection, the ResultMatrixGroupingException.NotPartOfColumnsAttributeException will be thrown
      aggregateFunctionType - predefined aggregation type: AggregateFunctionType.AVG, AggregateFunctionType.SUM, AggregateFunctionType.COUNT, AggregateFunctionType.MAX or AggregateFunctionType.MIN
      Returns:
      ResultMatrix with aggregation strategy updated
      Since:
      12.0 - Clover Club
      See Also:
    • withColumnAggregation

      ResultMatrix withColumnAggregation(String column, Object aggregateValue)
      Aggregation strategy definition done by column name and aggregation value (ex. some constant String). Aggregation value can be set as any Object.

      Example:

      
           // ResultMatrix with predefined columns, entries and groupBy columns
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
           resultMatrix.withRows(entries)
           resultMatrix.withGroupBy(['TextColumn1', 'TextColumn2'])
      
           resultMatrix.withColumnAggregation('TextColumn1', 'some text'])
      
       
      Parameters:
      column - column name, needs to be part of the ResultMatrix columns attribute
      aggregateValue - any object, which will be presented in the groupBy record
      Since:
      12.0 - Clover Club
      See Also:
    • withColumnAggregations

      ResultMatrix withColumnAggregations(Map<String,Object> columnAggregations)
      Aggregation strategy definition done by Map with numeric columns' name and aggregation type or value. Aggregation value can be set as any Object or aggregation function ResultMatrixGrouping.AggregateFunctionType (AVG, SUM, COUNT, MAX or MIN)

      Example:

      
           // static import is needed to use predefined enum with aggregation types
           import static net.pricefx.server.dto.calculation.ResultMatrixGrouping.AggregateFunctionType.SUM
      
           // ResultMatrix with predefined columns, entries and groupBy columns
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
           resultMatrix.withRows(entries)
           resultMatrix.withGroupBy(['TextColumn1', 'TextColumn2'])
      
           // Key in the columnAggregations needs to be the column's name which contains only numbers
           // Value in the columnAggregations can be any object or one of the AggregateFunctionType enum
           resultMatrix.withColumnAggregation([NumericColumn3 : SUM])
      
       
      Parameters:
      columnAggregations - Map with numeric-column-name and aggregation type or value
      Returns:
      ResultMatrix with aggregation strategy updated
      Since:
      12.0 - Clover Club
      See Also:
    • calculateGroupByData

      ResultMatrix calculateGroupByData()
      Proceed grouping with groupBy columns (if missing ResultMatrixGroupingException.NullOrEmptyException is thrown) for numeric columns and aggregation strategy passed by withColumnAggregation(String, Object) or withColumnAggregation(String, AggregateFunctionType) or withColumnAggregations(Map). If AggregateType has one of the predefined keywords (ie.: SUM, AVG, COUNT, MAX or MIN), the numeric operation will be proceeded on the numeric columns. This is terminal operation, which means, it needs to be called as the last one (after setting columns and groupBy)

      Example:

      
           // (1) static import is needed to use predefined enum with aggregation types
           import static net.pricefx.server.dto.calculation.ResultMatrixGrouping.AggregateFunctionType.SUM
      
           // (2) new ResultMatrix with predefined columns
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
      
           // (3) add entries to the above ResultMatrix
           resultMatrix.withRows(entries)
      
           // (4) set groupBy columns, which needs to be a part of columns' collection from (1)
           resultMatrix.withGroupBy(['TextColumn1', 'TextColumn2'])
      
           // (5) set aggregation strategy for numericColumn3 as SUM, numericColumn3 needs to contains only numbers
           resultMatrix.withColumnAggregation('NumericColumn3', SUM)
      
           // (6) do the grouping and aggregation calculations, which also adds data to groupByData ResultMatrix property
           resultMatrix.calculateGroupByData()
      
           // (7) grouped and aggregated data can be accessed by the getter
           def groupByData = resultMatrix.getGroupByData()
      
           // Other getters allow for access to groupBy columns and aggregation strategy
           def groupByColumns = resultMatrix.getGroupBy()
           def aggregationStrategy = resultMatrix.getAggregationStrategy()
      
       
      
           // All operations can be chained to get the final groupBy data
           import static net.pricefx.server.dto.calculation.ResultMatrixGrouping.AggregateFunctionType.SUM
      
           def groupByData = api.newMatrix()
                   .withColumns('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
                   .withRows(entries)
                   .withGroupBy(['TextColumn1', 'TextColumn2'])
                   .withColumnAggregation('NumericColumn3', SUM)
                   .calculateGroupByData()
                   .getGroupByData()
       
      Note: When no rows (empty entries) are defined then the empty ResultMatrix is created.
      When aggregated rows are null the RESULT_MATRIX_NULL_ENTRIES_EXCEPTION exception is thrown.
      Returns:
      ResultMatrix with grouped and aggregated data (can be accessed by getGroupByData()
      Since:
      12.0 - Clover Club
      See Also:
    • withGroupByDataExpanded

      ResultMatrix withGroupByDataExpanded(boolean isGroupByDataExpanded)
      Definition of global group by data expand. Default value is false, which means group by data are collapsed. If set to true then all group by data are expanded. The expanded level can be limited by withExpandedGroups(Collection)

      Example:

      
           def resultMatrix = api.newMatrix('TextColumn1', 'TextColumn2', 'NumericColumn3', 'NumericColumn4')
           resultMatrix.withRows(entries)
                .withGroupBy(['TextColumn1', 'TextColumn2', 'NumericColumn3'])
                .withGroupByDataExpanded(true)
      
        // ResultMatrix with global groupBy data expand set to true, then all groupBy data are expanded
        // getExpandedGroups() is equal to getGroupBy()
      
      
       
      Parameters:
      isGroupByDataExpanded - global flag to turn on true or off false (default behaviour).
      Returns:
      ResultMatrix with global expand group by data set.
      Since:
      14.0 - Caribou Lou
      See Also:
    • withEnableGroupByControls

      ResultMatrix withEnableGroupByControls(boolean enableGroupByControls)
      Enables or disables the "Group by" controls.

      Allows you to specify whether the user can change the "Group by" controls.
      If disabled, the user will see that the data in the matrix is grouped, but will not be able to change the grouping settings.
      This is useful when the grouping is defined by the logic and cannot be changed by the end user – while still informing the user which columns are used for grouping.
      Example:

      
        def groupByData = api.newMatrix()
            .withColumns(["∑Base", "∑Costs", "Invoice Line ID", "Country"])
            .withGroupBy(["Country", "Invoice Line ID"])
            .withEnableGroupByControls(false) // Expected result: Group By columns are disabled.
       
      The Group by controls are displayed, but cannot be changed:
      Parameters:
      enableGroupByControls - boolean value turning on or off the controls
      Returns:
      ResultMatrix with new value for enableGroupByControls.
      Since:
      13.0 - Rampur
      See Also:
    • isEnableGroupByControls

      boolean isEnableGroupByControls()
      Returns true (default) if "Group by" controls are enabled and false when they are disabled.

      Allows you to determine if the "Group By" controls are activated. If the controls are deactivated, the user will be aware of the grouping but will not be able to change it.
      Example:

      
        def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity'])
            .withEnabledControls(false)
      
        resultMatrix.isControlsEnabled() == false
       
      Returns:
      boolean value true if "Group By" controls are enabled (default), or false if they are disabled.
      Since:
      13.0 - Rampur
      See Also:
    • withShowGroupByControls

      ResultMatrix withShowGroupByControls(boolean showGroupByControls)
      Sets whether "Group by" controls are completely hidden.

      To show "Group By" controls without allowing a user to change the Group By setting, use the withEnableGroupByControls(boolean) method.
      Can be enabled only if isEnableGroupByControls() is true.
      Use case: "Group By" is defined by the logic to allow for some formatting, and the CE wants to use Group By feature without letting the end user know that the "Group By" has been applied.
      Example:

      
        def groupByData = api.newMatrix()
            .withColumns(["∑Base", "∑Costs", "Invoice Line ID", "Country"])
            .withGroupBy(["Country", "Invoice Line ID"])
            .withShowGroupByControls(false) // Expected result: Group by controls are hidden.
       
      The Group by controls are not displayed in the table:
      Parameters:
      showGroupByControls - boolean value turning on or off the Group By controls
      Returns:
      ResultMatrix with new value for showGroupByControls
      Since:
      13.0 - Rampur
      See Also:
    • isShowGroupByControls

      boolean isShowGroupByControls()
      Returns true (default) if "Group by" controls are shown and false when they are hidden.

      Allows you to check if the "Group By" controls are enabled and visible to the end user. If the controls are disabled, they will be completely hidden and unchangeable by the end user.
      Example:

      
        def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity'])
            .withShowGroupByControls(false)
      
        resultMatrix.isGroupByControlsShown() == false
       
      Returns:
      boolean value true if "Group By" controls are enabled and visible (default), or false if they are hidden.
      Since:
      13.0 - Rampur
      See Also:
    • withShowGroupByColumns

      ResultMatrix withShowGroupByColumns(boolean showGroupByColumns)
      Sets the visibility of the Group By columns in the ResultMatrix.

      Group by columns are visible by default. This method allows you to hide these columns.

      Example:

      
       def groupByData = api.newMatrix()
            .withColumns(["∑Base", "∑Costs", "Invoice Line ID", "Country"])
            .withGroupBy(["Country", "Invoice Line ID"])
            .withShowGroupByColumns(false) // Expected result: Group By columns are automatically hidden.
       
      Group By columns are hidden:
      Parameters:
      showGroupByColumns - A flag to turn on or off the visibility of the Group By columns.
      Returns:
      ResultMatrix with updated value for showGroupByColumns
      Since:
      13.0 - Rampur
      See Also:
    • isShowGroupByColumns

      boolean isShowGroupByColumns()
      Returns true if "Group by" columns are shown and false when they are hidden.

      Example:

      
        def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity'])
            .withShowGroupByColumns(false)
      
       resultMatrix.isGroupByColumnsShown() == false
       
      Returns:
      boolean value true if the Group by columns are shown (default) or false when they are hidden.
      Since:
      13.0 - Rampur
      See Also:
    • isGroupByDataExpanded

      boolean isGroupByDataExpanded()
      Returns:
      the global group by data expand flag.
      Since:
      14.0 - Caribou Lou
      See Also:
    • withGroupByColumnLabel

      ResultMatrix withGroupByColumnLabel(String groupByColumnLabel)
      Sets a custom label for the Group column in the ResultMatrix table.

      Allows you to change the label of the grouping column from "Group" (default) to a custom label.
      Use the getGroupByColumnLabel() to retrieve the custom label.

      Example:

      
       def groupByData = api.newMatrix()
            .withColumns(["∑Base", "∑Costs", "Invoice Line ID", "Country"])
            .withGroupBy(["Country", "Invoice Line ID"])
            .withGroupByColumnLabel('Custom Label') // sets the Group column label to "Custom Label"
       
      The "Group" column changed to "Custom Label":
      Parameters:
      groupByColumnLabel - The custom label for the Group By column.
      Returns:
      ResultMatrix with the updated Group By column label.
      Since:
      13.0 - Rampur
      See Also:
    • getGroupByColumnLabel

      String getGroupByColumnLabel()
      Retrieves the custom label for the Group column.

      Returns the label that was set for the "Grouping column" using the withGroupByColumnLabel(String) method.

      Example:

      
        def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity'])
            .withGroupByColumnLabel('myLabel')
      
        def GroupByLabel = resultMatrix.getGroupByColumnLabel()
        assert groupByLabel == 'myLabel'
        return GroupByLabel
       
      Returns:
      String The current label for the Group By column.
      Since:
      13.0 - Rampur
      See Also:
    • addRow

      default void addRow(List<Object> row)
      Adds a data row. The order of the values is assumed to be the same as the matrix column order.
      Parameters:
      row - Row as List
    • withRow

      ResultMatrix withRow(List<Object> row)
      Adds a data row. The order of the values is assumed to be the same as the matrix column order.
      Parameters:
      row - Row as List
    • withRows

      ResultMatrix withRows(List<Map<String,Object>> rows)
      Adds multiple data rows. The keys of the row-map should match the column names defined earlier
      Parameters:
      rows - Row as List of Maps
    • addRow

      void addRow(Object... values)
      Adds a data row. The order of the values is assumed to be the same as the matrix column order.
      Parameters:
      values - Row as Array
    • getColumns

      List<String> getColumns()
      Gets a list of defined columns
      Returns:
      The columns
    • getFrozenColumns

      List<String> getFrozenColumns()
      Retrieves a list containing the names of columns that are currently set as frozen.
      Returns:
      The frozen columns list
    • getEntries

      List<Map<String,Object>> getEntries()
      Returns the current list entries as a list (=the rows) of maps (= the row content)
      Returns:
      List of maps
    • findRow

      Map<String,Object> findRow(String key, Object value)
      Retrieves a particular row based on a value check
      Parameters:
      key - The column name to search on
      value - The value to match the row's column value to
      Returns:
      The row
    • transpose

      default ResultMatrix transpose(String newHeaderColumnName)
      Transpose the matrix.



      Example:

       ProductGroup | AvgPrice | AvgMargin <- header row
       -----------------------------------
       Beef     |   4.1€   |   3.6%
       Pork     |   2.2€   |   1.1%
       Lamb     |   4.6€   |   5.2%
       

      Transposed matrix:

       transpose("ProductGroup")
       

      ProductGroup | Beef | Pork | Lamb <- header row --------------------------------- AvgPrice | 4.1€ | 2.2€ | 4.6€ AvgMargin | 3.6% | 1.1% | 5.2%

      Parameters:
      newHeaderColumnName - Name of the column that will become the new header row
      Returns:
      The transposed ResultMatrix (new instance)
    • transpose

      default ResultMatrix transpose(String newHeaderColumnName, String oldColLabelsInNewColumnName)
      Transpose the matrix.



      Example:

       ProductGroup | AvgPrice | AvgMargin  <- header row
       ------------------------------------
       Beef     |   4.1€   |   3.6%
       Pork     |   2.2€   |   1.1%
       Lamb     |   4.6€   |   5.2%
       

      Transposed matrix:

       transpose("ProductGroup", "PG Label")
       

      Beef | Pork | Lamb | PG Label <- header row ----------------------------------- Beef | Pork | Lamb | ProductGroup 4.1€ | 2.2€ | 4.6€ | AvgPrice 3.6% | 1.1% | 5.2% | AvgMargin

      Parameters:
      newHeaderColumnName - Name of the column that will become the new header row
      oldColLabelsInNewColumnName - Name of the new column that will receive the old column headers as values (optional)
      Returns:
      The transposed ResultMatrix (new instance)
    • toMatrix2D

      default Matrix2D toMatrix2D()
    • setDefaultFormat

      default void setDefaultFormat(FieldFormatType fft)
      Sets a default column format
      Parameters:
      fft -
    • withDefaultFormat

      ResultMatrix withDefaultFormat(FieldFormatType fft)
      Sets a default column format
      Parameters:
      fft -
    • getDefaultFormat

      FieldFormatType getDefaultFormat()
      Gets the default format
      Returns:
      Default format
    • getColumnFormats

      Map<String,FieldFormatType> getColumnFormats()
      Gets individual column formats (if specified)
      Returns:
      A Map with column name and format
    • setColumnFormat

      default void setColumnFormat(String column, FieldFormatType fft)
      Sets a column format for a specified column. Consider using withColumnFormats(Map) instead of setColumnFormat() where applicable.
      Parameters:
      column - The column name
      fft - The format
    • withColumnFormat

      ResultMatrix withColumnFormat(String column, FieldFormatType fft)
      Sets a column format for a specified column
      Parameters:
      column - The column name
      fft - The format
    • withColumnFormats

      default ResultMatrix withColumnFormats(Map<String,FieldFormatType> columnFormats)
      Sets a column formats for multiple columns. Adds a column if not existing yet.
      Example – Creates (and returns) a new ResultMatrix object with specified columns and sets the format type of each column using withColumnFormats(). Adds rows using the api.find().:
      
       def products = api.find("P", 0, 10, null, ["sku", "label", "currency"])
      
       def resultMatrix = api.newMatrix().withColumnFormats([
       "sku" : FieldFormatType.TEXT,
       "label" : FieldFormatType.TEXT,
       "currency": FieldFormatType.TEXT
       ]).withRows(products);
       
      Parameters:
      columnFormats - A key-value map of columnName:FieldFormatType
      See Also:
    • getColumnTooltips

      Map<String,String> getColumnTooltips()
      Gets the currently assigned column tooltips
      Returns:
    • setColumnTooltip

      default void setColumnTooltip(String column, String tooltip)
      Adds a tooltip to a column
      Parameters:
      column - The column name
      tooltip - The tooltip text
    • withColumnTooltip

      ResultMatrix withColumnTooltip(String column, String tooltip)
      Adds a tooltip to a column
      Parameters:
      column - The column name
      tooltip - The tooltip text
    • isEnableClientFilter

      boolean isEnableClientFilter()
    • setEnableClientFilter

      default void setEnableClientFilter(boolean enableClientFilter)
    • withEnableClientFilter

      ResultMatrix withEnableClientFilter(boolean enableClientFilter)
    • styledCell

      ResultMatrix.StyledCell styledCell(Object value)
      Creates a styled cell that can then be added as row value
      Parameters:
      value - The value of the cell
      Returns:
      The styled cell object that can then be further styled with e.g. the flow pattern .withXXX() methods
    • styledCell

      ResultMatrix.StyledCell styledCell(Object value, String textColor, String bgColor)
      Creates a styled cell that can then be added as row value
      Parameters:
      value - The value of the cell
      textColor - The text color of the cell
      bgColor - The background color of the cell (HTML hex value)
      Returns:
      The styled cell object
    • styledCell

      ResultMatrix.StyledCell styledCell(Object value, String textColor, String bgColor, String weight)
      Creates a styled cell that can then be added as row value
      Parameters:
      value - The value of the cell
      textColor - The text color of the cell
      bgColor - The background color of the cell (HTML hex value)
      weight - The font weight
      Returns:
      The styled cell object
    • styledCell

      ResultMatrix.StyledCell styledCell(Object value, String textColor, String bgColor, String weight, String alignment)
      Creates a styled cell that can then be added as row value
      Parameters:
      value - The value of the cell
      textColor - The text color of the cell
      bgColor - The background color of the cell (HTML hex value)
      weight - The font weight
      alignment - Cell alignement value (valid CSS)
      Returns:
      The styled cell object
    • imageCell

      ResultMatrix.ImageCell imageCell(Object value)
      Creates an image cell that can then be added as row value. Value should be a valid image URL
      Parameters:
      value - The image URL
      Returns:
      The image cell object
    • libraryImage

      ResultMatrix.ImageCell libraryImage(String mainName, String statusName)
    • linkToPriceGrid

      default ResultMatrix.LinkCell linkToPriceGrid(Object value, long priceGridID, Filter filter)
    • linkToPriceList

      default ResultMatrix.LinkCell linkToPriceList(Object value, long priceListID, Filter filter)
    • linkToPriceParameter

      default ResultMatrix.LinkCell linkToPriceParameter(Object value, long priceParameterID)
    • linkCell

      ResultMatrix.LinkCell linkCell(Object value, String targetPage, Object targetPageState)
    • linkButtonCell

      ResultMatrix.LinkButtonCell linkButtonCell(Object value, String targetPage, Object targetPageState, Object buttonState)
      Displays a button inside a cell of the table.

      Simple button example:

      
           def targetPageState = [quoteType: 'Quote with Inputs in Header', Customer: 'custId']
           def cell = matrix.linkButtonCell('New Quote', AppPages.QC_NEW_QUOTE, targetPageState, null)
           matrix.addRow('Customer A', 'Value X', cell)
       

      Advanced button example:

      
           def customerPageState = [Customer: 'custId']
           def groupPageState = [customerFieldName:'customerId', customerFieldValue:custId]
           def builder = api.inputBuilderFactory()
                            .createQuoteType("New quote")
                            .buildContextParameter()
           def cell = matrix.linkButtonCell('cell value' /*not displayed*/, AppPages.QC_NEW_QUOTE, groupPageState, builder)
           matrix.addRow('Customer A', 'Value X', cell)
       

      Note: This is available in Unity UI only. No backporting planned for the Classic UI.

      Since:
      9.0 Hurricane
    • backEndAction

      ResultMatrix.BackEndCell backEndAction(String label, String url, String payload, String successMessage, String failMessage)
    • rowSelectionBackEndAction

      ResultMatrix.BackEndAction rowSelectionBackEndAction(String id)

      Allows UI users to select multiple rows and adds an action button next to the ResultMatrix. Multiple such action buttons can be defined, identified by the provided id String.

      The action will be handled by a dedicated logic, which receives an InputMatrix parameter named after the provided id and featuring the row values of a subset of the columns.

      Example:

      
           def matrix = api.newMatrix("col1", "col2", "col3")
           matrix.addRow(1, "a", "f")
           matrix.addRow(2, "b", "g")
           matrix.rowSelectionBackEndAction("actionId")
                       .withLogicName("action_handler")
                       .withColumns("col2", "col3")
                       .withButtonLabel("Click here")
                       .withSuccessMessage("Success")
                       .withFailureMessage("Sorry")
      
       

      Note: This is available in Unity UI only. No backporting planned for the Classic UI.

      See ResultMatrix.BackEndAction to explore the full list of methods allowing to configure an action.

      Parameters:
      id - a String identifying the action
      Returns:
      a customizable object representing an action button, which the UI will then render and make functional
      Since:
      7.0 Bijou
    • downloadButton

      ResultMatrix.DownloadCell downloadButton(String label, String url, String payload)
    • cells

      ResultMatrix.Cells cells(String label, Object... cells)
    • onRowSelection

      ResultMatrix.OnRowSelection onRowSelection()
      Configures a client-side UI event. Use case is usually a refresh of some sort when a result matrix row is selected Example:
      
       matrix.onRowSelection().triggerEvent(api.dashboardWideEvent("CustomerIdChanged-ED")).withColValueAsEventDataAttr("CustomerID", "customerId")
       
      The embedded dashboard that receives the event could then look like:
      
        return api.dashboard("EmbeddedDashboard")
      
          // Here the user can assign values to the embedded
          // dashboard inputs common to all three modes
          .setParam("Customer Id", input."Customer Id")
          .setParam("Year", input.Year)
      
          // Show the dashboard embedded ...
          .showEmbedded()
          // ... and reevaluate it on "CustomerIdChanged-ED"
          // Note: "dashboardWideEvent()" fce makes the event local
          // to the containing dashboard instance
          .andRecalculateOn(api.dashboardWideEvent("CustomerIdChanged-ED"))
          // Pull the "customerId" attribute out of the event payload and expose it
          // as the "Customer Id" input to the embedded dashboard
          .withEventDataAttr("customerId").asParam("Customer Id")
       
      Returns:
      The selection event to further configure it in a flow pattern
    • getResultType

      default String getResultType()
      Specified by:
      getResultType in interface ComplexCalculationResult
    • addFormatsToResultMatrix

      void addFormatsToResultMatrix()
    • normalizeDateTimes

      void normalizeDateTimes()
      Search for non null FieldFormatType.DATETIME columns and convert them into DateTime