Cognos 简明教程

Cognos - Report Functions

Cognos 报告中可以使用各种报表函数。

There are various Report functions that can be used in a Cognos report.

其中一些不同的报表函数包括 −

Some of these different report functions include −

_days_between

此函数用于返回一个正数或负数,代表两个 datetime 表达式之间的天数。如果 timestamp_exp1 < timestamp_exp2,则结果将为负数。

This function is used to return a positive or a negative number representing the number of days between the two datetime expressions. If a timestamp_exp1 < timestamp_exp2 then the result will be a –ve number.

How to use

_days_between(timestamp_exp1, timestamp_exp2)

_days_to_end_of_month

此函数用于返回一个数字,表示由 datetime 表达式 timestamp_exp 表示的月份中剩余的天数。

This function is used to return a number representing the number of days remaining in the month represented by the datetime expression timestamp_exp.

How to use

_days_to_end_of_month(timestamp_exp)

_first_of_month

此函数用于返回一个 datetime,它是 timestamp_exp 表示的月份的第一天。

This function is used to return a datetime that is the first day of the month represented by timestamp_exp.

_add_days

此函数用于返回在 timestamp_exp 中添加 integer_exp 天所产生的 datetime。

This function is used to return the datetime resulting from adding integer_exp days to timestamp_exp.

How to use

_add_days(timestamp_exp, integer_exp)

_add_months

此函数用于返回在 timestamp_exp 中添加 integer_exp 月所产生的 datetime。

This function is used to return the datetime resulting from adding integer_exp months to timestamp_exp.

How to use

_add_months(timestamp_exp, integer_exp)

_add_years

此函数用于返回在 timestamp_exp 中添加 integer_exp 年所产生的 datetime。

This function is used to return the datetime resulting from adding integer_exp years to timestamp_exp.

How to use

_add_years(timestamp_exp, integer_exp)

_age

此函数用于返回一个数字,它是从今天 YYYYMMDD 格式(年、月、日)中的日期中减去 timestamp_exp 而获得的。

This function is used to return a number that is obtained from subtracting timestamp_exp from today’s date in YYYYMMDD format (years, months, days).

How to use

_age(timestamp_exp)

_day_of_week

此函数用于返回星期几(1 到 7 之间),其中 1 是星期几的第一天,如 integer_exp(1 到 7 之间,1 为星期一,7 为星期日)所示。请注意,在 ISO 8601 标准中,星期一为第 1 天。在北美,星期日为星期的第一天为第 7 天。

This function is used to return 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.

How to use

_day_of_week(timestamp_exp, integer_exp)

_day_of_year

此函数用于返回 date_exp 中的年第几天(1 到 366)的序数。也称为儒略日。

This function is used to return the ordinal for the day of the year in date_ exp (1 to 366). Also known as the Julian day.

How to use

_day_of_year(timestamp_exp)

像这些一样,还有其他各种可用的报表函数。

Like these, there are various other Report functions as well that can be used.