To use Cognos product documentation, you must enable JavaScript in your browser.

Report Functions

_add_days

Returns the datetime resulting from adding integer_exp days to timestamp_exp.

Syntax
_add_days(timestamp_exp, integer_exp) 

_add_months

Returns the datetime resulting from adding integer_exp months to timestamp_exp.

Syntax
_add_months(timestamp_exp, integer_exp) 

_add_years

Returns the datetime resulting from adding integer_exp years to timestamp_exp.

Syntax
_add_years(timestamp_exp, integer_exp) 

_age

Returns a number that is obtained from subtracting timestamp_exp from today's date in YYYYMMDD format (years, months, days).

Syntax
_age(timestamp_exp) 

_day_of_week

Returns the day of week (between 1 and 7), where 1 is the first day of the week as indicated by integer_exp (between 1 and 7, 1 being Monday and 7 being Sunday). Note that in ISO 8601 standard, a week begins with Monday being day 1. In North America where Sunday is the first day of the week being day 7.

Syntax
_day_of_week(timestamp_exp, integer_exp)  
Example
_day_of_week(2003-01-01, 1) will return 3 because 2003-01-01 was a Wednesday. 

Result: 3

_day_of_year

Returns the ordinal for the day of the year in date_ exp (1 to 366). Also known as Julian day.

Syntax
_day_of_year(timestamp_exp) 

_days_between

Returns a positive or negative number representing the number of days between the two datetime expressions. If timestamp_exp1 < timestamp_exp2 then the result will be a negative number.

Syntax
_days_between(timestamp_exp1, timestamp_exp2) 

_days_to_end_of_month

Returns a number representing the number of days remaining in the month represented by the datetime expression timestamp_exp.

Syntax
_days_to_end_of_month(timestamp_exp) 

_first_of_month

Returns a datetime that is the first day of the month represented by timestamp_exp.

Syntax
_first_of_month(timestamp_exp) 

_last_of_month

Returns a datetime that is the last day of the month represented by timestamp_exp.

Syntax
_last_of_month(timestamp_exp) 

_make_timestamp

Returns a timestamp constructed from integer_exp1 (the year), integer_exp2 (the month) and integer_exp3 (the day). The time portion defaults to 00:00:00.000 .

Syntax
_make_timestamp(integer_exp1, integer_exp2, integer_exp3) 

_months_between

Returns a positive or negative number representing the number of months between the two datetime expressions. If timestamp_exp1 < timestamp_exp2 then the result will be a negative number.

Syntax
_months_between(timestamp_exp1, timestamp_exp2) 

_week_of_year

Returns the number of the week of the year of the timestamp_exp according to the ISO 8601, in which week 1 of the year is the first week of the year to contain a Thursday, which is equivalent to the first week containing January 4th. A week starts on Monday (day1) and ends on Sunday (day7).

Syntax
_week_of_year(timestamp_exp) 

_years_between

Returns a positive or negative integer number representing the number of years from timestamp_exp1 to timestamp_exp2. If timestamp_exp1 < timestamp_exp2 then a negative value is returned.

Syntax
_years_between(timestamp_exp1, timestamp_exp2) 

_ymdint_between

Returns a number representing the difference between the datetime expressions timestamp_exp1 and timestamp_exp2. This value has the form YYYYMMDD, where YYYY represents the number of years, MM represents the number of months, and DD represents the number of days.

Syntax
_ymdint_between(timestamp_exp1, timestamp_exp2) 

abs

Returns the absolute value of numeric_exp. The sign of negative values is changed to positive.

Syntax
abs(numeric_exp) 

AsOfDate

Returns the date value of the As Of Time expression, if it is defined. Otherwise, AsOfDate returns the report execution date.

Syntax
AsOfDate() 

AsOfTime

Returns the time value of the As Of Time expression, if it is defined. Otherwise, AsOfTime returns the report execution time.

Syntax
AsOfTime() 

BurstKey

Returns burst key.

Syntax
BurstKey() 

BurstRecipients

Returns the distribution list of burst recipients.

Syntax
BurstRecipients() 

ceiling

Returns the smallest integer greater than or equal to numeric_exp.

Syntax
ceiling(numeric_exp) 

CellValue

Returns the value of the current crosstab cell.

Syntax
CellValue() 

character_length

Returns the number of characters in string_exp.

Syntax
character_length(string_exp) 

ColumnNumber

Returns the current column number.

Syntax
ColumnNumber() 

CubeCreatedOn

Returns the date and time when the cube was created. The dimension parameter specifies from which cube to retrieve the metadata. If the dimension source is a Cognos PowerCube (.mdc), the function returns a blank string. The initial creation date of a PowerCube is not maintained.

Syntax
CubeCreatedOn(dimension) 

CubeCurrentPeriod

Returns the current period for the cube. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeCurrentPeriod(dimension) 

CubeDataUpdatedOn

Returns the date time that data in the cube was last updated. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeDataUpdatedOn(dimension) 

CubeDefaultMeasure

Returns the name of the default measure for the cube. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeDefaultMeasure(dimension) 

CubeDescription

Returns the description of the cube. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeDescription(dimension) 

CubeIsOptimized

Returns true if the cube is optimized. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeIsOptimized(dimension) 

CubeName

Returns the name of the cube. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeName(dimension) 

CubeSchemaUpdatedOn

Returns the date time that cube schema was last updated. The dimension parameter specifies from which cube to retrieve the metadata.

Syntax
CubeSchemaUpdatedOn(dimension) 

exp

Returns e raised to the power of numeric_exp. The constant e is the base of the natural logarithm.

Syntax
exp(numeric_exp) 

extract

Returns an integer representing the value of datepart_exp ("year", "month", "day", "hour", "minute", "second" (=default)) in datetime_exp.

Syntax
extract(datepart_exp , datetime_exp) 

floor

Returns the largest integer less than or equal to numeric_exp.

Syntax
floor(numeric_exp) 

GetLocale

Returns run locale (deprecated).

Syntax
GetLocale() 

HorizontalPageCount

Returns current horizontal page count.

Syntax
HorizontalPageCount() 

HorizontalPageNumber

Returns current horizontal page number.

Syntax
HorizontalPageNumber() 

InScope

Returns boolean 1 (TRUE) when cell is in the scope of the data items and MUNs; otherwise, 0 (FALSE).

Syntax
InScope(dataItem, MUN, ...) 

IsBursting

Returns boolean 1 (TRUE) when report will be distributed to given recipient; otherwise, 0 (FALSE).

Syntax
IsBursting('recipientName') 

IsCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is a crosstab column node member.

Syntax
IsCrosstabColumnNodeMember() 

IsCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is a crosstab row node member.

Syntax
IsCrosstabRowNodeMember() 

IsFirstColumn

Returns boolean 1 (TRUE) if the current column is the first column.

Syntax
IsFirstColumn() 

IsInnerMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is an innermost crosstab column node member.

Syntax
IsInnerMostCrosstabColumnNodeMember() 

IsInnerMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is an innermost crosstab row node member.

Syntax
IsInnerMostCrosstabRowNodeMember() 

IsLastColumn

Returns boolean 1 (TRUE) if the current column is the last column.

Syntax
IsLastColumn() 

IsLastInnerMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is the last innermost crosstab column node member.

Syntax
IsLastInnerMostCrosstabColumnNodeMember() 

IsLastInnerMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is the last innermost crosstab row node member.

Syntax
IsLastInnerMostCrosstabRowNodeMember() 

IsOuterMostCrosstabColumnNodeMember

Returns boolean 1 (TRUE) if the current node is an outermost crosstab column node member.

Syntax
IsOuterMostCrosstabColumnNodeMember() 

IsOuterMostCrosstabRowNodeMember

Returns boolean 1 (TRUE) if the current node is an outermost crosstab row node member.

Syntax
IsOuterMostCrosstabRowNodeMember() 

IsPageCountAvailable

Returns boolean 1 (TRUE) if the page count is available for the current execution of the report.

Syntax
IsPageCountAvailable() 

ln

Returns the natural logarithm of the numeric_exp.

Syntax
ln(numeric_exp) 

Locale

Returns run locale.

Syntax
Locale() 

lower

Returns string_exp with all uppercase characters shifted to lowercase.

Syntax
lower(string_exp) 

mapNumberToLetter

The user should supply the initial letter and the number is added to it.

Syntax
mapNumberToLetter(string_exp, integer_exp) 
Example
mapNumberToLetter ('a', 1) will result in 'b'. 

Result: 'b'

mod

Returns the integer value of the remainder (modulo) when integer_exp1 is divided by integer_exp2.

Syntax
mod (integer_exp1, integer_exp2) 

ModelPath

Returns model path.

Syntax
ModelPath() 

Now

Returns current system time.

Syntax
Now() 

nullif

Returns NULL if string_exp1 equals string_exp2 (case insensitive), otherwise returns string_exp1.

Syntax
nullif(string_exp1, string_exp2) 

octet_length

Returns the number of bytes in string_exp.

Syntax
octet_length(string_exp) 

PageCount

Returns the current page count. If you run the report, this function works only when the report output is PDF or Excel. If you save the report output, this function works for all formats.

Syntax
PageCount() 

PageName

Returns the current page name.

Syntax
PageName() 

PageNumber

Returns current page number.

Syntax
PageNumber() 

ParamCount

Returns parameter count of the variable identified by parameterName.

Syntax
ParamCount('parameterName') 

ParamDisplayValue

Returns a string that is the parameter display value of the variable identified by parameterName.

Syntax
ParamDisplayValue('parameterName') 

ParamName

Returns parameter name of the variable identified by parameterName.

Syntax
ParamName('parameterName') 

ParamNames

Returns all parameter names.

Syntax
ParamNames() 

ParamValue

Returns a string that is the parameter value of the variable identified by parameterName.

Syntax
ParamValue('parameterName') 

position

Returns the integer value representing the starting position of string_exp1 in string_exp2 or 0 when string_exp1 is not found.

Syntax
position(string_exp1, string_exp2) 

power

Returns num_exp1 raised to the power of num_exp2.

Syntax
power(num_exp1, num_exp2) 

ReportAuthorLocale

Returns author locale.

Syntax
ReportAuthorLocale() 

ReportCreateDate

Returns the date when the report was created.

Syntax
ReportCreateDate() 

ReportDate

Returns report execution date and time.

Syntax
ReportDate() 

ReportDescription

Returns report description. This function works only when the report is run from Cognos Connection.

Syntax
ReportDescription() 

ReportID

Returns the report id.

Syntax
ReportID() 

ReportLocale

Returns run locale.

Syntax
ReportLocale() 

ReportName

Returns report name. This function works only when the report is run from Cognos Connection.

Syntax
ReportName() 

ReportOption

Returns the value of run option variable identified by optionName. Possible values for optionName: attachmentEncoding, burst, cssURL, email, emailAsAttachment, emailAsURL, emailBody, emailSubject, emailTo, emailToAddress, history, metadataModel, outputEncapsulation, outputFormat, outputLocale, outputPageDefinition, outputPageOrientation, primaryWaitThreshold, print, printer, printerAddress, prompt, promptFormat, saveAs, saveOutput, secondaryWaitThreshold, verticalElements, xslURL.

Syntax
ReportOption('optionName') 

ReportOutput

Returns the name of the output format. Possible return values: CSV, HTML, layoutDataXML, MHT, PDF, rawXML, singleXLS, spreadsheetML, XLS, XML, XLWA.

Syntax
ReportOutput() 

ReportPath

Returns report path. This function works only when the report is run from Cognos Connection.

Syntax
ReportPath() 

ReportProductLocale

Returns product locale.

Syntax
ReportProductLocale() 

ReportSaveDate

Returns the date when the report was last saved.

Syntax
ReportSaveDate() 

round

Returns numeric_exp rounded to the nearest value integer_exp places right of the decimal point. If integer_exp is negative, numeric_exp is rounded to the nearest value absolute (integer_exp) places to the left of the decimal point.

Syntax
round(numeric_exp, integer_exp) 
Example
round (125, -1) rounds to 130. 

Result: 130.

RowNumber

Returns current row.

Syntax
RowNumber() 

ServerLocale

Returns the locale of the server that runs the report.

Syntax
ServerLocale() 

ServerName

Returns the name of the server that runs the report.

Syntax
ServerName() 

sqrt

Returns the square root of numeric_exp. numeric_exp must be non-negative.

Syntax
sqrt(numeric_exp) 

substring

Returns the substring of string_exp that starts at position integer_exp1 for integer_exp2 characters or to the end of string_exp if integer_exp2 is -1. The first character in string_exp is at position 1.

Syntax
substring(string_exp , integer_exp1, integer_exp2) 

TOCHeadingCount

Returns the table of contents heading count for a specific heading level.

Syntax
TOCHeadingCount(headingLevel) 

Today

Returns current system date.

Syntax
Today() 

trim

Returns a string_exp trimmed of leading and/or trailing blanks or trimmed of a character specified in match_character_exp. trim_what_exp may be: "LEADING", "TRAILING" or "BOTH" (default). match_character_exp = empty string to trim blanks, or specifies a character to be trimmed. String_exp = the string to be trimmed.

Syntax
trim(trim_what_exp, match_character_exp, string_exp) 

upper

Returns string_exp with all lowercase characters shifted to uppercase.

Syntax
upper(string_exp) 

URLEncode

Returns the url encoded value of the input text.

Syntax
URLEncode('text') 

Data Type Casting Functions

date2string

Returns a date as string in YYYY-MM-DD format.

Syntax
date2string(date_exp) 

date2timestamp

Converts a date to a timestamp. The time part of the timestamp will be zero.

Syntax
date2timestamp(date_exp) 

date2timestampTZ

Converts a date to a timestamp with time zone. The time and time zone parts of the timestamp will be zero.

Syntax
date2timestampTZ(date_exp) 

DTinterval2string

Returns a date time interval as string in "DDDD HH:MM:SS.FFFFFFF" or "-DDDD HH:MM:SS.FFF" format.

Syntax
DTinterval2string(DTinterval_exp) 

DTinterval2stringAsTime

Returns a date time interval as string. The days are converted to hours. Output format: "HHHH:MM:SS.FFFFFFF" or "HH:MM:SS.FFF".

Syntax
DTinterval2stringAsTime(DTinterval_exp) 

int2DTinterval

Converts an integer to a date time interval. String_exp specifies what the integer_exp is representing: "ns"=nanoseconds, "s"=seconds (=default), "m"=minutes, "h"=hours, "d"=days.

Syntax
int2DTinterval(integer_exp, string_exp) 

int2YMinterval

Converts an integer to a year month interval. String_exp specifies what the integer_exp is representing: "y"=years, "m"=months (=default).

Syntax
int2YMinterval(integer_exp, string_exp) 

number2string

Converts a number to a string, using the %g format specifier (C/C++ syntax).

Syntax
number2string(num_exp) 

string2date

Returns a date string as date in "YYYY-MM-DD" format.

Syntax
string2date(string_exp) 

string2double

Returns a floating point number. The string argument to the function "string2double" has the following form:"[whitespace] [sign] [digits] [digits] [ {d | D |e | E }[sign]digits]"

Syntax
string2double(string_exp) 

string2DTinterval

Returns a date-time interval string as Date Time Interval in "[-]DD HH:MM[:SS[.FFF]]" format.

Syntax
string2DTinterval(string_exp) 

string2int32

Returns an integer. The string argument to the function "string2int32" has the following form: "[whitespace] [{+ | -}] [digits]"

Syntax
string2int32(string_exp) 

string2int64

Returns a long integer. The string argument to the function "string2int64" has the following form: "[whitespace] [{+ | -}] [digits]"

Syntax
string2int64(string_exp) 

string2time

Returns a time string as time in "HH:MM:SS.FFFFFFF" format.

Syntax
string2time(string_exp) 

string2timestamp

Returns a timestamp string as timestamp in "YYYY-MM-DD [white space]+ HH:MM:SS.FFFFFFF" format.

Syntax
string2timestamp(string_exp) 

string2timestampTZ

Returns a timestamp with time zone "YYYY-MM-DD HH:MM:SS.FFFFFFF +HHMM" or "YYYY-MM-DD HH:MM:SS.FFF -HHMM" format.

Syntax
string2timestampTZ(string_exp) 

string2YMinterval

Returns a year-month interval string as Year Month Interval in "[-]YY MM" format.

Syntax
string2YMinterval(string_exp) 

time2string

Returns a time as string in HH:MM:SS.FFF format.

Syntax
time2string(time_exp) 

timestamp2date

Converts a timestamp to a date. The time part of the timestamp will be ignored.

Syntax
timestamp2date(timestamp_exp) 

timestamp2string

Returns a timestamp as string in YYYY-MM-DD HH:MM:SS.FFFFFFF format.

Syntax
timestamp2string(timestamp_exp) 

timestamp2timestampTZ

Converts a timestamp to a timestamp with time zone. The displacement part of the timestamp with time zone will be zero.

Syntax
timestamp2timestampTZ(timestamp_exp) 

timestampTZ2date

Converts a timestamp with time zone to a date. The time and time zone parts of the timestamp will be ignored.

Syntax
timestampTZ2date(timestampTZ_exp) 

timestampTZ2string

Returns a timestamp with time zone as string in "YYYY-MM-DD HH:MM:SS.FFFFFFF +HHMM" or "YYYY-MM-DD HH:MM:SS.FFF -HHMM" format.

Syntax
timestampTZ2string(timestampTZ_exp) 

timestampTZ2timestamp

Converts a timestamp with time zone to a timestamp. The displacement part of the timestamp with time zone will be ignored.

Syntax
timestampTZ2timestamp(timestampTZ_exp) 

timeTZ2string

Returns a time with time zone as string in "HH:MM:SS.FFF +HHMM" or "HH:MM:SS.FFFFFFF -HHMM" format.

Syntax
timeTZ2string(timeTZ_exp) 
Example
"-05:30" means a TimeZone of GMT minus 5 hours and 30 minutes. 

Result: GMT minus 5 hours and 30 minutes

YMinterval2string

Returns a year month interval as string in "(YY MM)" or "-(YY MM)" format.

Syntax
YMinterval2string(YMinterval_exp)