Export List View to CSV Action

The Export List View to CSV action enables you to export your data from the Collection Browser widget to the list.csv file. It exports all data in the columns visible in the Collection Browser widget that have a text representation.

Action Definition

Name

Export List View To CSV Action

ID

com.hybris.cockpitng.listview.action.export.csv

Description

It enables you to export your data from the Collection Browser widget to the list.csv file. It exports all data in the columns visible in the Collection Browser widget that have a text representation.

Author

SAP

Action Class Name

DefaultActionRenderer

For more information, see Action Parameters.

Custom Renderer Class Name

Not applicable

Inputs

Not applicable

Outputs

Not applicable

Action Preview

Configuration

The action is dedicated to be used with the Collection Browser widget. You can export all rows on all pages in the Collection Browser widget to the list.csv file. It includes all columns available in the Collection Browser widget. However, columns, baked by a class or bean declaring a renderer when they cannot be written into the list.csv file, are skipped. If there is no configuration of actions applied for the Collection Browser widget, the export is available for all types by default. Bear in mind that the Collection Browser widget's property should be set up to exportColumnsAndData.

You can configure the column delimiter for the list.csv file. You can define a column delimiter that works globally for all types by configuring the local.properties or project.properties file.

The example below shows how to change the value of the column delimiter to , (comma) in the local.properties file:

backoffice.cockpitng.export.csv.action.delimiter=,

In addition, if you want to specify a column delimiter only for certain types, you can specify the value in the cockpit-config.xml file. The configuration in the cockpit-config.xml file has higher priority than the configuration in the local.properties or project.properties file.

The example cockpit-config.xml file below shows how to change the value of the default threshold from 500 to 450 and the default column delimiter from ; (semi-colon) to , (comma). The threshold applies for all Product types and its subtypes if the fallback resolution takes place. The column delimiter applies for the Product type.

<context component="listviewactions" type="Product">
        <y:actions xmlns:y="http://www.hybris.com/cockpit/config/hybris">
            <y:group qualifier="common">
                <y:action action-id="com.hybris.cockpitng.action.delete" property="selectedObjects"/>
                <y:action action-id="com.hybris.cockpitng.listview.action.export.csv" property="exportColumnsAndData">
                    <y:parameter>
                        <y:name>confirmation.threshold</y:name>
                        <y:value>450</y:value>
                    </y:parameter>
                    <y:parameter>
                        <y:name>delimiter</y:name>
                        <y:value>,</y:value>
                    </y:parameter>
                </y:action>
            </y:group>
        </y:actions>
    </context>

Fallback Mechanism

If there is no specific configuration of actions for a given type passed into the Collection Browser View widget, the default resolution mechanism is used:

  1. The configuration for the closest parent type is used if any matching configuration is available. For example, the configuration for the GenericItem might be used for the Product type because of the implemented tree structure that maps inheritance hierarchies.
  2. If no configuration for the parent type is applied, the default configuration is used. By default, the Export List View to CSV action is enabled and configured with the threshold of 500 rows.

Settings

Setting

Type

Default value

Description

confirmation.threshold

java.lang.Integer

500

Defines the number of rows that can be exported to the list.csv file. If this threshold is exceeded, the user needs to confirm execution of the operation. The main reason for limiting the number is an application performance.

delimiter

java.lang.String

 

Defines the column delimiter in the list.csv file.

Security Settings

Setting Type Possible values Default value Description
cockpitng.export.csv.action.input.sanitization.enabled java.lang.Boolean True, false. True. If set to true, input sanitization is enabled. Otherwise, the csv is exported as it is, without any check of its content.
cockpitng.export.csv.action.input.sanitization.mode java.lang.String Trim, prefix. Trim. If set to trim, the input omits all leading characters from the { @, +, -, =, |, % } set. If set to prefix, the input starts with one of the signs from the mentioned set. The whole input is prefixed with the value of the cockpitng.export.csv.action.input.sanitization.prefix setting, or an apostrophe, if none is provided.
cockpitng.export.csv.action.input.sanitization.prefix java.lang.String

' Prefix to use when the prefix sanitization mode is activated.
cockpitng.export.csv.action.delimiter java.lang.String ; and ,  

Defines the column delimiter in the list.csv file.

Dependency

The Export List View To CSV action is designed to be used with the Collection Browser widget.