Articles in this section
Category / Section

Built-In Function Expressions in Bold Reports

Published:
Updated:

Using Bold Reports Query Expression gives you access to a wide range of built-in functions that can help you manipulate and analyze your data effectively. These functions are organized into different categories, including Global, User, Text, Date & Time, Math function expressions, and more. In this article, we’ll explore these functions and provide you with their syntax and descriptions.

Math Expressions

These functions are primarily focused on mathematical operations, including trigonometric functions, logarithms, and basic arithmetic operations.

Functions

Descriptions

Syntax Example

Abs

Returns the absolute value of a single-precision floating-point number.

=Abs(Fields!YearlyIncome.Value - 80000)

Acos

Returns the angle whose cosine is the specified number.

=Acos(Fields!Angle.Value)

Asin

Returns the angle whose sine is the specified number.

=Asin(Fields!Angle.Value)

Atan

Returns the angle whose tangent is the specified number.

=Atan(Fields!Tangent.Value)

Atan2

Returns the angle whose tangent is the quotient of two specified number.

=Atan2(Fields!CoordinateY.Value, Fields!CoordinateX.Value)

BigMul

Produces the full product of two 32-bit numbers.

=BigMul(Fields!Int32Value.Value, Fields!Int32Value.Value)

Ceiling

Returns the smallest integer that is greater than or equal to the specified integer.

=Ceiling(Fields!YearlyIncome.Value / 7)

Cos

Returns the cosine of the specified angle.

=Cos(Fields!Angle.Value)

Cosh

Returns the hyperbolic cosine of the specified angle.

=Cosh(Fields!Angle.Value)

Exp

Returns e raised to the specified power.

=Exp(Fields!IntegerCounter.Value)

Fix

Returns an integer portion of a number.

=Fix(Fields!YearlyIncome.Value / -3)

Floor

Returns the largest integer less than or equal to the specified integer.

=Floor(Fields!YearlyIncome.Value / 12)

Int

Returns an integer portion of a number.

=Int(Fields!YearlyIncome.Value / 12)

Log

Returns the natural (base e) logarithm of a specified number.

=Log(Fields!NumberValue.Value)

Log10

Returns the base 10 logarithm of a specified number.

=Log10(Fields!NumberValue.Value)

Max

Returns the maximum value from all non-null values of the specified expression.

=Max(Fields!YearlyIncome.Value, “AdventureWorks”, Recursive)

Min

Returns the minimum value from all non-null values of the specified expression.

=Min(Fields!YearlyIncome.Value, “AdventureWorks”, Recursive)

Pow

Returns a specified number raised to the specified power.

=Pow(Fields!YearlyIncome.Value, 2)

Rnd

Returns a random number of single type.

=Rnd(-1)

Round

Rounds a double-precision floating-point value to the nearest integer.

=Round(Fields!YearlyIncome.value / 12, 2)

Sign

Returns a value indicating the sign of an 8-bit signed integer.

=Sign(Fields!YearlyIncome.Value - 60000)

Sin

Returns the sine of the specified angle.

=Sin(Fields!Angle.Value)

Sinh

Returns the hyperbolic sine of the specified angle.

=Sinh(Fields!Angle.Value)

Sqrt

Returns the square root of a specified number.

=Sqrt(Fields!Area.Value)

Tan

Returns the tangent of the specified angle.

Tan(Fields!Angle.Value)

Global Expressions

Global expressions provide access to various global parameters related to the report, such as execution time and report server URL.

Functions

Descriptions

Syntax Example

ExecutionTime

The date and time that the report starts to run.

=Globals!ExecutionTime

OverallPageNumber

The current overall page number can be used only in the page header or footer.

=Globals!OverallPageNumber

OverallTotalPages

The total number of pages in the report can be used only in the page header and footer.

=Globals!OverallTotalPages

PageName

The name of the current page in the report can be used only in the page header and footer.

=Globals!PageName

PageNumber

The current page number that can be reset through the use of page breaks.

=Globals!PageNumber

RenderFormat.IsInteractive

A boolean that indicates whether the current rendering request uses an interactive format.

=Globals!RenderFormat.IsInteractive

RenderFormat.Name

The name of the renderer as registered in the ReportServer configuration file.

=Globals!RenderFormat.Name

ReportFolder

The full path to the folder containing the report does not include the report server URL.

=Globals!ReportFolder

ReportName

The URL of the report server where the report is run.

=Globals!ReportName

ReportServerUrl

The URL of the report server on which the report is being run.

=Globals!ReportServerUrl

TotalPages

The total number of pages in the current continuous page sequence can be used only in the page header and footer. The number can be reset by using page breaks.

=Globals!TotalPages

User Expressions

User expressions offer information about the client running the report, such as language and user ID.

Functions

Descriptions

Syntax Example

Language

The Language ID of the client running the report.

User!Language

USerID

The ID of the user running the report.

User!UserID

Text Expressions

Text expressions are geared towards manipulating and formatting text data, including functions to extract characters, format strings, and search within strings.

Functions

Description

Syntax Example

Asc

Returns an integer value representing the character code corresponding to a character.

=Asc(Fields!Description.Value)

AscW

Returns an integer value representing the character code corresponding to a character.

=AscW(Fields!Description.Value)

Chr

Returns the character associated with the specified character code.

=Chr(65)

ChrW

Returns the character associated with the specified character code.

=ChrW(241)

Filter

Returns a zero-based array containing a subset of a string array based on specified filter criteria.

=Filter(Parameters!MultivalueParameter.Value, “3”, True, CompareMethod.Binary)

Format

Returns a formatted string according to the instructions in a format string expression.

=Format(Globals!ExecutionTime, “Long Date”)

FormatCurrency

Returns an expression formatted as a currency value using the currency symbol defined in the system control panel.

=FormatCurrency(Fields!YearlyIncome.Value, 0)

FormatDateTime

Returns a string expression representing a date.

=FormatDateTime(Fields!BirthDate.Value, Date)

FormatNumber

Returns a string expression representing a date/time value.

=FormatNumber(Fields!Weight.Value, 2)

FormatPercent

Returns an expression formatted as a percentage (that is multiplied by 100).

=FormatPercent(Fields!Sales.Values/Sum(Fields!Sales.Value, “DataSet1”), 0)

GetChar

Returns a char value representing the character from the specified index in the supplied string.

=GetChar(Fields!Description.Value, 5)

InStr

Returns an integer specifying the start position of the first occurrence of one string within another.

=InStr(Fields!Description.Value, “car”)

InStrRev

Returns the position of the first occurrence of one string within another, starting from the right side of the string.

=InStrRev(Fileds!Description.Value, “car”)

Join

Returns a string created by joining a number of substrings in an array.

=Join(Parameters!MultivalueParameter.Value, “,”)

LCase

Returns a string or character converted to lowercase.

=LCase(Fields!Description.Value)

Left

Returns a string containing a specified number of characters from the left side of the string.

=Left(Fields!Description.Value, 4)

Len

Returns an integer containing either the number of characters in a string or the number.

=Len(Fields!Description.Value)

LSet

Returns a left-aligned string containing the specified string adjusted to the specified length.

=LSet(Fields!Description.Value, 4)

LTrim

Returns the string without left side trailing spaces in the given string.

=LTrim(Fields!Description.Value)

Mid

Returns a string containing a specified number of characters from a string.

=Mid(Fields!Description.Value,3,4)

Replace

Returns a string in which a specified substring has been replaced with another.

=Replace(Fields!Description.Value, “tube”, “headlight”)

Right

Returns a string containing a specified number of characters from the right side of a string.

=Right(Fields!Description.Value,4)

Rset

Returns a right-aligned string containing the specified string adjusted to the specified length.

=RSet(Feilds!Description.Value,4)

RTrim

Returns the string without right side trailing spaces in the given string.

=RTrim(Fields!Description.Value)

Space

Returns a string consisting of the specified number of spaces.

=Space(3)

Split

Returns a zero-based, one-dimensional array containing a specified number of substrings.

=Split(Fields!ListWithCommas.Value,“,”)

StrComp

Returns -1, 0, or 1, based on the result of a string comparison.

=StrComp(Fields!Description.Value,First(Fields!Description.Value))

StrConv

Returns a string converted as specified.

=StrConv(Fields!Description.Value, vbProperCase)

StrDup

Returns a string or object consisting of the specified character repeated the specified number of times.

=StrDup(3, “M”)

StrReverse

Returns a string in which the character order of a specified string is reversed.

=StrReverse(Fields!Description.Value)

Trim

Returns the string without trailing spaces in the given string.

=Trim(Fields!Description.Value)

UCase

Returns a string or character containing the specified string converted to uppercase.

=UCase(Fields!Description.Value)

Inspection Expressions

Inspection expressions serve various purposes related to inspecting data and conditions within the report.

Functions

Description

Syntax Example

IsArray

Returns a Boolean value indicating whether a variable points to an array.

=IsArray(Parameters!Initials.Value)

IsDate

Returns a Boolean value indicating whether an expression represents a valid date.

=IsDate(Fields!BirthDate.Value)

IsNothing

Returns a Boolean value indicating whether an expression has no object.

=IsNothing(Fields!MiddleInitial.Value)

IsNumeric

Returns a Boolean value indicating whether an expression can be evaluated as a number.

=IsNumeric(Fields!YearlyIncome.Value)

Program Flow Expressions

Program Flow expressions help control the flow of report logic based on conditions, such as using the IIf function for conditional branching

Functions

Description

Syntax Example

Choose

Selects and returns a value from a list of arguments.

=Choose(Datepart(“w”, Fields!BirthDate.Value), “First”, “Second”, “Third”, “Fourth”, “Fifth”, “Sixth”, “Seventh”)

IIf

Returns one of two objects depending upon the evaluation of an expression.

=IIf(Fields!YearlyIncome.Value >= 60000,“High”,“Low”)

Switch

Evaluates a list of expressions and returns an object value corresponding to the first expression in the list that is true.

=Switch(Fields!FirstName.Value = “Sue”, “Susan”,Fields!FirstName.Value = “Bob”, “Robert”)

Aggregate Expression

Aggregate expressions are used for performing aggregate operations on data, such as calculating averages, sums, counts, and more.

Functions

Description

Syntax Example

Avg

Returns the average of all non-null values from the specified expression.

=Avg(Fields!YearlyIncome.Value, “GroupByGender”, Recursive)

Count

Returns a count of the values from the specified expression.

=Count(Fields!FirstName.Value, “GroupByInitial”, Recursive)

CountDistinct

Returns a count of all distinct values from the specified expression.

=CountDistinct(Fields!MiddleInitial.Value, “GroupInitial”, Recursive)

CountRows

Returns a count of rows within the specified scope.

=CountRows(“GroupByInitial”,Recursive)

First

Returns the first value from the specified expression

=First(Fields!MiddleInitial.Value, “AdventureWorks”)

Last

Returns the last value from the specified expression.

=Last(Fields!MiddleInitial.Value, “AdventureWorks”)

Max

Returns the maximum value from all non-null values of the specified expression.

=Max(Fields!YearlyIncome.Value, “AdventureWorks”, Recursive)

Min

Returns the minimum value from all non-null values of the specified expression.

=Min(Fields!YearlyIncome.Value, “AdventureWorks”, Recursive)

StDev

Returns the standard deviation of all non-null values of the specified expression.

=StDev(Fields!YearlyIncome.Value,“GroupByInitial”, Recursive)

StDevP

Returns the population standard deviation of all non-null values of the specified expression.

=StDevP(Fields!YealryIncome.Value, “GroupByInitial”,Recursive)

Sum

Returns a sum of the values of the specified expression.

=Sum(Fields!YearlyIncome.Value,“GroupByInitial”,Recursive)

Var

Returns the variance of all non-null values of the specified expression.

=Var(Fields!YearlyIncome.Value,“GroupByInitial”,Recursive)

VarP

Returns the population variance of all non-null values of the specified expression.

=VarP(Fields!YearlyIncome.Value,“GroupByInitial”)

RunningValue

Uses a specified function to return a running aggregate of the specified expression.

=RunningValue(Fields!YearlyIncome.Value,Sum,“AdventureWorks”)

Aggregate

Returns a custom aggregate of the specified expression, as defined by the data provider.

=Aggregate(Fields!Order_Count.Value)

Financial Expression

Financial expressions are specialized functions for financial calculations, including depreciation, future value, and interest rate calculations.

Functions

Description

Syntax Example

DDB

Returns a double value specifying the depreciation of an asset for a specific time period using the double-declining balance method or some other method you specify.

=DDB(Fields!CostOfProperty.Value,Fields!Salvage.Value,Parameters!Life.Value,Parameters!Period.Value,2)

FV

Returns a double value specifying the future value of an annuity based on periodic fixed payments and a fixed interest rate.

=FV(Parameters!Rate.Value,Parameters!NumberOfPayments.Value,Parameters!PaymentAmount.Value,Fields!PropertyCost.Value,DueDate.EndOfPeriod)

IPmt

Returns a double value specifying the interest payment for a given period of an annuity based on periodic, fixed payments and a fixed interest rate.

=IPmt(Parameters!Rate.Value, Parameters!PaymentPeriod.Value, Parameters!NumberOfPayments.Value, Parameters!PresentValue.Value, 0,DueDate.EndOfPeriod)

NPer

Returns a double value specifying the number of periods for an annuity based on periodic fixed payments and a fixed interest rate.

=NPer(Parameters!Rate.Value,Parameters!PaymentAmount.Value,Parameters!PresentValue.Value,0,DueDate.EndOfPeriod)

Pmt

Returns a double value specifying the payment for an annuity based on periodic, fixed payments and a fixed interest rate.

=Pmt(Parameters!Rate.Value,Parameters!NumberOfPayments.Value,Fields!PropertyCost.Value,0, DueDate.EndOfPeriod)

PPmt

Returns a double value specifying the principal payment for a given period of an annuity based on periodic fixed payments and a fixed interest rate.

=PPmt(Parameters!Rate.Value,Parameters!Period.Value,Parameters!NumberOfPayments.Value,Fields!PropertyCost.Value,0,DueDate.EndOfPeriod)

PV

Returns a double value specifying the present value of an annuity based on periodic, fixed payments to be paid in the future and a fixed interest rate.

=PV(Parameters!Rate.Value,Parameters!NumberOfPayments.Value,Fields!PaymentAmount.Value,0,DueDate.EndOfPeriod)

Rate

Returns a double value specifying the interest rate per period for an annuity.

=Rate(Parameters!NumberOfPayments.Value,Parameters!PaymentAmount.Value,Parameters!PresentValue.Value,DueDate.EndOfPeriod,0.1)

SLN

Returns a double value specifying the straight-line depreciation of an asset for a single period.

=SLN(Fields!PropertyCost.Value,Parameters!Salvage.Value,Parameters!Life.Value)

SYD

Returns a double value specifying the sum-of-years digits depreciation of an asset for a specified period.

=SYD(Fields!PropertyCost.Value,Parameters!Salvage.Value,Parameters!Life.Value,Parameters!Period.Value)

Miscellaneous Expressions

Miscellaneous expressions include functions for specific tasks like looking up values in datasets, determining scope, and retrieving values from previous rows.

Functions

Description

Syntax Example

InScope

Returns true if the current instance is within the specified scope.

=InScope(“table1_Group1”)

Level

Returns a zero-based integer representing the current depth level.of a recursive hierarchy.

=Level(“GroupByInitial”)

Lookup

Use Lookup to retrieve the value from the specified dataset for a name-value pair where there is a 1-to-1 relationship. For example, for an ID field in a table, you can use Lookup to retrieve the corresponding Name field from a dataset that is not bound to the data region.

=Lookup(Fields!SaleProdId.Value, Fields!ProductID.Value, Fields!Name.Value, “Product”)

LookupSet

Use LookupSet to retrieve a set of values from the specified dataset for a name-value pair where there is a 1-to-many relationship. For example, for a customer identifier in a table, you can use LookupSet to retrieve all the associated phone numbers for that customer from a dataset that is not bound to the data region.

=LookupSet(Fields!TerritoryGroupID.Value, Fields!TerritoryID.Value, Fields!StoreName.value, “Stores”)

Previous

Returns the value of the expression for the previous row of data.

=Previous(Fields!FirstName.Value)

RowNumber

Returns a running count of all rows in the specified scope.

=RowNumber(“AdventureWorks”)

Conversion Expressions

Conversion expressions are designed for data type conversions, allowing users to convert data from one type to another.

Functions

Description

Syntax Example

CBool

Convert to Boolean.

=CBool(Fields!HouseOwnerFlag.Value)

CByte

Convert to byte.

=CByte(Fields!Number.Value)

CChar

Convert to char.

=CChar(Fields!MaritalStatus.Value)

CDate

Convert to date.

=CDate(Fields!BirthDate.Value)

CDbl

Convert to double.

=CDbl(Fields!YearlyIncome.Value)

CDec

Convert to decimal.

=CDec(Fields!YearlyIncome.Value)

CInt

Convert to integer.

=CInt(Fields!YearlyIncome.Value)

CLng

Convert to long.

=CLng(Fields!YearlyIncome.Value)

CObj

Convert to object.

=CObj(Fields!YearlyIncome.Value)

CShort

Convert to short.

=CShort(Fields!NumberCarsOwned.Value)

CSng

Convert to single.

=CSng(Fields!YearlyIncome.Value)

CStr

Convert to string.

=CStr(Fields!YearlyIncome.Value)

Fix

Returns an integer portion of a number.

=Fix(Fields!YearlyIncome.Value / -3)

Hex

Returns a string representing the hexadecimal value of a number.

=Hex(Fields!CellColor.Value)

Int

Returns an integer portion of a number.

=Int(Fields!YearlyIncome.Value / 12)

Oct

Returns a string representing the octal value of a number.

=Oct(Fields!BitString.Value)

Str

Returns a string that represents a number.

=Str(Fields!YearlyIncome.Value)

Val

Returns numbers in a string as a numeric value of appropriate type.

=Val(Fields!AddressLine1.Value)

Date & Time Expressions

Date & Time expressions provide functions for working with date and time data, including date arithmetic, formatting, and extraction.

Functions

Description

Syntax Example

CDate

Convert to date.

=CDate(Fields!BirthDate.Value)

DateAdd

Returns a date value containing date and time values to which a specified time interval has been added.

=DateAdd(“d”,3,Fields!BirthDate.Value)

DateDiff

Returns a long value specifying the number of time intervals between two date values.

=DateDiff(“yyyy”,Fields!BirthDate.Value,“1/1/2010”)

DatePart

Returns an integer value containing the specified component of a given date value.

=DatePart(“q”,Fields!BirthDate.Value,0,0)

DateSerial

Returns a date value representing a specified year, month, and day, with the time information set to midnight (00:00:00).

=DateSerial(DatePart(“yyyy”,Fields!BirthDate.Value)-10, DatePart(“m”,Fields!BirthDate.Value)+3,DatePart(“d”,Fields!BirthDate.Value)-1)

DateString

Returns or sets a string value representing the current date according to your system.

=DatePart(“m”, DateString())

DateValue

Returns a date value containing the date information represented by a string, with the time information.

=DateValue(“January 15, 2010”)

Day

Returns an integer value from 1 through 31 representing the day of the month.

=Day(Fields!BirthDate.Value)

FromatDateTime

Returns a string expression representing date/time value.

=FormatDateTime(Fields!BirthDate.Value,DateFormat.ShortDate)

Hour

Returns an integer value from 0 through 23 representing the hour of the day.

=Hour(Fields!BirthDate.Value)

Minuite

Returns an integer value from 0 through 59 representing the minute of the hour.

=Minute(Fields!BirthDate.Value)

Month

Returns an integer value from 1 through 12 representing the month of the year.

=Month(Fields!BirthDate.Value)

MonthName

Returns a string value containing the name of the specified month.

=MonthName(10,True)

Now

Returns a date value containing the current date and time according to your system.

="This time tomorrow is " & DateAdd(“d”, 1, Now())

Second

Returns an integer value from 0 through 59 representing the second of the minute.

=Second(Fields!BirthDate.Value)

TimeOfDay

Returns or sets a date value containing the current time of day according to your system.

="Time of the day is " & TimeOfDay()

Timer

Returns a double value representing the number of seconds elapsed since midnight.

="Number of seconds since midnight " & Timer()

TimeSerial

Returns a date value representing a specified hour, minute, and second, with the date information set relative to January 1 of the year 1.

=TimeSerial(DatePart(“h”,Fields!BirthDate.Value),DatePart(“n”,Fields!BirthDate.Value),DatePart(“s”,Fields!BirthDate.Value))

TimeString

Returns or sets a string value representing the current time of day according to your system.

=TimeString()

TimeValue

Returns a date value containing the time information represented by a string, with the date information set to January 1 of the year 1.

= TimeValue(Fields!BirthDate.Value)

Today

Returns or sets a date value containing the current date according to your system.

="Tomorrow is " & DateAdd(“d”, 1, Today())

Weekday

Returns an integer value containing a number that represents the day of the week.

=Weekday(Fields!BirthDate.Value,0)

WeekdayName

Returns a string value containing the name of the specified weekday.

=WeekdayName(2,True,0)

Year

Returns an integer value from 1 through 9999 representing the year.

=Year(Fields!BirthDate.Value)

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied