Preface: We often use expression in report form design, just like using formula in Excel, with expression will make our report form design work twice the result with half the effort.

What expressions do building block reports contain?

Building block report improves the original expression, on the original basis, the expansion of data set expression, cell expression, statistical function, line number function, date function, mathematical function, string function, conditional expression, color expression, judgment function, basic operator function and system function. Let’s take a look at what expressions are included and how to use them.

1. Data set function

The data set functions include sum, average, Max, min, and the basic operators (+-*/).

Example: Take sum as an example

  • =sum(#{jm. Money},#{jm. Extend_money}

#{jm. Money} # indicates that the dataset JM is a collection

${jm. Money} $indicates that the dataset jM is an object.

Cell functions

Cell functions also include: sum, average, Max, min, and the basic operator (+-*/).

Example: Take sum as an example

  • If C6 is an expression such as ${db.count}, all the data in the loop from the page expression will be summed
  • =sum(A6,C6) over cells A6 and C6
  • =sum(A6:C6) over cells A6 to C6
3. Statistical function

Statistical functions include DBsum, dbmax, DBmin, and Dbaverage.

Specifies a field in a specified data set and computes all data in the field

For example, the difference between dbsum and sum is as follows: dbsum counts all data in the data set. Sum only supports the current page

The following uses dbsum as an example

  • =dbsum(jm.money)
4. Line number function

Line number function: through the line number function to achieve self-increasing serial number

Example:

  • =row()
  • Row (1) =row(2)
5. Date function

Date functions include date, time, year, month, day, now, and nowstr.

Example: Take Date as an example

  • =date(“1982-08-09”) Return date: 1982-08-09 00:00:00
  • =date(“1982-08-09 10:20:30”) Return date: 1982-08-09 00:00:00
  • Collection: = date (‘ # {jm. Create_time} ‘)
  • Object: = date (‘ ${jm. Create_time} ‘)
  • Cell: =date(A1)
6. Mathematical functions

Mathematical functions include rand, round, ABS, floor, ceil, trunc

Example: The following uses round as an example

  • = round (3451251.274, 0)
  • =round(#{db.salary}, 2)
7. String functions

String functions include char(Unicode encoding or ASCII encoding conversion), CNMoney (uppercase conversion), concat(string concatenation), lower(lowercase conversion), upper(uppercase conversion), date_str(date to string conversion)

Example: Take CNMoney for example

  • =cnmoney(1.232) return: one yuan twenty-three cents
  • Collection: = cnmoney (# {jm. Money})
  • Object: = cnmoney (${jm. Money})
  • Cell: =cnmoney(A1)
Conditional expressions

Conditional expressions are used to judge data conditionally, including case and if

Example:

  • If (case(‘#{dd.sex}’==’1′,’ male ‘,’ female ‘)
  • = case (1 = = 1,1,2) – > 1
  • =(let sex= ‘#{dd.sex}’; If (sex = = ‘1’) {} ‘male’ elsif (sex = = ‘2’) {‘ female ‘} else {} ‘unknown’)
  • =(if(A1==1){return (A1+B1)*200; })
9. Color expressions

Color expressions include: color(cell font/background color), = rowColor (full line font/background color)

Example: Take color as an example

  • Collection: color = (‘ # {jm. Salse} ‘, ‘# FFFFFF’, ‘# 171516’)
  • Object: = color (‘ ${jm. Salse} ‘, ‘# FFFFFF’, ‘# 171516’)
  • Stickline (A1, 0, 0, 0), colorffffff; stickline (A1, 0, 0, 0), colorffffff;
  • Stickline (c > = 0 and c > = 0, 0, 0, 0), colorffffff;
10. Judge the function

The judgment function is to judge the data; Istime (time), isdate(period), isNumber (number), intval(null), strval(null), nil (default)

Example: Istime is used as an example

  • = istime (” 10:20:30 “) returns true
  • =istime(‘#{jm.create_time}’)
  • =istime(‘${jm.create_time}’)
  • =istime(A1)

I want to give it a try