Easy Pivot Logo
  • Pricing

Manual

OverviewFolder SystemData Sources
User and RoleRestful Interfaces

Integration

Report

Functions

Functions

In the previous section, we introduced expressions. Actually, functions are also a type of expression. The original UReport2 provides a large number of built-in functions. Through these built-in functions, various report calculation functions can be achieved. The syntax format of a function is as follows:

FunctionName([Expression,Expression...])

Below we will introduce the built-in functions of UReport2 one by one.

Common Functions

count Function (Count Quantity)

The count function counts the number of objects after evaluating the given expression(s).

ExampleDescription
count(C1,C2)Counts the total number of target C1 cells and C2 cells relative to the current cell.
count(C1)Counts the number of target C1 cells relative to the current cell.
count(C1{age>20},C2{salary>2000 and degree=='本科'})Counts the number of C1 cells with the bound object's age property greater than 20 and C2 cells with the bound object's salary property greater than 2000 and degree property equal to '本科', relative to the current cell.
count(C1{age>20})Counts the number of C1 cells with the bound object's age property greater than 20, relative to the current cell.

sum Function (Summation)

The sum function accumulates the values after evaluating the given expression(s). The sum function requires that the values after evaluation of each expression must be numbers; otherwise, an error will occur.

ExampleDescription
sum(C1)Sums all C1 cell values relative to the current cell.
sum(C1{age>20})Sums the values of all C1 cells with bound object property age greater than 20, relative to the current cell.
sum(C1,C2)Sums all C1 and C2 cell values relative to the current cell.
sum(C1{age>20},C2{salary>2000 and degree=='本科'})Sums the values of all C1 cells with bound object property age greater than 20 and C2 cells with bound object property salary greater than 2000 and degree property equal to '本科', relative to the current cell.

avg Function (Average)

The avg function calculates the average of the values after evaluating the given expression(s). The avg function requires that the values after evaluation of each expression must be numbers; otherwise, an error will occur.

ExampleDescription
avg(C1)Calculates the average of C1 cell values relative to the current cell.
avg(C1{age>20})Calculates the average of values from C1 cells with bound object property age greater than 20, relative to the current cell.
avg(C1,C2)Calculates the average of C1 and C2 cell values relative to the current cell.
avg(C1{age>20},C2{salary>2000 and degree=='本科'})Calculates the average of values from all C1 cells with bound object property age greater than 20 and C2 cells with bound object property salary greater than 2000 and degree property equal to '本科', relative to the current cell.

max Function (Maximum)

The max function finds the maximum value among the values after evaluating the given expression(s). The max function requires that the values after evaluation of each expression must be numbers; otherwise, an error will occur.

ExampleDescription
max(C1)Finds the maximum value among C1 cell values relative to the current cell.
max(C1{age>20})Finds the maximum value among values from C1 cells with bound object property age greater than 20, relative to the current cell.
max(C1,C2)Finds the maximum value among C1 and C2 cell values relative to the current cell.
max(C1{age>20},C2{salary>2000 and degree=='本科'})Finds the maximum value among values from all C1 cells with bound object property age greater than 20 and C2 cells with bound object property salary greater than 2000 and degree property equal to '本科', relative to the current cell.

min Function (Minimum)

The min function finds the minimum value among the values after evaluating the given expression(s). The min function requires that the values after evaluation of each expression must be numbers; otherwise, an error will occur.

ExampleDescription
min(C1)Finds the minimum value among C1 cell values relative to the current cell.
min(C1{age>20})Finds the minimum value among values from C1 cells with bound object property age greater than 20, relative to the current cell.
min(C1,C2)Finds the minimum value among C1 and C2 cell values relative to the current cell.
min(C1{age>20},C2{salary>2000 and degree=='本科'})Finds the minimum value among values from all C1 cells with bound object property age greater than 20 and C2 cells with bound object property salary greater than 2000 and degree property equal to '本科', relative to the current cell.

row Function (Get Row Number)

Gets the row number of the current cell. This function is simple and has no parameters.

ExampleDescription
row()Gets the row number of the current cell.

column Function (Get Column Number)

Gets the column number of the current cell. This function is simple and has no parameters.

ExampleDescription
column()Gets the column number of the current cell.

order Function (Sort)

The order function requires two parameters. The first is the object expression to be sorted, and the second is a boolean value to set the sorting order: true for ascending, false for descending.

ExampleDescription
order(C1,false)Gets all C1 cell values relative to the current cell, sorts these values in descending order, and returns the sorted collection.
order(C1{age>18},true)Gets all C1 cell values with bound object property age greater than 18 relative to the current cell, sorts these values in ascending order, and returns the sorted collection.

list Function (List Data)

Gets all data defined in the expression(s) and returns them in collection form.

ExampleDescription
list(C1)Gets all C1 cell values relative to the current cell and returns them as a collection.
list(C1,C2{age>20})Gets all C1 cell values and C2 cell values where the age property of the bound object is greater than 20, relative to the current cell, and returns them as a collection.

formatnumber Function (Format Number)

Formats the given parameter. It requires at least one parameter. The first parameter is the number object to be formatted. Ensure this parameter value can be converted to a number; otherwise, an error will occur. The second parameter is optional and defines the pattern used for number formatting. If not defined, the default # pattern is used.

ExampleDescription
formatnumber(C1)Gets the C1 cell value (must be convertible to a number) and formats it as a string using # pattern.
formatnumber(C1,"#,###.00")Gets the C1 cell value (must be convertible to a number) and formats it as a string using the #,###.00 pattern.

get Function (Get Data at Specified Position)

The get function was added in version 2.1.2. Its purpose is to retrieve an object at a specified position in a dataset or a specific property value of an object. The get function can have three parameters: the first is the target collection object (required), the second is the data position, and the third is the object property. The first parameter is mandatory, and the latter two are optional.

ExampleDescription
get(ds1.select(employee_name))Gets the first object value from the ds1 dataset and returns it. The position parameter is not specified, so it defaults to the first object in the collection.
get(ds1.select(employee_name),2)Gets the second object value from the ds1 dataset and returns it.
get(ds1.select(employee_name),2,"deptId")Gets the second object value from the ds1 dataset and returns the deptId property value from this object.
get(A3,4)Gets all A3 cell values, takes the fourth value, and returns it.

Page-related Functions

Page-related functions refer to functions that are calculated during pagination. For example, calculating how many records are on the current page, the sum of a certain cell's value on the current page, the average, maximum, etc.

Using Page-related Functions

Generally, page-related functions are often used in cells within rows of type "Repeat Header" or "Repeat Footer." Also, note that page-related functions will only be displayed during pagination preview, which is important to remember.

pcount Function

Counts the number of values corresponding to the expression on the current page. Its usage is essentially the same as the count function, except that pcount only counts the number of expression content corresponding to the current page.

ExampleDescription
pcount(C1)Counts the number of C1 cells on the current page.
pcount(C1,D2{D2>10000})Counts the number of C1 cells and D2 cells on the current page where the D2 cell value is greater than 10000.

psum Function

Sums all values corresponding to the expression on the current page. Corresponds to the sum function, but psum only targets the current page.

ExampleDescription
psum(C1)Sums all C1 cell values on the current page.
psum(C1,D2{D2<10000})Sums all C1 cell values and D2 cell values less than 10000 on the current page.

pmax Function

Compares the values corresponding to the expression on the current page and finds the maximum value. Corresponds to the max function, but pmax only targets the current page.

ExampleDescription
pmax(C1)Compares all C1 cell values on the current page and finds the maximum.
pmax(C1,D2,E2{E2>1000})Compares all C1, D2, and E2 cell values greater than 1000 on the current page and finds the maximum among them.

pmin Function

Compares the values corresponding to the expression on the current page and finds the minimum value. Corresponds to the min function, but pmin only targets the current page.

ExampleDescription
pmin(C1)Compares all C1 cell values on the current page and finds the minimum.
pmin(C1,D2,E2{E2>1000})Compares all C1, D2, and E2 cell values greater than 1000 on the current page and finds the minimum among them.

page Function

Outputs the page number of the current page. This function has no parameters.

ExampleDescription
page()Outputs the page number of the current page.

Mathematical Functions

abs Function (Absolute Value)

Calculates the absolute value of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
abs(-233)Calculates the absolute value of -233, resulting in 233.
abs(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and returns its absolute value.

ceil Function (Minimum Value - Ceiling)

Rounds a number up to the smallest integer greater than or equal to it. If the parameter value is a decimal, it discards the fractional part. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
ceil(32.32)Calculated value is 33.
ceil(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and returns its ceiling value.

floor Function (Maximum Value - Floor)

Rounds a number down to the largest integer less than or equal to it. If the parameter value is a decimal, it rounds down the fractional part. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
floor(32.52)Calculated value is 32.
floor(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and returns its floor value.

chn Function (Number to Chinese)

Converts a number to Chinese characters. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
chn(213)Calculated value is: 贰佰壹拾叁
chn(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and converts it to Chinese.

The chn function can convert both integers and decimals. For decimals, it supports up to two decimal places. If there are more actual decimals, the chn function will first round the number and then perform the conversion.

rmb Function (Number to Chinese Currency)

Converts a number to Chinese uppercase currency amount. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
rmb(213)Calculated value is: 贰佰壹拾叁元整
rmb(200.12)Calculated value is: 贰佰元壹角贰分
rmb(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and converts it to Chinese uppercase currency amount.

cos Function (Cosine)

Calculates the cosine of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
cos(213)Calculated value is: 0.8090276252864301
cos(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates its cosine.

sin Function (Sine)

Calculates the sine of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
sin(213)Calculated value is: -0.58777
sin(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates its sine.

tan Function (Tangent)

Calculates the tangent of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
tan(213)Calculated value is: -0.72651
tan(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates its tangent.

exp Function (Exponential)

Returns the value of e raised to the power of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
exp(213)Calculated value is: 3.196867565323994E92 (Note: Original text had a typo expr, corrected to exp. The example value is also extremely large, likely a placeholder.)
exp(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates e raised to that power.

log10 Function (Base-10 Logarithm)

Calculates the base-10 logarithm of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
log10(213)Calculated value is: 2.3283796034387376
log10(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates its base-10 logarithm.

log Function (Natural Logarithm)

Calculates the natural logarithm of the parameter. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
log(213)Calculated value is: 5.3612921657094255
log(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple, takes the first value and calculates its natural logarithm.

median Function (Median)

Calculates the median of a set of data. The parameter values after evaluation must be numbers; otherwise, an error will occur.

ExampleDescription
median(12,42,31)Running result is 31.
median(C1)Gets all C1 cell values relative to the current cell and calculates their median.
median(C1,C2)Gets all C1 and C2 cell values relative to the current cell and calculates their median.

mode Function (Mode)

Calculates the mode of a set of data. The parameter values after evaluation must be numbers; otherwise, an error will occur.

ExampleDescription
mode(12,42,3,12)Running result is 12.
mode(C1)Gets all C1 cell values relative to the current cell and calculates their mode.
mode(C1,C2)Gets all C1 and C2 cell values relative to the current cell and calculates their mode.

vara Function (Variance)

Calculates the variance of a set of data. The parameter values after evaluation must be numbers; otherwise, an error will occur.

ExampleDescription
vara(12,42,3,12)Running result is 209.25.
vara(C1)Gets all C1 cell values relative to the current cell and calculates their variance.
vara(C1,C2)Gets all C1 and C2 cell values relative to the current cell and calculates their variance.

stdevp Function (Standard Deviation)

Calculates the standard deviation of a set of data. The parameter values after evaluation must be numbers; otherwise, an error will occur.

ExampleDescription
stdevp(12,42,3,12)Running result is 14.75424.
stdevp(C1)Gets all C1 cell values relative to the current cell and calculates their standard deviation.
stdevp(C1,C2)Gets all C1 and C2 cell values relative to the current cell and calculates their standard deviation.

pow Function (Power)

Returns the value of the first parameter raised to the power of the second parameter. The pow function requires two parameters: the first is the number or expression to be calculated, and the second is the specific exponent.

ExampleDescription
pow(3,2)Calculates 3 to the power of 2, resulting in 9.
pow(C1,3)Gets the value of the C1 cell relative to the current cell. If there are multiple C1 cells, takes the first value and raises it to the power of 3.

random Function (Random Number)

Generates a random number. It can have one numeric parameter or expression. If there is a parameter, it uses this parameter as the seed for generating the random number. If not, it generates a random number between 0 and 1.

ExampleDescription
random()Generates a random number between 0 and 1.
random(10)Generates a random integer between 1 and 10.
random(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple C1 cells, takes the first value and uses it as the seed to generate a random number.

round Function (Round)

Rounds a decimal number. It requires two parameters. The first parameter is the decimal or expression to be rounded. The second is an optional parameter specifying the number of decimal places to keep. If not provided, no decimal places are kept.

ExampleDescription
round(32.12)Calculated value is 32.
round(32.123,2)Calculated value is 32.12.
round(C1,2)Gets the value of the C1 cell relative to the current cell. If there are multiple C1 cells, takes the first value and rounds it to two decimal places.

sqrt Function (Square Root)

Calculates the square root of a number or the value after evaluating an expression. The parameter value after evaluation must be a number; otherwise, an error will occur.

ExampleDescription
sqrt(2)Calculated value is: 1.414214
sqrt(C1)Gets the value of the C1 cell relative to the current cell. If there are multiple C1 cells, takes the first value and calculates its square root.

Date Functions

date Function (Date)

Outputs the date. The date function can have one parameter, which is the date format. If not provided, it uses the yyyy-MM-dd HH:mm:ss format to output the date.

ExampleDescription
date()Outputs the current date in yyyy-MM-dd HH:mm:ss format, e.g., 2010-08-15 08:45:10.
date('yyyy年MM月dd日')Outputs the current date in yyyy年MM月dd日 format, e.g., 2010年08月15日.

day Function (Day)

Outputs the day of the month. This function has no parameters.

ExampleDescription
day()Might output 15, indicating the current day is the 15th.

month Function (Month)

Outputs the current month. This function has no parameters.

ExampleDescription
month()Might output 8, indicating the current month is August.

week Function (Weekday)

Outputs the current day of the week. This function has no parameters.

ExampleDescription
week()Output might be "Wednesday", indicating the current day is Wednesday.

year Function (Year)

Outputs the current year. This function has no parameters.

ExampleDescription
year()Output result might be 2010, indicating the current year is 2010.

String Functions

indexOf Function (Position)

Used to return the position of a string within a target string. This function requires at least two parameters. The first is the target string, and the second is the string to find. If there is a third parameter, it is the starting position for the search, which must be a number greater than or equal to 0.

ExampleDescription
indexOf('中华人民共和国','共和')Means to find the position of the string "共和" within the string "中华人民共和国".
indexOf('中华人民共和国','共和',2)Means to start from the second character of the string "中华人民共和国" to find the position of the string "共和".
indexOf(C1,"人民",2)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value, then finds the position of the string "人民" starting from the 2nd position in that value.

length Function (Length)

Calculates the length of the target string. This function must have one parameter.

ExampleDescription
length("中华人民共和国")Calculation result is 7.
length(C1)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value, then calculates the length of this value.

lower Function (To Lowercase)

Converts all English letters in the parameter to lowercase. This function must have one parameter.

ExampleDescription
lower("Super man")Calculated result is: super man.
lower(C1)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value and converts all English letters in that value to lowercase.

upper Function (To Uppercase)

Converts all English letters in the parameter to uppercase. This function must have one parameter.

ExampleDescription
upper("Super man")Calculated result is: SUPER MAN.
upper(C1)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value and converts all English letters in that value to uppercase.

replace Function (Replace String)

This function requires three parameters. The first is the target string, the second is the string to be replaced, and the third is the replacement string.

ExampleDescription
replace("他是一个好人","他","她")Calculation result is: 她是一个好人.
replace(C1,"他","她")Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value, then replaces all occurrences of "他" with "她" in that value.

substring Function (Substring)

This function can have three parameters. The first is the target string, the second is the starting position for extraction, and the third is the ending position for extraction.

ExampleDescription
substring("他是一个好人",2)Running result is: 一个好人.
substring("他是一个好人",2,4)Running result is: 一个.
substring(C1,2,10)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value, then extracts the content between the 2nd and 10th characters of that value.

trim Function (Trim Spaces)

Removes leading and trailing spaces from the target string. This function must have one parameter.

ExampleDescription
trim(" 一个好人 ")Running result is: 一个好人.
trim(C1)Relative to the current cell, finds the C1 cell. If there are multiple C1 cells, takes the first cell value and removes any leading or trailing spaces from that value.

On this page

Common Functionscount Function (Count Quantity)sum Function (Summation)avg Function (Average)max Function (Maximum)min Function (Minimum)row Function (Get Row Number)column Function (Get Column Number)order Function (Sort)list Function (List Data)formatnumber Function (Format Number)get Function (Get Data at Specified Position)Page-related Functionspcount Functionpsum Functionpmax Functionpmin Functionpage FunctionMathematical Functionsabs Function (Absolute Value)ceil Function (Minimum Value - Ceiling)floor Function (Maximum Value - Floor)chn Function (Number to Chinese)rmb Function (Number to Chinese Currency)cos Function (Cosine)sin Function (Sine)tan Function (Tangent)exp Function (Exponential)log10 Function (Base-10 Logarithm)log Function (Natural Logarithm)median Function (Median)mode Function (Mode)vara Function (Variance)stdevp Function (Standard Deviation)pow Function (Power)random Function (Random Number)round Function (Round)sqrt Function (Square Root)Date Functionsdate Function (Date)day Function (Day)month Function (Month)week Function (Weekday)year Function (Year)String FunctionsindexOf Function (Position)length Function (Length)lower Function (To Lowercase)upper Function (To Uppercase)replace Function (Replace String)substring Function (Substring)trim Function (Trim Spaces)
Log InStart Free