Formulas in Pebble Reports

Pebble Reports formulas are written in Visual Basic.NET syntax.

screenshot

Operators

Add/Subtract/Multiply/Divide  + - * /
Integer division\
Join strings&
Equals comparison=
Not Equals comparison<>
Less Than comparison<
Greater Than comparison>
Less Than or Equals<=
Greater Than or Equals>=
Remaindermod
Not/And/Or/Xornot and or xor
Parentheses()

Strings should be enclosed in double quotes, as in "hello".

Examples

Simple calculation

Here's how you calculate Profit from SalePrice and PurchasePrice fields:
SalePrice - PurchasePrice

Putting text together

Here's how you construct FullName from FirstName and LastName fields:
FirstName & " " & LastName

Functions

For security reasons Pebble Reports does not allow unrestricted access to the .NET Framework. The functions listed below are the only functions you can call.

See Microsoft Visual Basic Functions reference for detailed information about these functions.


Text manipulation

Format(expression, style)
Formats a value using specified style.
Example: Format(OrderDate, "M/d/yyyy")
See date formats, number formats
Len(str)
Gets the length of a string.
StrComp(str1, str2)
Returns -1, 0, or 1, based on the result of a string comparison.
Replace(expression, find, replacement)
Returns a string in which a specified substring has been replaced with another substring.
InStr(stringCheck, stringSearch)
Returns an integer specifying the start position of the first occurrence of one string within another.
InStrRev(stringCheck, stringSearch)
Returns the position of the last occurrence of one string within another.
Left(str, length)
Returns a string that contains a specified number of characters from the left side of a string.
Right(str, length)
Returns a string containing a specified number of characters from the right side of a string.
Mid(str, start, length)
Returns a string containing a specified number of characters from a string starting at the specified position.
GetChar(str, index)
Returns the character at the specified index in the supplied string.
LTrim(str)
Removes spaces from the left side of the supplied string.
RTrim(str)
Removes spaces from the right side of the supplied string.
Trim(str)
Removes spaces from the left and right sides of the supplied string.
LCase(str)
Converts the supplied string to lower case.
UCase(str)
Converts the supplied string to upper case.
TitleCase(str)
Converts the first character of each word in the string to uppercase and the rest of the characters to lowercase.

Date / time manipulation

DateAdd(interval, number, dateValue)
Returns a Date value containing a date and time value to which a specified time interval has been added.
DateDiff(interval, date1, date2)
Returns the number of time intervals between two Date values.
DatePart(interval, dateValue)
Returns an Integer value containing the specified component of a given Date value.
DateSerial(year, month, day)
Returns a Date value representing a specified year, month, and day, with the time information set to midnight (00:00:00).
DateValue(stringDate)
Returns a Date value containing the date information represented by a string, with the time information set to midnight (00:00:00).
Day(dateValue)
Returns an Integer value from 1 through 31 representing the day of the month.
Hour(timeValue)
Returns an Integer value from 0 through 23 that represents the hour of the day.
Minute(timeValue)
Returns an Integer value from 0 through 59 that represents the minute of the hour.
Month(dateValue)
Returns an Integer value from 1 through 12 representing the month of the year.
MonthName(month, abbreviate)
Returns a String value containing the name of the specified month.
Second(timeValue)
Returns an Integer value from 0 through 59 that represents the second of the minute.
TimeSerial(hour, minute, second)
Returns a Date value representing a specified hour, minute, and second, with the date information set relative to January 1 of the year 1.
TimeValue(stringTime)
Returns a Date value containing the time information represented by a string, with the date information set to January 1 of the year 1.
Weekday(dateValue, dayOfWeek)
Returns an Integer value containing a number representing the day of the week.
WeekdayName(weekday, abbreviate, firstDayOfWeek)
Returns a String value containing the name of the specified weekday.
Year(dateValue)
Returns an Integer value from 1 through 9999 representing the year.
Now
Gets a DateTime object that is set to the current date and time on this computer, expressed as the local time.
Today
A DateTime set to today's date, with the time component set to 00:00:00.
TimeOfDay
Returns or sets a Date value containing the current time of day according to your system.

Type conversion

Fix(number)
Return the integer portion of a number.
Int(number)
Return the integer portion of a number.
Str(number)
Returns a String representation of a number.
Val(inputStr)
Returns the numbers contained in a string as a numeric value.
CBool(obj)
Converts an expression to boolean type
CDate(obj)
Converts an expression to datetime type
CDbl(obj)
Converts an expression to double-precision number
CInt(obj)
Converts an expression to integer type
CStr(obj)
Converts an expression to string type

Math

Abs(val)
Returns the absolute value of a Decimal number.
Ceiling(d)
Returns the smallest integer greater than or equal to the specified number.
Floor(d)
Returns the largest integer less than or equal to the specified number.
Max(a, b)
Returns the larger of two specified numbers.
Min(a, b)
Returns the smaller of two numbers.
Pow(x, y)
Returns a specified number raised to the specified power.
Round(a)
Rounds a value to the nearest integer.
Round(value, digits)
Rounds a value to the specified number of decimal places.
Sign(value)
Returns a value indicating the sign of a number.
Sqrt(d)
Returns the square root of a specified number.
Truncate(d)
Calculates the integral part of a number.
Log(d)
Returns the logarithm of a specified number.
Log10(d)
Returns the base 10 logarithm of a specified number.
Sin(a)
Returns the sine of the specified angle (angle must be in radians).
Cos(a)
Returns the cosine of the specified angle (angle must be in radians).
Tan(a)
Returns the tangent of the specified angle.
Asin(a)
Returns the angle (in radians) whose sine is the specified number.
Acos(a)
Returns the angle (in radians) whose cosine is the specified number.
Atan(a)
Returns the angle whose tangent is the specified number.
Atan2(y, x)
Returns the angle whose tangent is the quotient of two specified numbers.

Control flow

iif(condition, value1, value2)
Returns one of two objects, depending on the evaluation of an expression.
IsNothing(field)
Returns a boolean value indicating whether the value of the specified field is null.