Data export
Exports data from a table, repeating layout, or list of complex objects to a .xlsx or .csv file format.

Appearance
Color style: The color style for this view.
{Default | Primary | Info | Success | Warning | Danger | Dark}
ButtonColorStyle
Shape style: Rounded, flat or square (default) view shape.
{Default | Rounded | Flat}
ButtonShapeStyle
Size: Size-based styling for this view (default, large, small, extra-small)
{Default | Large | Small | Extra-Small}
ButtonSizeStyle
Outline only: Shows the color-based style of the view only when it is hovered over. Boolean
Icon: Icon name, for example: calendar, clock-o, camera, cloud-upload, bell, info, file-text, etc... Check http://fontawesome.io/icons for a comprehensive list. (Note that the "fa-" prefix is optional) String
Width: The width in px, % or em.\r\nFor example\: 50px, 20%, 0.4em. If no unit is specified, px is assumed. String

Behavior
Target view: Relative path to the table or repeating layout used to populate output file. Overridden if this view is bound to data. String
Export file type: File type to export to
{Microsoft Excel 2007+ file type xlsx | Comma Separated Values file type csv}
ExcelFileType
Default file name: Default name for file. Users will be able to change this when saving. String
Include column headers: If the view is bound to a table, and the Column headers property is empty, the column headers of the bound table are included. If the view is bound to data, the settings in the Column headers property are used as the column headers. Boolean
Tab index: The tabbing sequence index of the form view. Indices start at 1, and can be set sparsely. For example, you can use 1, 5, 10. Integer
Include hidden columns: Include all columns, regardless of visibility status. By default, columns which are not visible will not be included in output file. When the view is populated by bound data, all columns will be included Boolean
Column formatting: Specific config options for exported columns. For more details on formatting strings, visit the following (hyperlinks in documentation)\: https\://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4 ColumnSpec[]
Column headers: The headers of the exported columns. Requires the Include column headers property to be selected. If the view is bound to a table, these headers are used instead of the table column headers. String[]
Column order: The column displaying order in the exported file. This option works only when the view is bound to data. The specified values must match the bound data parameters. String[]

Events
On Load:
Description: Triggers whenever the view is loaded.
Example:
console.log("DataExport loaded")
On Click:
Description: Triggers when button is clicked, before generating output file. If evaluated expression returns false, the click will not genearate a file to save.
Example:
return ${Text1}.isValid();
On Cell Export:
Description: Triggers whenever a cell is exported. Can return a string, number, or boolean to replace cell value, null to cause the exported cell to be blank, or an object containing a format property to override the cells formatting, with an optional value property in the same object to override the exported value of the cell.
Example:
me.setVisible("READONLY")
Context Variables cell
Properties view
table
value
rowIndex
colIndex
Extends:
com.ibm.bpm.coach.CoachView
Methods:

Inherited addClass(name, [replaced])
Add/replace CSS class(es) for this control
NameTypeDefaultDescription
name{string}CSS class name(s) to add to the control. Separate class names by a space if more than one class.
replaced{string}CSS class name(s) to be replaced by the first argument. Separate class names by a space if more than one class.
Example
Button.addClass("green");

click()
Programmatically click the export button

exportFile([targetPath], [format])
Exports a spreadsheet file
NameTypeDefaultDescription
targetPath{?(string|object)}Either path to target control or control view reference. If null or missing, will default to control returned by {@link DataExport#getTargetControl}.
format{?string}File format to output to. Acceptable values incluse 'xlsx' and 'csv'. If null or missing, will default to format returned by {@link DataExport#getFileType}.
Examples
${DataExport1}.exportFile() // exports a spreadsheet using currently set parameters for target control and file format
${DataExport1}.exportFile(${Table3}) // exports spreadsheet using data from Table3
${DataExport1}.exportFile(${Table3}, 'csv') // exports spreadsheet using data from Table3 in csv format, regardless of any other settings

focus()
Set focus on this control

getColorStyle() Returns: {string}
Gets color style of export button. NOTE: This always returns the color as set, to avoid ambiguity always set the color using "D"|"P"|"I"|"S"|"W"|"E"

getColumnFormats() Returns: {string[]}
Gets current column formats. See {@link https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4|Create or delete a custom number format} for more information on creating formatting srings.

getColumnHeaders() Returns: {string[]}
Gets the column headers.

getFileName() Returns: {string}
Get the default output file name. Users will be able to change file name when saving.

getFileType() Returns: {string}
Gets the currently set output format

getHelpText() Returns: {string}
Get help text for export button

getShapeStyle() Returns: {string}
Gets shape style of export button. NOTE: This always returns the shape style as set, to avoid ambiguity always set the shape style using "D"|"R"|"F"

getSizeStyle() Returns: {string}
Gets size style of export button. NOTE: This always returns the size style as set, to avoid ambiguity always set the size style using "D"|"S"|"L"|"X"

getTabIndex() Returns: {integer}
Get tab index for DataExport control

getTargetControl() Returns: {string}
Gets the name of the control that is being used to populate spreadsheets

getText() Returns: {string}
Get text of export button

getType() Returns: {string}
Get descriptive string representing the type of control

getWidth() Returns: {string}
Get configured width for export button (including unit)

Inherited hide(collapseFlag)
Hide this view/control
NameTypeDefaultDescription
collapseFlag{boolean}Set to true to collapse the view (equivalent to a view setting of "NONE")
Example
MyView.hide();

Inherited isBound() Returns: {boolean}
Indicates bound status of control.

isColumnNamesIncluded() Returns: {boolean}
Returns whether or not column names are included in output file

Inherited isEnabled() Returns: {boolean}
Checks if the view is enabled or not
Example
var enabled = MyView.isEnabled();

isInvisibleColumnsIncluded() Returns: {boolean}
Returns whether or not output file will contain hidden columns/fields

Inherited isLabelVisible() Returns: {boolean}
Checks if control label is visible
Example
var labelVisible = MyView.isLabelVisible();

Inherited isVisible() Returns: {boolean}
Checks whether or not view is visible
Example
var visible = MyView.isVisible();

Inherited propagateUpValueChange(event) Returns: {boolean}
Propagates value change of control up through parent views
NameTypeDefaultDescription
event{Event}Value change event (usually an onchange event)
Example
MyView.propagateUp(event);

setColorStyle(style)
Sets color style of export button. NOTE: to avoid ambiguity always set the color using "D"|"P"|"I"|"S"|"W"|"E"
NameTypeDefaultDescription
style{string}"DEFAULT"|"DEF"|"D"=Default | "PRIMARY"|"PRI"|"P"=Primary | "INFO"|INF"|"I"=Info | "SUCCESS"|"S"=Success | "WARNING"|"WARN"|"W"=Warning | "DANGER"|ERROR|ERR"|"E"|"G"=Danger

setColumnFormats(value, index)
Set column formatting for one or more columns. Formatting strings must conform to Microsoft Excel standards. See {@link https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4|Create or delete a custom number format} for more information on creating formatting srings.
NameTypeDefaultDescription
value{(string|string[])}Value to set format to. If value is a string, idx is required. If value is an array of strings, then a matching array of indexes may or may not be specified. If an array is specified, then each string in value will be mapped to the corresponding index in index. Otherwise, string array will replace current column formats
index{(integer|integer[])}Index to set format at. If value is an array of strings, an array of indexes may be specified, which will map each format to the corresponding index.
Examples
${DataExport1}.setColumnFormats("$#", 1) // sets the 2nd column (index 1) to use "$#" as it's formatting string
${DataExport1}.setColumnFormats(["$#","#,##0.00","#%"], [1,3,5]) // sets the 2nd, 4th, and 6th columns (indices 1, 3, and 5) to use "$#", "#,##0.00", and "#%" as their formatting strings, respectively
${DataExport1}.setColumnFormats(["$#","#,##0.00","#%"]) // sets the formatting for the 1st, 2nd, and 3rd columns to use "$#", "#,##0.00", and "#%" as their formatting strings, respectively

setColumnHeaders(headers)
Set column headers.
NameTypeDefaultDescription
headers{string[]}List of column headers
Example
${DataExport1}.setColumnHeaders(["ID","Name","Role","DOB"]) // sets the labels for the column headers to "ID", "Name", "Role", and "DOB"

setColumnNamesIncluded(flag)
Set whether or not column names should be included in output file. Note: This has no effect when the control is bound to data.
NameTypeDefaultDescription
flag{boolean}Set to true to include column headers in output file, false to leave them out

Inherited setEnabled(enabled, required)
Enable/disable this view/control
NameTypeDefaultDescription
enabled{boolean}Enabled/read-only flag (true to enable view, false to disable/make read-only)
required{boolean}Enable/disable required field flag for control
Example
MyView.setEnabled(false); //Make MyView read-only

setFileName(name)
Set the default file name output file should have. Users will be able to change file name when saving.
NameTypeDefaultDescription
name{string}Default name output file should have. Users will be able to change file name at save time.

setFileType(type)
Set the file format to output to
NameTypeDefaultDescription
type{string}File format to output. Acceptable values include 'xlsx' and 'csv'.

setHelpText(text)
Set help text for export button
NameTypeDefaultDescription
text{string}Rollover text to be set

setIcon(icon)
Sets icon to display on the export button
NameTypeDefaultDescription
icon{string}See {@link http://fontawesome.io/icons Font Awesome} for a comprehensive list of icons. Refer to the knowledge center for the latest Font Awesome version.

setInvisibleColumnsIncluded(flag)
Set whether or not hidden columns/fields should be included in output file
NameTypeDefaultDescription
flag{boolean}Set to true to include hidden columns/fields in output file, false to leave them out

Inherited setLabelVisible(visible)
Show/hide the label of this view/control
NameTypeDefaultDescription
visible{boolean}Label visibility flag (true to show view label, false to hide)
Example
MyView.setLabelVisible(false);

setOutline(outline)
Sets outline style of export button
NameTypeDefaultDescription
outline{boolean}{true | false}

setShapeStyle(style)
Sets shape style of export button. NOTE: to avoid ambiguity always set the shape style using "D"|"R"|"F"
NameTypeDefaultDescription
style{string}"Default"|"D"=Default | "ROUNDED"|ROUND"|"R"=Rounded | "FLAT"|"F"=Flat

setSizeStyle(style)
Sets size style of export button. NOTE: to avoid ambiguity always set the size style using "D"|"S"|"L"|"X"
NameTypeDefaultDescription
style{string}"DEFAULT"|"DEF"|"NORMAL"|"D"=Default | "SMALL"|"S"=Small | "LARGE"|"L"=Large | "EXTRA-SMALL"|"X-SMALL"|"XS"|"X"=X-small

setTabIndex(tabIndex)
Sets tab index of DataExport control
NameTypeDefaultDescription
tabIndex{integer}Tab indices start at 1 and may be set sparsely

setTargetControl(control)
Set the control to use for populating spreadsheets
NameTypeDefaultDescription
control{(string|object)}Either the name of the control to use, or a view reference to the control to use
Examples
${DataExport1}.setTargetControl("Table3") // sets the target control to Table3
${DataExport1}.setTargetControl(${Table3}) // another way to set the target to Table3, this time passing Table3 itself

setText(text)
Set text of export button
NameTypeDefaultDescription
text{string}Text to be set on the export button

Inherited setViewData(data, createPseudoBinding)
Set/update bound data associated this view/control. Only works for views/controls with bound data.

Note: Should only be used with simple type bindings, or complex type bindings with simple type properties.
Should not be used with bindings that have properties that are lists or compext types. For complex types, set bindings using
the binding.set pattern detailed in the Knowlege Center section Binding Data and Configuration Options
NameTypeDefaultDescription
data{Object}Value of bound data. The type of this parameter must match the type of the bound data.
createPseudoBinding{boolean}If set to true, creates a pseudo binding if there is no current binding.
Example
MyView.setViewData("TEST"); //Updates bound data to the string 'TEST'

Inherited setVisible(visible, collapse)
Show/hide this view/control
NameTypeDefaultDescription
visible{boolean}Visibility flag (true to show view, false to hide)
collapse{boolean}Set to true to collapse the control space when visible is set to false.
Examples
MyView.setVisible(false, false); //Equivalent to MyView.hide()
MyView.setVisible(false, true); // Sets visibility to "None"

setWidth(width)
Set width of export button (e.g. 50px, 20%, 2em - omitting the unit assumes px)
NameTypeDefaultDescription
width{string}DataExport width

Inherited show()
Show this view/control
Example
MyView.show();

Inherited triggerFormulaUpdates([phase])
Broadcasts the expression trigger for the specified view
NameTypeDefaultDescription
phase{int}bpmext.ui.PHASE_NORMALThe phase we are currently in
Example
MyView.triggerFormulaUpdates();