Class: DataExport

DataExport

The Data Export control is used to allow users to export the data from a table, repeating layout, or a list of complex objects that contain properties of simple types to a spreadsheet formatted file, supporting file extensions .xlsx and .csv. A DataExport control provides the following configuration properties in Process Designer:

Behavior

Target Control: Relative path to the table or repeating layout to use for populating output file. Overridden if this control is bound to data. string
Export File Type: File type to export to
{Microsoft Excel 2007+ file type xlsx | Comma Separated Values filet type csv}
string
Default File Name: Default name for file. Users will be able to change this when saving. string
Include Column Headers: Select to include column headers at top of output file. Has no effect when control is bound to data boolean
Tab Index: Form control tabbing sequence index. Tab indices start at 1, and may be set sparsely. 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 control 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 format string Strings used to determine data formatting for each column in output file, according to Microsoft formatting standards, which can be found here. Note that any color styling that is set will not be kept when exporting to csv. string
Column Headers: The headers of the exported columns. Requires the include column headers property to be selected. If the control is bound to a Table, these headers are used instead of the table column headers. string[]

Appearance

Color Style: Color-based styling for this control (default, primary, success, warning, danger)
{Default | Primary | Info | Success | Warning | Danger}
string
Shape Style: Rounded, flat or default square control shape
{Default | Rounded | Flat}
string
Size Style: Size-based styling for this control (default, large, small, extra-small)
{Default | Large | Small | Extra-Small}
string
Outline Only: When true, control only shows its color-based style when 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: Width in px, %, em For example: 50px, 20%, 0.4em. If no unit is specified, px is assumed 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

new DataExport()

This constructor is never used explicitly.

Extends

Members

Methods

Add/replace CSS class(es) for this control
Name Type Description
name string CSS class name(s) to add to the control. Separate class names by a space if more than one class.
replaced string optional 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");
Programmatically click the export button

exportFile(targetPath, format)

Exports a spreadsheet file
Name Type Description
targetPath string | object optional nullable Either path to target control or control view reference. If null or missing, will default to control returned by DataExport#getTargetControl.
format string optional nullable File format to output to. Acceptable values incluse 'xlsx' and 'csv'. If null or missing, will default to format returned by 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
Set focus on this control

getColorStyle(){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"
Returns:
Type Description
string

getColumnFormats(){Array.<string>}

Gets current column formats. See Create or delete a custom number format for more information on creating formatting srings.
Returns:
Type Description
Array.<string>

getColumnHeaders(){Array.<string>}

Gets the column headers.
Returns:
Type Description
Array.<string>

getFileName(){string}

Get the default output file name. Users will be able to change file name when saving.
Returns:
Type Description
string

getFileType(){string}

Gets the currently set output format
Returns:
Type Description
string

getHelpText(){string}

Get help text for export button
Returns:
Type Description
string

getShapeStyle(){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"
Returns:
Type Description
string

getSizeStyle(){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"
Returns:
Type Description
string

getTabIndex(){integer}

Get tab index for DataExport control
Returns:
Type Description
integer

getTargetControl(){string}

Gets the name of the control that is being used to populate spreadsheets
Returns:
Type Description
string

getText(){string}

Get text of export button
Returns:
Type Description
string

getType(){string}

Get descriptive string representing the type of control
Returns:
Type Description
string

getWidth(){string}

Get configured width for export button (including unit)
Returns:
Type Description
string
Hide this view/control
Name Type Description
collapseFlag boolean Set to true to collapse the view (equivalent to a view setting of "NONE")
Example
MyView.hide();
Indicates bound status of control.
Returns:
Type Description
boolean True if the control is bound to coach data.

isColumnNamesIncluded(){boolean}

Returns whether or not column names are included in output file
Returns:
Type Description
boolean
Checks if the view is enabled or not
Returns:
Type Description
boolean Enabled status
Example
var enabled = MyView.isEnabled();

isInvisibleColumnsIncluded(){boolean}

Returns whether or not output file will contain hidden columns/fields
Returns:
Type Description
boolean
Checks if control label is visible
Returns:
Type Description
boolean Label visibility status
Example
var labelVisible = MyView.isLabelVisible();
Checks whether or not view is visible
Returns:
Type Description
boolean Visibility status
Example
var visible = MyView.isVisible();
Propagates value change of control up through parent views
Name Type Description
event Event Value change event (usually an onchange event)
Returns:
Type Description
boolean True if a formula update was triggered on the control's parent, otherwise false
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"
Name Type Description
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, })

Set column formatting for one or more columns. Formatting strings must conform to Microsoft Excel standards. See Create or delete a custom number format for more information on creating formatting srings.
Name Type Description
value string | Array.<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
} integer | Array.<integer> index 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.
Name Type Description
headers Array.<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.
Name Type Description
flag boolean Set to true to include column headers in output file, false to leave them out
Enable/disable this view/control
Name Type Description
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.
Name Type Description
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
Name Type Description
type string File format to output. Acceptable values include 'xlsx' and 'csv'.

setHelpText(text)

Set help text for export button
Name Type Description
text string Rollover text to be set

setIcon(icon)

Sets icon to display on the export button
Name Type Description
icon string visit http://fontawesome.io/icons/ for icon options

setInvisibleColumnsIncluded(flag)

Set whether or not hidden columns/fields should be included in output file
Name Type Description
flag boolean Set to true to include hidden columns/fields in output file, false to leave them out
Show/hide the label of this view/control
Name Type Description
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
Name Type Description
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"
Name Type Description
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"
Name Type Description
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
Name Type Description
tabIndex integer Tab indices start at 1 and may be set sparsely

setTargetControl(control)

Set the control to use for populating spreadsheets
Name Type Description
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
Name Type Description
text string Text to be set on the export button
Show/hide this view/control
Name Type Description
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)
Name Type Description
width string DataExport width
Show this view/control
Example
MyView.show();
Broadcasts the expression trigger for the specified view
Name Type Default Description
phase int bpmext.ui.PHASE_NORMAL optional The phase we are currently in
Example
MyView.triggerFormulaUpdates();