Class actuate.report.Table
Description
A container for a Table element in a report. Table provides functions to operate on a Table element, such as manipulating columns, groups, and data.
Constructor
The Table object is constructed by viewer.PageContent.getTableByBookmark( ).
Function summary
Table 7‑36 lists actuate.report.Table functions.
Table 7‑36 actuate.report.Table functions 
Function
Description
Applies conditional formatting on a selected column, based on a column name
Clears the filters from the given column
Deletes a column, based on column name
Returns the bookmark name for this Table
Gets the Table data by column index and returns only the data from the current visible page
Returns a column name by specifying the column index
Returns the HTML element for this Table
Returns the report element instance id
Returns the page content to which this element belongs
getRow( )
Gets the Table data by row index
getType( )
Returns the report element type
Adds an inner group to this Table
hide( )
Hides this element
Hides a Table column by specifying the column name
Hides detailed information for displayed groups
Inserts a computed column in a table
Moves a column to the left
Moves a column to the right
Removes an inner group
Sets the alignment of a column
Applies filters to this Table
Sets a header alignment of a column
Adds sorters to this Table
show( )
Shows this element
Shows a Table column by specifying the column name
Shows detailed information for displayed groups
submit( )
Submits all the asynchronous operations that the user has requested on this report and renders the Table component on the page
Swaps two columns, reordering the columns
applyConditionalColumnFormatting
Syntax
void Table.applyConditionalColumnFormatting(string ColumnName, JSON formatRules)
Applies conditional formatting to a given column.
Parameter
ColumnName
String. The name of the column.
formatRules
JSON. An array of the formatting values, structured according to the JSON standard. You can specify one or more formatting rules.
Syntax:
var formatRules = [{formatRule1},{formatRule2},...,{formatRuleN}]
A formatting rule consists of three components, and has the following syntax:
{bindingName:"<columnName>", condition:<condition>, effect:<effect>}
*bindingName
A bindingName specifies a column name on which the format applies. Use double quotation marks to surround the name of the column, as shown in this example:
bindingName : "CUSTOMERNAME"
*condition
A condition specifies a filter condition in the following format:
condition: {operator:"<operator>", operands:"<operands>"}
The conditions are based on actuate.model.FilterCondition, and consists of operator and operands:
*An operator takes one of the values described in Table 7‑37.
Table 7‑37 Filter conditions
Operator
Description
eq
Equal, =
ne
Not equal, <>
lt
Less than, <
le
Less than, or equal, <=
ge
Greater than, or equal, >=
gt
Greater than, >
between
Between
not-between
Not between
is-null
Equal to NULL
is-not-null
Not equal to NULL
like
Checks if the column data matches a pattern
not-like
Checks if a column data does not match a pattern
*Operands provide the values required by an operator to define a filtering condition. To describe a single value, use a literal operand, as shown in the example:
operator: "eq",
operands : [ { literal : 124 } ]
To describe more than one operand, for example, the values between 131 and 161:
operator: "between",
operands : [ {literal : 131},{literal : 161} ]
*effect
The effect property specifies the conditional formatting. The syntax is based on actuate.model.Font class. Always consider the web browser when implementing the formatting. Not all browsers support all properties.
effect:{
family: "<value>",
size : "<value>",
color : "<value>",
backgroundColor : "<value>",
bold : <boolean_value>,
italic : <boolean_value>,
underline : <boolean_value>,
}
Table 7‑38 describes the formatting properties.
Table 7‑38 Formatting effects
Effect
Description
family
Specifies the font family for text
size
Specifies the font size of text
color
Specifies the text color in RGB or hexadecimal format.
backgroundColor
Specifies the table column background color
bold
Sets the style of the text to bold
italic
Sets the style of the text to italic
underline
Sets the style of the text to underline
Example
This example shows the formatting rule for changing the background color of a column "COUNTRY", with index 124, to rgb(255,0,0):
var formatRules = [
{
bindingName : "CUSTOMERNUMBER",
condition : {
operator : "eq",
operands : [ { literal : 124 } ]
},
effect : {
bold : true,
italic : true,
underline : false,
backgroundColor : "rgb(255,0,0)"
}
}
];
var columnName = "COUNTRY";
tableObj.applyConditionalColumnFormatting( columnName, formatRules );
tableObj.submit( );
clearFilters
Syntax
void Table.clearFilters(string columnName)
Clears the filters of a given column.
Parameter
columnName
String. The name of the column.
Example
This example clears existing filters from the PRODUCTLINE column:
function resetFilter(myTable){
myTable.clearFilters("PRODUCTLINE");
myTable.submit( );
}
deleteColumn
Syntax
void Table.deleteColumn(string columnName)
Deletes a column from a table.
Parameter
columnName
String. The name of the column.
Example
This example deletes the PRODUCTLINE column from a table:
var pgContent = viewer.getCurrentPageContent( );
var table = pgContent.getTableByBookmark( bookmark );
table.deleteColumn( “PRODUCTLINE” );
table.submit( );
getBookmark
Syntax
string Table.getBookmark( )
Returns the Table’s name.
Returns
String. The name of the Table.
Example
This example displays the Table’s bookmark in an alert box:
function alertBookmark(myTable){
alert(myTable.getBookmark( ));
}
getColumn
Syntax
array[ ] Table.getColumn(integer columnIndex)
Gets the Table data by column index. Returns the data from the current visible page.
Parameter
columnIndex
Integer. Optional. The numerical index of the column from which to retrieve data. The getColumn( ) function returns the values for the first column when no value is provided for columnIndex.
Returns
Array. A list of data in the format of the column.
Example
This example returns the first column in myTable:
function getMyColumn(myTable) {
return myTable.getColumn( );
}
getColumnName
Syntax
void Table.getColumnName(int columnIndex)
Returns a column name based on a column index.
Parameter
columnIndex
Integer. The index of the column.
Example
This example clears existing filters from the PRODUCTLINE column:
viewer.registerEventHandler( actuate.viewer.impl.EventConstants.ON_CONTENT_SELECTED, mySelectionCB );
...
function mySelectionCB( viewerInstance, selectedItem ) {
var table = viewerInstance.getTable( );
var colIdx = selectedItem.getColumnIndex( );
var columnName = table.getColumnName( colIdx );
// Updated text control shows selected column name
document.getElementById( "txtColumnId" ).value = columnName;
}
getHtmlDom
Syntax
HTMLElement Table.getHtmlDom( )
Returns the Table’s name.
Returns
String. The name of the Table.
Example
This example displays the HTML DOM element for this Table inside a red border:
function showHtmlDom(myTable){
var domNode = myTable.getHtmlDom( );
var box = document.createElement('div');
box.style.border = '2px solid red';
var label = document.createElement('h2');
label.innerHTML = 'The HTML DOM:';
box.appendChild(label);
box.appendChild(domNode);
document.body.appendChild(box);
}
getInstanceId
Syntax
string Table.getInstanceId( )
Returns the instance id of this report element.
Returns
String. The instance id.
Example
This example displays the instance ID of the report element in an alert box:
function showID(myTable){
var elementID = myTable.getInstanceId( );
alert (elementID);
}
getPageContent
Syntax
actuate.viewer.PageContent Table.getPageContent( )
Returns the page content to which this Table belongs.
Returns
actuate.viewer.PageContent. report content.
Example
This example displays the viewer ID of the page content in an alert box:
function showViewID(myTable){
var pageContent = myTable.getPageContent( );
var pageViewerID = pageContent.getViewerId( );
alert (pageViewerID);
}
getRow
Syntax
array[ ] Table.getRow(integer rowIndex)
Gets the Table data by row index. Returns the data from the current visible page.
Parameter
rowIndex
Integer. Optional. The numerical index of the row from which to retrieve data. The getRow( ) function returns the values for the first row when no value for rowIndex is provided.
Returns
Array. A list of data in the format of the columns that cross the row.
Example
This example retrieves the first row in myTable:
function getMyRow(myTable) {
return myTable.getRow( );
}
getType
Syntax
string Table.getType( )
Returns the report element type of this object, which is Table.
Returns
String. "Table".
Example
This example returns the report element type of this object in an alert box:
function getTableType(myTable) {
alert("Element type is: " + myTable.getType( ));
}
groupBy
Syntax
void Table.groupBy(string columnName)
Groups the data in a table by the values in a given column. If there is an existing group, this operation will add the new group after the existing group.
Parameter
columnName
String. The name of the column to use for the innermost group to the Table.
Example
This example groups the data in myTable by the values in the TOTAL column:
function groupByColumn(myTable) {
myTable.groupBy("TOTAL");
}
hide
Syntax
void Table.hide( )
Hides this element.
Example
This example hides myTable:
myTable.hide( );
hideColumn
Syntax
void Table.hideColumn(string columnName)
Hides a table column by specifying the column name.
Parameter
columnName
String. The data binding name for the column to hide.
Example
This example hides the TOTAL column from myTable:
function myHiddenColumn(myTable) {
myTable.hideColumn("TOTAL");
myTable.submit( );
}
hideDetail
Syntax
void Table.hideDetail(string columnName)
Hides information for a column from the grouped data displayed on the page. If every column is hidden, only the group name is visible.
Parameter
columnName
String. The data binding name for the column to hide.
Example
This example hides the TOTAL column from the grouped data visible for myTable:
function hideMyDetail(myTable) {
myTable.hideDetail("TOTAL");
myTable.submit( );
}
insertComputedColumn
Syntax
void Table.insertComputedColumn( String columnName, String columnLabel, JSON computedAttrs )
Inserts a computed column in a table.
Parameters
columnName
String. The name of the column, after which the new computed column is inserted.
columnLabel
String. The label of the new computed column.
computedAttrs
JSON. The definition of the formulas and data used to calculate the new column.
The computedAttrs array must provide the following attributes:
*categoryName
String. Defines the function category, as listed in Table 7‑39.
*functionName
String. Defines the function name, as listed in Table 7‑39.
*Arguments
The number of the arguments and their formats are different for each function. You can find their definitions in each function description later in this section.
All functions and their attributes are defined in iv_config.xml, located in the iHub or Information Console installations:
<context root>\WEB-INF
The JSON format definition of the computedAttrs parameter has the following syntax:
var computedAttrs = {
"category" :{
"categoryName" : "<CATEGORY_NAME>",
"function" : {
"functionName" : "<FUNCTION_NAME>",
"arguments" : [ { <argument1>},...,{<argumentN > } ]
}
}
}
Table 7‑39 Expression functions categories and names
Category
Function
Description
Calculates the percent for the selected column value in the scope of the selected base group.
 
Calculates the percent of the difference between values in two numbers.
 
Calculates the running total for the selected Column at the specified base group.
Returns the absolute value of a number without regard to its sign. For example, 6 is the absolute value of 6 and ‑6.
 
Calculates the sum, number 1 + number 2.
 
Rounds a number to the nearest specified multiple of significance, away from zero.
 
Calculates the difference, number2 – number1.
 
Calculates the remainder value of number divided by divisor. The remainder displays the same sign as the divisor.
 
Calculates the product, number 1 * number 2.
 
Calculates the rank for the Column value at the specified level.
 
Calculates the ratio, number 1 / number 2.
 
Rounds the number to the specified number of decimal digits. Decimal is an integer and can be negative. The default value for decimal is 0.
 
A number rounded down to a specified number of digits.
 
A number rounded up to a specified number of digits.
 
Calculates the square root of a number.
Adds a specified number of days to a date value.
 
Adds a specified number of hours to a date value.
 
Adds a specified number of minutes to a date value.
 
Adds a specified number of months to a date value.
 
Adds a specified number of quarters to a date value.
 
Adds a specified number of seconds to a date value.
 
Adds a specified number of weeks to a date value.
 
Adds a specified number of years to a date value.
 
Returns a number from 1 to 31 representing the day of the month.
 
Calculates the number of days between two date values.
 
Calculates the number of hours between two date values.
 
Calculates the number of minutes between two date values.
 
Calculates the number of months between two date values.
 
Calculates the number of quarters between two date values.
 
Calculates the number of seconds between two date values.
 
Calculates the number of weeks between two date values.
 
Calculates the number of years between two date values.
 
Returns the month for a specified date value.
 
Returns the current date and time.
 
Returns the quarter number for a specified date value.
 
Returns the current date that includes a time value of midnight, 12:00 AM.
 
Returns a number from 1 to 52 representing the week of the year.
 
Returns the day of the week for a specified date value.
 
Returns the four‑digit year value for a specified date value.
Tests if a value is between two specified values.
 
Tests if a value is equal to a value in a list.
 
Tests if a value in a specified data field is a null value. A null value means no value exists.
 
Tests if a string matches a pattern.
 
Tests if a value in a specified data field is a non-null value.
Finds the location of a substring in a string.
 
Extracts a substring from a string, starting from the leftmost, or first, character.
 
Counts the number of characters in a string.
 
Converts all letters in a string to lowercase.
 
Extracts a substring from a string, starting from the rightmost, or last, character.
 
Finds the location of a substring in a string. The substring can contain wild card characters.
 
Removes the leading and trailing blanks from a specified string. TRIM( ) does not remove blank characters between words.
 
Removes the leading blanks from a specified string.
 
Removes the trailing blanks from a specified string.
 
Converts all letters in a string to uppercase.
Financial functions
% OF
Calculates the percent for the selected column value in the scope of the selected base group.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } to reference the arguments of the function in the expression.
"{0}/{1}*100%"
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Example
This example creates a computed column Q1/Year, calculating the percent of the revenue at the first quarter from the total yearly revenue, by product code.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "FirstQuarterTotal";
var columnName2 = "YearTotal";
var columnLabel = "Q1/Year";
var category = "Financial";
var categoryFunc = "% OF";
 
var expression = "{0}/{1}*100%";
var arguments = [
{ "value" : "["+columnName1+"]" },
{ "value" : "["+columnName2+"]" }
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs );
table.submit();
% OF DIFFERENCE
Calculates the percent of the difference between values in two numbers
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column in format. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } to reference the arguments of the function in the expression.
({1}-{0})/{0}*100%
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Example
The example creates a computed column Q1/Year, calculating the % of difference between the first quarter and yearly revenue by product code.
var columnName1 = "FirstQuarterTotal";
var columnName2 = "YearTotal";
var columnLabel = "Q1/Year";
var category = "Financial";
var categoryFunc = "% OF DIFFERENCE";
 
var expression = "({1}-{0})/{0}*100%";
var arguments = [
{ "value": "["+columnName+"]"},
{"value":"["+columnName+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit();
RUNNINGSUM
Calculates the running total for the selected Column at the specified base group level.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
aggregationType
String. Defines the type of the aggregation type.
Example
This example creates a computed column Running Sum, calculating the running sum of quarterly sales by product code.
var columnNameAfter = "PRODUCTCODE";
var columnName = "QuarterTotal";
var columnLabel = "Running Sum";
var category = "Financial";
var categoryFunc = "RUNNINGSUM";
 
var arguments = [
{ "value" : "[" + columnName + "]" },
{ "aggregationType" : "Expression" }
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs );
table.submit( );
Math functions
ABS
Returns the absolute value of a number without regard to its sign. For example, 6 is the absolute value of 6 and ‑6.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column ABS-Revenue that is the absolute value of the revenue for the product code.
var columnNameAfter = "PRODUCTCODE";
var columnName = "REVENUE";
var columnLabel = "ABS-Revenue";
var category = "Math";
var categoryFunc = "ABS";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD
Calculates a sum of two columns.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } as the function arguments in the expression.
"{0}+{1}"
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Examples
This example creates a computed column, adding the revenue from Q1 and Q2.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "Q1";
var columnName2 = "Q2";
var columnLabel = "Q1+Q2";
var category = "Math";
var categoryFunc = "ADD";
 
var expression = "{0}+{1}";
var arguments = [
{ "value" : "["+columnName1+"]" },
{ "value" : "["+columnName2+"]" }
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs );
table.submit( );
The example generates the following JSON object:
{ "arguments" : [{ "value" : "[Q1]" }, { "value" : "[Q2]" }],
"category" : "Math",
"expression" : "{0}+{1}",
"function" : "ADD",
"label" : "Q1+Q2"
}
CEILING
Rounds a number to the nearest specified multiple of significance, away from zero.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The multiple of significance to which Number is to be rounded.
Example
This example creates a computed column that displays the nearest integer that is a multiple of 3.
var columnNameAfter = "PRODUCTCODE";
var columnName = "Revenue";
var columnLabel = "Revenue-ceiling";
var category = "Math";
var categoryFunc = "CEILING";
 
var arguments = [{"value":"["+columnName+"]"}, {"value":"3"}];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFFERENCE
Calculates the difference between two numbers.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } to reference the arguments of the function in the expression.
"{0}+{1}"
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Example
The example creates a computed column displaying the difference in Q1 and Q2 revenues.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "Q1";
var columnName1 = "Q2";
var columnLabel = "Q2-Q1";
var category = "Math";
var categoryFunc = "DIFFERENCE";
 
var expression = "{1}-{0}";
var arguments = [
{ "value" : "["+columnName+"]" },
{ "value" : "["+columnName+"]" }
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
MOD
Calculates the remainder value of number divided by divisor. The remainder displays the same sign as the divisor.
Arguments
value
String. Table column name, that gives the number for which you want to find the remainder. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Divisor. The number by which you want to divide the column value.
Example
The example creates a computed column that displays the remainder of parts, considering eight parts are used in a unit.
var columnNameAfter = "Account";
var columnName = "PARTS";
var columnLabel = "Parts-Mod";
var category = "Math";
var categoryFunc = "MOD";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"8"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
PRODUCT
Calculates the product, number 1 * number 2.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } to reference the arguments of the function in the expression.
"{0}+{1}"
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Example
This example creates a computed column, multiplying the number of items ordered by the price of the item.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ORDER-PARTS";
var columnName2 = "PART-PRICE";
var columnLabel = "ORDER-PRICE";
var category = "Math";
var categoryFunc = "PRODUCT";
 
var expression = "{0}*{1}";
var arguments = [
{ "value" : "["+columnName1+"]" },
{ "value" : "["+columnName2+"]" }
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
RANK
Calculates the rank for the Column value in the list of column values.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String.
Example
This example creates a computed column, to display the rank of the product line.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "Rank";
var category = "Math";
var categoryFunc = "RANK";
 
var arguments = [
{"value":"["+columnName+"]" ,"aggregationType":"Expression"},
{"value":"true","aggregationType":"ascending"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
RATIO
Calculates the ratio of two numbers.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
expression
String. Defines an expression used in the calculation, using JavaScript syntax conventions. Use object literals { } to reference the arguments of the function in the expression.
"{0}+{1}"
In the example above, {0} references the first argument of the function, in this case the value of the first column, {1} references value of the second column. The numbers 0 and 1 refer to the arguments in the order of their definition.
Example
This example creates a computed column for the ratio of sales from Q1 and Q2.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "Q1";
var columnName2 = "Q2";
var columnLabel = "Q1/Q2";
var category = "Math";
var categoryFunc = "RATIO";
 
var expression = "{0}/{1}";
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.expression = expression;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ROUND
Rounds the number to a specified number of decimal digits.
Arguments
value
String. The name of the dataset column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The number of digits to which to round the column value.
Example
This example creates a computed column that displays the revenue for the product code rounded to two decimal places.
var columnNameAfter = "PRODUCTCODE";
var columnName = "REVENUE";
var columnLabel = "Revenue";
var category = "Math";
var categoryFunc = "ROUND";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"2"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ROUNDDOWN
Rounds a number down to a specified number of digits.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Specifies the number of digits to which to round the column value down.
Example
This example creates a computed column that displays the revenue for the product code rounded down to an integer value.
var columnNameAfter = "PRODUCTCODE";
var columnName = "REVENUE";
var columnLabel = "Revenue-rounddown";
var category = "Math";
var categoryFunc = "ROUNDDOWN";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"0"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ROUNDUP
Rounds a number up to a specified number of digits.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Specifies the number of digits to which to round the column value up.
Example
This example creates a computed column that displays the price for the product code rounded up to two decimal places.
var columnNameAfter = "PRODUCTCODE";
var columnName = "UNITPRICE";
var columnLabel = "Unitprice-roundup";
var category = "Math";
var categoryFunc = "ROUNDUP";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"2"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
SQRT
Calculates the square root of a number.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the length of the product as the square root of its area.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTAREA";
var columnLabel = "Length";
var category = "Math";
var categoryFunc = "SQRT";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DateTime functions
ADD_DAY
Adds a specified number of days to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of days.
Example
This example creates a computed column that displays the expected delivery date of an order by adding 10 to the order date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "ORDERDATE";
var columnLabel = "DELIVERYDATE";
var category = "Date & Time";
var categoryFunc = "ADD_DAY";
 
var arguments = [ {"value":"["+columnName+"]"},{"value":"10"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_HOUR
Adds a specified number of hours to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of hours.
Example
This example creates a computed column that displays the expected response time for a call by adding 4 hours to the call time.
var columnNameAfter = "PRODUCTCODE";
var columnName = "CALLTIME";
var columnLabel = "ResponseTime";
var category = "Date & Time";
var categoryFunc = "ADD_HOUR";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"4"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_MINUTE
Adds a specified number of minutes to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of minutes.
Example
This example creates a computed column that displays the expected processing completion time by adding 10 minutes to the log time.
var columnNameAfter = "PRODUCTCODE";
var columnName = "LOGTIME";
var columnLabel = "ProcessTime";
var category = "Date & Time";
var categoryFunc = "ADD_MINUTE";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"10"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_MONTH
Adds a specified number of months to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of months.
Example
This example creates a computed column that displays the date on which an action takes effect by adding 6 months to a start date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTDATE";
var columnLabel = "EFFECTDATE";
var category = "Date & Time";
var categoryFunc = "ADD_MONTH";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"6"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_QUARTER
Adds a specified number of quarters to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of quarters.
Example
This example creates a computed column that displays the end date of a period by adding 1 quarter to the start date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTDATE";
var columnLabel = "ENDDATE";
var category = "Date & Time";
var categoryFunc = "ADD_QUARTER";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"1"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_SECOND
Adds a specified number of seconds to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of seconds.
Example
This example creates a computed column that displays the expected end time of a process by adding 30 seconds to a start time.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTTIME";
var columnLabel = "ENDTIME";
var category = "Date & Time";
var categoryFunc = "ADD_SECOND";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"30"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_WEEK
Adds a specified number of weeks to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of weeks.
Example
This example creates a computed column that displays the expected end date of a process by adding 6 weeks to the start date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTDATE";
var columnLabel = "ENDDATE";
var category = "Date & Time";
var categoryFunc = "ADD_WEEK";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"6"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ADD_YEAR
Adds a specified number of years to a date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Number of years.
Example
This example creates a computed column that displays the expected end date of a process by adding 4 years to the start date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTDATE";
var columnLabel = "ENDDATE";
var category = "Date & Time";
var categoryFunc = "ADD_YEAR";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"4"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DAY
Returns a number from 1 to 31 representing the day of the month.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the day of the month of a date-and-time field.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTTIME";
var columnLabel = "Day of month";
var category = "Date & Time";
var categoryFunc = "DAY";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_DAY
Calculates the number of days between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of days between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINDAYS";
var category = "Date & Time";
var categoryFunc = "DIFF_DAY";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_HOUR
Calculates the number of hours between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of hours between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINHOURS";
var category = "Date & Time";
var categoryFunc = "DIFF_HOUR";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_MINUTE
Calculates the number of minutes between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of minutes between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINMINUTES";
var category = "Date & Time";
var categoryFunc = "DIFF_MINUTE";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_MONTH
Calculates the number of months between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of months between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINMONTHS";
var category = "Date & Time";
var categoryFunc = "DIFF_MONTH";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_QUARTER
Calculates the number of quarters between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of quarters between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINQUARTERS";
var category = "Date & Time";
var categoryFunc = "DIFF_QUARTER";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_SECOND
Calculates the number of seconds between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of seconds between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINSECONDS";
var category = "Date & Time";
var categoryFunc = "DIFF_SECOND";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_WEEK
Calculates the number of weeks between two date values.
Arguments
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of weeks between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINWEEKS";
var category = "Date & Time";
var categoryFunc = "DIFF_WEEK";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
DIFF_YEAR
Calculates the number of years between two date values.
Arguments
value
String.The name of the first column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The name of the second column. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of years between order and delivery by comparing two dates.
var columnNameAfter = "PRODUCTCODE";
var columnName1 = "ODRDERDATE";
var columnName2 = "DELIVERYDATE";
var columnLabel = "EXECUTIONINYEARS";
var category = "Date & Time";
var categoryFunc = "DIFF_YEAR";
 
var arguments = [
{"value":"["+columnName1+"]"},
{"value":"["+columnName2+"]"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
MONTH
Returns the month for a specified date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Defines the option for the format of the returned month value. Use the following options, as shown in Table 7‑41.
Table 7‑40 Month options
Option
Description
1
To get the month as a number from 1 to 12.
2
To get the full month name, for example, January. The result is locale-specific.
3
To get the abbreviated month name, for example, Jan. The result is locale-specific.
Example
This example creates a computed column that displays the month number of a date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTTIME";
var columnLabel = "MONTH";
var category = "Date & Time";
var categoryFunc = "MONTH";
 
var arguments = [
{"value":"["+columnName+"]"},
{"value":1}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
NOW
Returns the current date and time.
Example
This example creates a computed column that displays the current date and time.
var columnNameAfter = "PRODUCTCODE";
var columnName = "ORDERDATE";
var columnLabel = "NOW";
var category = "Date & Time";
var categoryFunc = "NOW";
 
var arguments = [ ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
QUARTER
Returns the quarter number for a specified date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the quarter number of a date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "ORDERDATE";
var columnLabel = "QUARTER";
var category = "Date & Time";
var categoryFunc = "QUARTER";
 
var arguments = [ {"value":"["columnName"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
TODAY
Returns the current date including a time value of midnight, 12:00 AM.
Example
This example creates a computed column that displays today’s date.
var columnNameAfter = "PRODUCTCODE";
var columnLabel = "Today";
var category = "Date & Time";
var categoryFunc = "TODAY";
 
var arguments = [ ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
WEEK
Returns a number from 1 to 52 representing the week of the year.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the week number of a date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTDATE";
var columnLabel = "WEEK";
var category = "Date & Time";
var categoryFunc = "WEEK";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
WEEKDAY
Returns the day of the week for a specified date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Defines the option for the format of the returned week day value. Use the following options, as shown in Table 7‑41.
Table 7‑41 Weekday options
Option
Description
1
To get the day as a number from 1 (Sunday) to 7 (Saturday)
2
To get the day as a number from 1 (Monday) to 7 (Sunday)
3
To get the day as a number from 0 (Monday) to 6 (Sunday)
4
To get the full weekday name, for example, Wednesday. The result is locale-specific
5
To get the abbreviated weekday name, for example Wed. The result is locale-specific
Example
This example creates a computed column that displays the numeric day of the week for a date, with Monday being 0.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTTIME";
var columnLabel = "WEEKDAY";
var category = "Date & Time";
var categoryFunc = "WEEKDAY";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":3} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
YEAR
Returns the four-digit year value for a specified date value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the year value of a date.
var columnNameAfter = "PRODUCTCODE";
var columnName = "STARTTIME";
var columnLabel = "YEAR";
var category = "Date & Time";
var categoryFunc = "YEAR";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
Comparison functions
BETWEEN
Returns true if a value is between two specified values, and false if it is not in this range.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Defines the value for the lower bound.
value
String. Defines the value for the upper bound.
Example
This example creates a computed column that displays whether a value is in the range 1 to 3.
var columnNameAfterPosition = "PRODUCTCODE";
var columnName = "QUANTITY";
var columnLabel = "InRange";
var category = "Comparison";
var categoryFunc = "BETWEEN";
 
var arguments = [
{"value":"["+columnName+"]"},
{"value":"1"},
{"value":"3"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfterPosition, columnLabel, computedAttrs);
table.submit( );
IN
Returns true if a value is equal to a value in a list and false if not.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Comma-separated list of values.
Example
This example creates a computed column that displays whether a country value is either France or Spain.
var columnNameAfterPosition = "PRODUCTCODE";
var columnName = "COUNTRY";
var columnLabel = "IN";
var category = "Comparison";
var categoryFunc = "IN";
 
var arguments = [
{"value":"["+columnName+"]"},
{"value":"\"France\", "\Spain\""}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
ISNULL
Returns if a value in a specified data field is a null value. A null value means no value exists.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays whether a city column has no value.
var columnNameAfter = "PRODUCTCODE";
var columnName = "CITY";
var columnLabel = "isNULL";
var category = "Comparison";
var categoryFunc = "ISNULL";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
LIKE
Returns true if a string matches a pattern, and false if it does not match a pattern.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. Defines the string pattern to match. You must enclose the pattern in double quotation marks (" "). The match is case-sensitive. You can use the following special characters in a pattern:
*A percent character (%) matches zero or more characters. As shown in the usage example below, %ace% matches any string value that contains the substring ace, such as Facebook, and MySpace. It does not match Ace Corporation because this string contains a capital A, and not the lowercase a.
*An underscore character (_) matches exactly one character. For example, t_n matches tan, ten, tin, and ton. It does not match teen or tn.
*To match a literal percent (%), underscore (_), precede those characters with two backslash (\\) characters. For example, to see if a string contains M_10, specify the following pattern:
"%M\\_10%"
Example
This example creates a computed column that displays whether a company name contains the string 'ace'.
var columnNameAfter = "PRODUCTCODE";
var columnName = "COMPANYNAME";
var columnLabel = "Like";
var category = "Comparison";
var categoryFunc = "LIKE";
 
var arguments = [{"value":"["+columnName+"]"},{"value":"%ace%"}];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
NOTNULL
Returns true, if a value in a specified data field is a non-null value.
Arguments
value
String. Table column name. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays whether a product line column contains a value.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "NotNull";
var category = "Comparison";
var categoryFunc = "NOTNULL";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
Text functions
FIND
Finds the numerical position of a substring in a string.
Arguments
value
String. Defines the string to find.
value
String. Table column name. Defines the string in which to search. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The starting position from which to start the search.
Example
This example creates a computed column that displays the location of the string 'Car' in the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "FIND";
var category = "Text";
var categoryFunc = "FIND";
 
var arguments = [
{"value":"\"Car\""},
{"value":"["+columnName+"]"},
{"value":"1"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
LEFT
Extracts a substring from a string, starting from the leftmost, or first, character.
Arguments
value
String. Table column name. Defines the string from which to extract a substring. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The number of characters to extract, starting from the first character. If the number is zero, the function returns an empty string. If the number is greater than the length of the string, the function returns the entire string.
Example
This example creates a computed column that displays the first 10 characters of the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "LEFT";
var category = "Text";
var categoryFunc = "LEFT";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"10"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
LEN
Counts the number of characters in a string.
Arguments
value
String. Table column name. Defines the string to evaluate. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the number of characters in the value of the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "LEN";
var category = "Text";
var categoryFunc = "LEN";
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
LOWER
Converts all letters in a string to lowercase.
Arguments
value
String. Table column name. The string to convert to lowercase. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the product line column value in lowercase.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "LOWER";
var category = "Text";
var categoryFunc = "LOWER";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
RIGHT
Extracts a substring from a string, starting from the rightmost, or last character.
Arguments
value
String. Table column name. Defines the string from which to extract a substring. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The number of characters to extract, starting from the last character. If the number is zero, the function returns an empty string. If the number is greater than the length of the string, the function returns the entire string.
Example
This example creates a computed column that displays the last 5 characters of the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "Right";
var category = "Text";
var categoryFunc = "RIGHT";
 
var arguments = [ {"value":"["+columnName+"]"}, {"value":"5"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
SEARCH
Finds the location of a substring in a string. The substring can contain wildcard characters.
Arguments
value
String. The string pattern to search for. You must enclose the pattern in quotation marks (" "). You can use the following special characters in a pattern:
*An asterisk (*) matches zero or more characters, including spaces. For example, t*n matches tn, tin, and teen.
*A question mark (?) matches exactly one character. For example, t?n matches tan, ten, tin, and ton. It does not match teen or tn.
value
String. Table column name. Defines the string in which to search. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
value
String. The starting position from which to start the search.
Example
This example creates a computed column that displays the location of a string matching the pattern 'a*Cars' in the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "SEARCH";
var category = "Text";
var categoryFunc = "SEARCH";
 
var arguments = [
{"value":"\"a*Cars\""},
{"value":"["+columnName+"]"},
{"value":"1"}
];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
TRIM
Removes the leading and trailing blank characters from a string.
Arguments
value
String. Table column name. The string from which to remove leading and trailing blank characters. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the trimmed value of the product line column.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "Trim";
var category = "Text";
var categoryFunc = "TRIM";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
TRIMLEFT
Removes the leading blank characters from a string.
Arguments
value
String. Table column name. The string from which to remove leading blank characters. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the value of the product line column with no leading spaces.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "TrimLeft";
var category = "Text";
var categoryFunc = "TRIMLEFT";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
TRIMRIGHT
Removes the trailing blank characters from a string.
Arguments
value
String. Table column name. The string from which to remove trailing blank characters. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the value of the product line column with no trailing spaces.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "TrimRight";
var category = "Text";
var categoryFunc = "TRIMRIGHT";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
UPPER
Converts all letters in a string to uppercase.
Arguments
value
String. Table column name. The string to convert to uppercase. The column name description follows the BIRT syntax convention. Use the following syntax:
value:[ColumnName]
Example
This example creates a computed column that displays the product line column value in uppercase.
var columnNameAfter = "PRODUCTCODE";
var columnName = "PRODUCTLINE";
var columnLabel = "Upper";
var category = "Text";
var categoryFunc = "UPPER";
 
var arguments = [ {"value":"["+columnName+"]"} ];
var computedAttrs = {};
computedAttrs.category = {};
computedAttrs.category.function = {};
computedAttrs.category.categoryName = category;
computedAttrs.category.function.functionName = categoryFunc;
computedAttrs.category.function.arguments = arguments;
table.insertComputedColumn( columnNameAfter, columnLabel, computedAttrs);
table.submit( );
moveToLeft
Syntax
void Table.moveToLeft(string columnName)
Moves a column to the left of the current position.
Parameter
columnName
String. The name of the column.
Example
This example moves a column to the left:
var pgContent = viewer.getCurrentPageContent( );
var table = pgContent.getTableByBookmark( bookmark );
table.moveToLeft( columnName );
table.submit( );
moveToRight
Syntax
void Table.moveToRight(string columnName)
Moves a column to the right of the current position.
Parameter
columnName
String. The name of the column.
Example
This example moves a column to the right:
var pgContent = viewer.getCurrentPageContent( );
var table = pgContent.getTableByBookmark( bookmark );
table.moveToRight( columnName );
table.submit( );
removeGroup
Syntax
void Table.removeGroup()
Removes the innermost group.
Example
This example removes the innermost group from myTable and displays an alert box after calling submit( ):
function removeMyGroup(myTable) {
myTable.removeGroup();
myTable.submit(alert("Group removed"));
}
setAlignment
Syntax
void Table.setAlignment(string columnName, string alignment)
Changes the alignment of a given column.
Parameters
columnName
String. The name of the column.
alignment
String. The alignment values can be "right", "left", "center".
Example
This example shows how to align a column to the right:
var pgContent = viewer.getCurrentPageContent( );
var table = pgContent.getTableByBookmark( bookmark );
// right align the column
table.setAlignment( columnName, "right" );
table.submit( );
setFilters
Syntax
void Table.setFilters(actuate.data.Filter filter)
void Table.setFilters(actuate.data.Filter[ ] filters)
Applies a filter or filters to this Table element.
Parameters
filter
actuate.data.Filter object. A single filter condition to apply to this Table.
filters
An array of actuate.data.Filter objects. Filter conditions to apply to this Table.
Example
To add a filter to the Table to display only entries with a CITY value of NYC, use the following code:
var filters = new Array( );
var city_filter = new actuate.data.Filter("CITY", actuate.data.Filter.EQ, "NYC");
filters.push(city_filter);
table.setFilters(filters);
setHeaderAlignment
Syntax
void Table.setHeaderAlignment(string columnName, string alignment)
Changes the alignment of a column header.
Parameters
columnName
String. The name of the column.
alignment
String. The alignment values can be "right", "left", "center".
Example
This example shows how to center a column header:
var pgContent = viewer.getCurrentPageContent( );
var table = pgContent.getTableByBookmark( bookmark );
// center a columnName header
table.setHeaderAlignment( columnName, "center" );
table.submit( );
setSorters
Syntax
void Table.setSorters(actuate.data.Sorter sorter)
void Table.setSorters(actuate.data.Sorter[ ] sorters)
Applies a sorter or sorters to this Table.
Parameters
sorter
actuate.data.Sorter object. A single sort condition to apply to this Table.
sorters
An array of actuate.data.Sorter objects. Sort conditions to apply to this Table.
Example
This example adds the myStateSorter and myCitySorter sorters to myTable:
function setAllMySorters(myTable) {
myTable.setSorters(["myStateSorter", "myCitySorter"]);
}
show
Syntax
void Table.show( )
Shows this element.
Example
Use show( ) to reveal a report Table, as shown in the following code:
myTable.show( );
showColumn
Syntax
void Table.showColumn(string columnName)
Shows the Table column by specifying the column name.
Parameter
enabled
String. The data binding name for the column to display.
Example
This example shows the PRODUCTLINE column in myTable:
function showMyColumn(myTable) {
myTable.showColumn("PRODUCTLINE");
myTable.submit( );
}
showDetail
Syntax
void Table.showDetail(string columnName)
Displays information for a column from the grouped data displayed on the page. If every column is hidden, only the group name is visible.
Parameter
columnName
String. The data binding name for the column to display.
Example
This example shows the information from the PRODUCTLINE column in the grouped data that is displayed for myTable:
function showMyDetail(myTable) {
myTable.showDetail("PRODUCTLINE");
myTable.submit( );
}
submit
Syntax
void Table.submit(function callback)
Submits all the asynchronous operations for this Table element. The submit( ) function triggers an AJAX request to submit all the asynchronous operations. When the server finishes the processing, it returns a response and the results are rendered on the page in the table container.
Parameter
callback
Function. The function called after the asynchronous call processing finishes.
Example
This example clears existing filters from the PRODUCTLINE column and pops up an alert box:
function alertResetFilter(myTable){
myTable.clearFilters("PRODUCTLINE");
myTable.submit(alert("Filters Cleared"));
}
swapColumns
Syntax
void Table.swapColumns(string columnName1, string columnName2)
Swaps the columns to reorder to column sequence of the Table.
Parameters
columnName1
String. The first column to swap in the column order.
columnName2
String. The second column to swap in the column order.
Example
This example swaps the TOTAL and PRODUCTLINE columns in myTable:
function swapMyColumns(myTable){
myTable.swapColumns("TOTAL", "PRODUCTLINE");
myTable.submit( );
}