ReportWeaver OQL Reference: Standard Functions
ReportWeaver provides access to a number of String, Date, conversion and utility functions.
Note:The OQL functions are written as functions, not as method invocations. E.g. you write charAt("ABC", 2) and not "ABC".charAt(2) as in object oriented languages.
||Returns the absolute value of a number.
abs(-3) returns 3
abs(delta) returns the absolute value of a number field delta defined in the current scope.
|Date addDays(Date start,int delta)||Adds a number of days to the start
date passed in the first argument. The second argument is the delta, which may
be positive or negative. Example:
addDays(date(2001,12,30), 4) returns January 2nd 2002
addDays(date(2002, 1,6), -4) also returns January 2nd 2002
|Date addMonths(Date start ,int delta)||Adds a number of months to a date. Returns a
new date that is offset by delta months from the date start.
Delta may be positive or negative. Example:
addMonths(date, -1) returns the date exactly one month ago.
addMonths(date(2001,1,31), 1) returns February 28th 2001.
|Date addWeeks(Date start,int delta)||Adds a number of weeks to the a date. Args:
start the date from which the returned date is offset. delta
the number of weeks to offset. May be positive or negative. Example:
addWeeks(date(2001,3,5), 52) returns March 4th 2002. (Note: a year is not exactly 52 weeks which is correctly taken into account by this function)
|String case(int picker, String...)||Picks a value from a list. The first
argument is an integer, that selects which value from the argument list is
returned. A pick value of 0 selects the second argument, a value of the third
and so on. The selected value is converted to a String and returned.
case(3, "First", Second", "Third") returns Third
case(0, date, 1) returns the current date.
|int charAt(String from, int at)||Returns the character at position at in the string from. The character is encoded as a unicode value. It may be greater that 255.|
|int compareToIgnoreCase(String s1, String s2)||Returns an integer, that indicates whether
the two strings s1 and s2 are equal or different.
If s1 and s2 are equals 0 is returned; if s1 is less than s2 then -1 is returned and if s1 is greater than s2 then 1 is returned. A value of null for s1 or s2 is treated as being less than any other string.
|String concatStringCollection(StringCollection c)|| Return a string by concatenating all
elements of a literal string collection. Each string is separated by a
semicolon. String collections are returned by query based variables that return
a collection of string fields.
|int count(Collection c)||Returns the number of elements in the collection.|
Date date(int year, int month, int day)
Date date(int year, int month, int day, int hour, int minute)
Date date(int year, int month, int day, int hour, int minute, int second)
|Returns a Date object. This object is can be
used as a Java Calendar object. Date object types of the various databases
(including C++ databases) are converted into this type.
The first form returns the current date and time when this function is evaluated with microsecond precision.
The other forms construct a Date object from the parameters passed as arguments.
Date objects have fields, that can be accessed in the report or they can be processed via the addDays, addMonths, addWeeks functions.
|Date dayOf(Date d)||Returns the date d truncated to the same day at midnight. (00:00 hours) Use it to compare dates without looking at the time.
I.e dayOf(date(2004,10,20, 12, 30) ) == dayOf(date(2004,10,20, 3, 45) )
The hours, minutes and seconds are ignored.
|boolean endsWith(String text, String end)||Indicates whether the string text ends with the string end.|
|String fileText(String path, String default)
String fileText(String path)
|Reads the text from the file designated by path and returns it as a string. Newlines in the text are honoured when the text is displayed. The first version of the sysntax returns the default text if the file could not be found or read. The second form returns null, thus quietly ignoring non existing files.|
|Object first(Collection c)||Returns the first element of a collection or null if the collection is null or empty.|
|int indexOf(String s1, String s2)||Returns the index of the String s2 in the String s1. Returns -1 if the s2 does not occur in s1.|
|boolean isNaN(double r)||Checks the floating point number and returns true if it has the special value NaN.|
|Date lastDayOfMonth(Date d)||Returns last day in the month defined by the supplied date. E.g. for Feb 20th 2006 it returns 28/2/2006; for Feb 20th 2008 it returns 29/2/2008|
|Date lastDayOfQuarter(Date d)||Returns last day in the quarter defined by the supplied date. E.g. for Feb 20th 2006 it returns 31/3/2006.|
|int lastIndexOf(String s1, String s2)||Returns the position of the last occurence of String s2 in the String s1. Returns -1 if the s2 does not occur in s1.|
|int length(Collection c)
int length(String s)
|Returns the number of elements in the collection or the number of characters (not bytes) in the String.|
|String local(String s)||Returns the localized version of the string s using the currently selected locale.|
|int page()||Returns the current page number. For a master detail reports this is not the total page number but the page number within this master group.|
|double parseFloat(String s)||Parses the string s and returns the equivalent value as a double. Throws a NumberFormatException wrapped in a JoriaDataException if the string does not represent a number.|
|long parseInt(String s)||Parses the string s and returns the equivalent value as a long. Throws a NumberFormatException wrapped in a JoriaDataException if the string does not represent a number.|
|Date secondsToDate(long seconds)||Takes a long representing a date in seconds since 1/1/1970 and converts it to a date object.|
|booolean startsWith(String s1, String s2)||Returns true if String 21 starts with the string s2.|
|substring(String src, int start, int
substring(String src, int start)
|Returns a string that is a substring of string src. The substring begins with the character at the specified index and extends to the end of this string or to the specified end index.|
|String systemProperty(String s)||Returns the value of the java.lang.System property that has the name s. Null if it does not exist.|
|String toLowerCase(String s)||Returns the value of String s converted to lower case.|
|String toString(Object obj)||Returns the value of the toString method for this object. For java objects it simply calls toString on the object. For C++ or other object oriented databases the ObjectID of the database system will be returned.|
|String toUpperCase(String s)||Returns the value of String s converted to upper case.|
|String trim(String s)||Returns a copy of s with all whitespace (blank, tabs and newlines) removed from the head and tail of the string.|
|OQL Syntax Reference||Contents||Visibility conditions|