Interface ResultMatrix
- All Superinterfaces:
AppPages
,ComplexCalculationResult
,Portlet
,Serializable
- All Known Implementing Classes:
ResultMatrix
- Author:
- cat
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Object representing a button that handles multi-row actions.static interface
Create a link/button that should do some desired action to pricefx backend (unity only) [url:"pricelistmanager.revoke..../...", payload: [...static interface
static interface
List of other cells (to be shown as dropdown inline)static interface
Create a link/button that should do initiate download from pricefx backend (unity only) [url:"pricelistmanager.fetchpdf..../...", payload: [...static interface
static interface
static interface
static interface
static interface
-
Field Summary
Fields inherited from interface AppPages
CM_MAIN_PAGE, CM_RECORDS_PAGE, CM_TYPES_PAGE, CONFIG_WIZARDS_PAGE, CUSTOM_FORMS_NEW, CUSTOM_FORMS_PAGE, CUSTOM_FORMS_TYPE_PAGE, DB_DASHBOARDS_PAGE, DP_PAGE, DP_TYPES_PAGE, MD_BOM_PAGE, MD_COMPETITION_PAGE, MD_CUSTOMERS_PAGE, MD_CX_PAGE, MD_DCR_PAGE, MD_PP_PAGE, MD_PRODUCTS_PAGE, MD_PX_PAGE, MD_SELLER_EXTENSIONS_PAGE, MD_SELLERS_PAGE, MD_WIZARD_PAGE, PA_CHART_BARLINE_PAGE, PA_CHART_BOXPLOT_PAGE, PA_CHART_BUBBLE_PAGE, PA_CHART_COMPARISONWF_PAGE, PA_CHART_DATATABLE_PAGE, PA_CHART_DETAILEDTIME_PAGE, PA_CHART_HEATMAP_PAGE, PA_CHART_HISTOGRAM_PAGE, PA_CHART_PAGE, PA_CHART_PIE_PAGE, PA_CHART_SCATTER_PAGE, PA_CHART_TIMESCATTER_PAGE, PA_CHART_TIMESERIES_PAGE, PA_CHART_WATERFALL_PAGE, PA_DATASOURCES_PAGE, PA_ROLLUPS_PAGE, PB_LPG_PAGE, PB_MPL_PAGE, PB_PL_PAGE, PB_SIMULATION_PAGE, PM_CONTRACTS_PAGE, PM_NEW_CONTRACT, PO_NEW_MODEL, QC_DETAILS_PAGE, QC_NEW_QUOTE, QC_TYPES_PAGE, RM_DETAILS_PAGE, RM_MAIN_PAGE, RM_NEW_REBATE_AGREEMENT, RM_RECORDS_PAGE, RM_TEMPLATES_PAGE, SC_ACCRUAL_RECORDS_PAGE, SC_CALCULATIONS_PAGE, SC_COMPENSATION_RECORDS_PAGE, SC_COMPENSATION_TYPES_PAGE, SC_CONDITION_TYPES_PAGE, SC_NEW_PLAN, SC_PLANS_PAGE, SELLER_EXTENSIONS_PAGE, SELLERS_PAGE, USER_ACTIONS_PAGE, USER_NEW_ACTION_PAGE
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Adds a column to the existing set of columnsdefault void
Adds a column to the existing set of columns including a tooltipdefault void
addColumns
(Collection<String> columns) Adds columns to the existing set of columnsdefault void
addColumnTranslation
(String column, Map<String, String> translations) Adds translated labels for the given column.void
void
Adds a data row.default void
Adds a data row.void
Adds a data row.Proceed grouping with groupBy columns (if missingResultMatrixGroupingException.NullOrEmptyException
is thrown) for numeric columns and aggregation strategy passed bywithColumnAggregation(String, Object)
orwithColumnAggregation(String, AggregateFunctionType)
orwithColumnAggregations(Map)
.downloadButton
(String label, String url, String payload) Retrieves a particular row based on a value checkGets individual column formats (if specified)Gets a list of defined columnsGets the currently assigned column tooltipsGets current column translations in raw formatGets the default formatReturns the current list entries as a list (=the rows) of maps (= the row content)Gets a list of frozen columnsExample:Gets the preference namedefault String
getTitle()
Gets the current titleRetrieves a value assigned to thetotalRow
property within the ResultMatrix.Creates an image cell that can then be added as row value.boolean
boolean
Default value (if not specified) istrue
Example:boolean
Is HTML escaping enabled?boolean
Tells whether saving of matrix grid preferences is disabled.boolean
Default value (if not specified) istrue
Example:boolean
Default value (if not specified) istrue
Example:boolean
UI sorting of matrix gridlibraryImage
(String mainName, String statusName) linkButtonCell
(Object value, String targetPage, Object targetPageState, Object buttonState) Displays a button inside a cell of the table.default ResultMatrix.LinkCell
linkToPriceGrid
(Object value, long priceGridID, Filter filter) default ResultMatrix.LinkCell
linkToPriceList
(Object value, long priceListID, Filter filter) default ResultMatrix.LinkCell
linkToPriceParameter
(Object value, long priceParameterID) void
Search for non nullFieldFormatType.DATETIME
columns and convert them intoDateTime
Configures a client-side UI event.Allows UI users to select multiple rows and adds an action button next to the ResultMatrix.default void
setColumnFormat
(String column, FieldFormatType fft) Sets a column format for a specified column.default void
setColumnTooltip
(String column, String tooltip) Adds a tooltip to a columndefault void
Sets a default column formatdefault void
setDisablePreferences
(boolean disablePreferences) Allows to disable saving preferences of the matrix grid (columns, sorting, filtering).default void
setDisableSorting
(boolean disableSorting) Set sorting capability in UI griddefault void
setEnableClientFilter
(boolean enableClientFilter) default void
setEscapeHTML
(boolean escapeHTML) Set HTML escaping flag.default void
setPreferenceName
(String preferenceName) Sets the so-called preference name.default void
Sets the title that will be shown as window title of the result matrix in the clientstyledCell
(Object value) Creates a styled cell that can then be added as row valuestyledCell
(Object value, String textColor, String bgColor) Creates a styled cell that can then be added as row valuestyledCell
(Object value, String textColor, String bgColor, String weight) Creates a styled cell that can then be added as row valueCreates a styled cell that can then be added as row valuedefault Matrix2D
default ResultMatrix
Transpose the matrix.default ResultMatrix
Transpose the matrix.withColumn
(String column) Adds a column to the existing set of columnswithColumn
(String column, String tooltip) Adds a column to the existing set of columns including a tooltipwithColumnAggregation
(String column, Object aggregateValue) Aggregation strategy definition done by column name and aggregation value (ex.withColumnAggregation
(String numericColumn, ResultMatrixGrouping.AggregateFunctionType aggregateFunctionType) Aggregation strategy definition done by column-name-holding-numeric-values only (numericColumn) and aggregation type (aggregateFunctionType).withColumnAggregations
(Map<String, Object> columnAggregations) Aggregation strategy definition done by Map with numeric columns' name and aggregation type or value.withColumnFormat
(String column, FieldFormatType fft) Sets a column format for a specified columndefault ResultMatrix
withColumnFormats
(Map<String, FieldFormatType> columnFormats) Sets a column formats for multiple columns.withColumns
(Collection<String> columns) Adds columns to the existing set of columnswithColumnTooltip
(String column, String tooltip) Adds a tooltip to a columnwithColumnTranslation
(String column, Map<String, String> translations) Adds translated labels for the given column.Sets a default column formatwithDisablePreferences
(boolean disablePreferences) Allows to disable saving preferences of the matrix grid (columns, sorting, filtering).withDisableSorting
(boolean disableSorting) Set sorting capability in UI gridwithEnableClientFilter
(boolean enableClientFilter) withEnableGroupByControls
(boolean enableGroupByControls) Turn on / off the controls globally.
Example:withEscapeHTML
(boolean escapeHTML) Set HTML escaping flag.withFrozenColumns
(Collection<String> frozenColumns) Define columns as frozen.withGroupBy
(Collection<String> columns) Definition of columns' names dedicated for grouping.withGroupByColumnLabel
(String groupByColumnLabel) Set group by columns labelwithPreferenceName
(String preferenceName) Sets the so-called preference name.Adds a data row.Adds multiple data rows.withShowGroupByColumns
(boolean showGroupByColumns) Turn on / off group by columns visibility (enabled by default)
Example:withShowGroupByControls
(boolean showGroupByControls) Sets the title that will be shown as window title of the result matrix in the clientwithTotalRow
(Object totalRow) Assigns any data to thetotalRow
property within the ResultMatrix.Methods inherited from interface Portlet
withDragDrop, withHeight, withHeight, withLayout, withLayout, withResizing, withWidth, withWidth
-
Method Details
-
getTitle
String getTitle()Gets the current title- Returns:
- The current title
-
setTitle
Sets the title that will be shown as window title of the result matrix in the client- Parameters:
title
- The title
-
withTitle
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
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
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
Set HTML escaping flag. Default: false (i.e. values will be interpreted as HTML)- Parameters:
escapeHTML
-
-
setPreferenceName
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
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
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
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
Gets current column translations in raw format- Returns:
-
addColumn
Adds a column to the existing set of columns- Parameters:
column
- The columns name
-
withColumn
Adds a column to the existing set of columns- Parameters:
column
- The columns name
-
addColumn
Adds a column to the existing set of columns including a tooltip- Parameters:
column
- The columns name
-
withColumn
Adds a column to the existing set of columns including a tooltip- Parameters:
column
- The columns name
-
addColumns
Adds columns to the existing set of columns- Parameters:
columns
- Collection of columns names
-
withColumns
Adds columns to the existing set of columns- Parameters:
columns
- Collection of columns names
-
withFrozenColumns
Define columns as frozen. New call of the method will replace the values from a previous call. The duplications are skipped
The frozen columns collection needs to be a part of the ResultMatrix's columns (if not the exception is thrown)Example:
def resultMatrix = api.newMatrix() .withColumns('Column1', 'Column2', 'Column3') .withFrozenColumns('Column1') //Column1 will be frozen in UI
- Parameters:
frozenColumns
- collection of columns' name- Returns:
ResultMatrix
with frozenColumns collection- Throws:
ResultMatrixGroupingException.NotPartOfColumnsAttributeException
- IffrozenColumns
are not part theResultMatrix
's columns property- Since:
- 13.0 - Rampur
- See Also:
-
addRow
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 thetotalRow
property within the ResultMatrix.- Returns:
- totalRow An Object representing the
totalRow
value assigned by thewithTotalRow
method. - Since:
- 13.0 - Rampur
- See Also:
-
withTotalRow
Assigns any data to thetotalRow
property within the ResultMatrix. Uses the same format as a standard ResultMatrix row, you can also use a styled cell usingstyledCell()
.Enables you to add, for example, SUM calculations into this row.
Note: Multiple calls ofwithTotalRow(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 updatedtotalRow
value.- Since:
- 13.0 - Rampur
- See Also:
-
getGroupBy
- Returns:
- immutable list of columns' names dedicated for grouping
- Since:
- 12.0 - Clover Club
- See Also:
-
getGroupByData
- Returns:
- immutable collection of data grouped by predefined columns
- Since:
- 12.0 - Clover Club
- See Also:
-
getAggregationStrategy
- Returns:
- immutable Map of numeric column's name with aggregation value assigned to it
- Since:
- 12.0 - Clover Club
- See Also:
-
withGroupBy
Definition of columns' names dedicated for grouping. Columns passed in the collection need to be present inResultMatrix
columns' attribute. If, at least one column, is not part of theResultMatrix
columns' attribute, theResultMatrixGroupingException.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 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 theResultMatrixGroupingException.NullOrEmptyException
will be thrown.- Returns:
ResultMatrix
with groupBy columns.- Since:
- 12.0 - Clover Club
- 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 MINExample:
// 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 inResultMatrix
's columns collection, theResultMatrixGroupingException.NotPartOfColumnsAttributeException
will be thrownaggregateFunctionType
- 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
Aggregation strategy definition done by column name and aggregation value (ex. some constantString
). Aggregation value can be set as anyObject
.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 attributeaggregateValue
- any object, which will be presented in the groupBy record- Since:
- 12.0 - Clover Club
- See Also:
-
withColumnAggregations
Aggregation strategy definition done by Map with numeric columns' name and aggregation type or value. Aggregation value can be set as anyObject
or aggregation functionResultMatrixGrouping.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 missingResultMatrixGroupingException.NullOrEmptyException
is thrown) for numeric columns and aggregation strategy passed bywithColumnAggregation(String, Object)
orwithColumnAggregation(String, AggregateFunctionType)
orwithColumnAggregations(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()
ResultMatrix
is created.
When aggregated rows arenull
theRESULT_MATRIX_NULL_ENTRIES_EXCEPTION
exception is thrown.- Returns:
ResultMatrix
with grouped and aggregated data (can be accessed bygetGroupByData()
- Since:
- 12.0 - Clover Club
- See Also:
-
withEnableGroupByControls
Turn on / off the controls globally.
Example:return api.newMatrix(['Tier', 'Item', 'Quantity']) .withEnabledControls(false)
- 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()Default value (if not specified) istrue
Example:def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity']) .withEnabledControls(false) resultMatrix.isControlsEnabled() == false
- Returns:
boolean
valuetrue
if controls are enabled (default value) orfalse
if not- Since:
- 13.0 - Rampur
- See Also:
-
withShowGroupByControls
Turn on / off group by controls.
Can be enabled only ifisEnableGroupByControls()
istrue
Example:return api.newMatrix(['Tier', 'Item', 'Quantity']) .withShowGroupByControls(false)
- 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()Default value (if not specified) istrue
Example:def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity']) .withShowGroupByControls(false) resultMatrix.isGroupByControlsShown() == false
- Returns:
boolean
valuetrue
if group by controls are enabled (default value) orfalse
if not- Since:
- 13.0 - Rampur
- See Also:
-
withShowGroupByColumns
Turn on / off group by columns visibility (enabled by default)
Example:return api.newMatrix(['Tier', 'Item', 'Quantity']) .withShowGroupByColumns(false)
- Parameters:
showGroupByColumns
- flag turning on or off the group by columns- Returns:
ResultMatrix
with new value for showGroupByColumns- Since:
- 13.0 - Rampur
- See Also:
-
isShowGroupByColumns
boolean isShowGroupByColumns()Default value (if not specified) istrue
Example:def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity']) .withShowGroupByColumns(false) resultMatrix.isGroupByColumnsShown() == false
- Returns:
boolean
valuetrue
if group by columns are shown (default value) orfalse
if not- Since:
- 13.0 - Rampur
- See Also:
-
withGroupByColumnLabel
Set group by columns label
Example:
return api.newMatrix(['Tier', 'Item', 'Quantity']) .withGroupByColumnLabel('mySuperLabel')
- Parameters:
groupByColumnLabel
- custom label for the group by column- Returns:
ResultMatrix
with new value for groupByColumnLabel- Since:
- 13.0 - Rampur
- See Also:
-
getGroupByColumnLabel
String getGroupByColumnLabel()Example:def resultMatrix = api.newMatrix(['Tier', 'Item', 'Quantity']) .withGroupByColumnLabel('myLabel') resultMatrix.getGroupByColumnLabel() == 'myLabel'
- Returns:
String
value of group by column label- Since:
- 13.0 - Rampur
- See Also:
-
addRow
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
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
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
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
Gets a list of defined columns- Returns:
- The columns
-
getFrozenColumns
Gets a list of frozen columns- Returns:
- The frozen columns list
-
getEntries
Returns the current list entries as a list (=the rows) of maps (= the row content)- Returns:
- List of maps
-
findRow
Retrieves a particular row based on a value check- Parameters:
key
- The column name to search onvalue
- The value to match the row's column value to- Returns:
- The row
-
transpose
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
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 rowoldColLabelsInNewColumnName
- Name of the new column that will receive the old column headers as values (optional)- Returns:
- The transposed ResultMatrix (new instance)
-
toMatrix2D
-
setDefaultFormat
Sets a default column format- Parameters:
fft
-
-
withDefaultFormat
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
Sets a column format for a specified column. Consider usingwithColumnFormats(Map)
instead of setColumnFormat() where applicable.- Parameters:
column
- The column namefft
- The format
-
withColumnFormat
Sets a column format for a specified column- Parameters:
column
- The column namefft
- The format
-
withColumnFormats
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
Gets the currently assigned column tooltips- Returns:
-
setColumnTooltip
Adds a tooltip to a column- Parameters:
column
- The column nametooltip
- The tooltip text
-
withColumnTooltip
Adds a tooltip to a column- Parameters:
column
- The column nametooltip
- The tooltip text
-
isEnableClientFilter
boolean isEnableClientFilter() -
setEnableClientFilter
default void setEnableClientFilter(boolean enableClientFilter) -
withEnableClientFilter
-
styledCell
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
Creates a styled cell that can then be added as row value- Parameters:
value
- The value of the celltextColor
- The text color of the cellbgColor
- The background color of the cell (HTML hex value)- Returns:
- The styled cell object
-
styledCell
Creates a styled cell that can then be added as row value- Parameters:
value
- The value of the celltextColor
- The text color of the cellbgColor
- 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 celltextColor
- The text color of the cellbgColor
- The background color of the cell (HTML hex value)weight
- The font weightalignment
- Cell alignement value (valid CSS)- Returns:
- The styled cell object
-
imageCell
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
-
linkToPriceGrid
-
linkToPriceList
-
linkToPriceParameter
-
linkCell
-
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
-
rowSelectionBackEndAction
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 providedid
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
- aString
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
-
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:
The embedded dashboard that receives the event could then look like:matrix.onRowSelection().triggerEvent(api.dashboardWideEvent("CustomerIdChanged-ED")).withColValueAsEventDataAttr("CustomerID", "customerId")
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
- Specified by:
getResultType
in interfaceComplexCalculationResult
-
addFormatsToResultMatrix
void addFormatsToResultMatrix() -
normalizeDateTimes
void normalizeDateTimes()Search for non nullFieldFormatType.DATETIME
columns and convert them intoDateTime
-