esProc Getting Started: Constants

esProc 2 0

In esProc computing, we use constants frequently or sometimes store the data in the cellset directly. In this article, let’s learn the usage of constants in the esProc.

1. Directly using constant in the expressions

Constants can be directly used in the esProc expressions:

1 =64*32
2 =round(1.45*5.5)
3 =isupper(“Tom Sawyer”)

When constants are used in the expressions, the integer and the float can be used directly, but the string must be enclosed in quotes. For the Boolean constants true and false, they can be used directly in the expressions, but there are few cases of using them. The results in A1, A2 and A3 are as follows:


In particular, the capitalized L can be appended to the integer to indicate the long integer. Compared with the integer, the long integer has a wider range of value; the hexadecimal long integer can be represented with a string whose first two characters are 0x:

1 =123456789L*100
2 =123456789*100
3 =0x00FF

Because the value range of normal integers is -231~231-1, that is, -2147483648~2147483647, the result in A2 exceeds the value range of integer. In A1, a long integer is used, and the value range is increased to -263~263-1. By this way, the correct result can be obtained. The computed results in A1, A2 and A3 are as follows:


As can be noticed, during a certain step of the computation, if one of the operands involved in the integer computing is the long integer, the result is the long integer.

In a string used in an expression, if there are special characters like ” and \, an escape character \ is required as an indicator before each special character:

1 =”C:\\Program Files\\”+”Java”
2 =”\”I can come today,\” she said, \”but not tomorrow.\””

After execution, the strings in A1 and A2 are as follows:


The time and date constants are not allowed in the expressions. Instead, only the type conversion functions, such as date(), time(), and datetime(), can be used to convert strings or long integers:

1 =interval@y(date(“1944-6-6”),now())

The result in A1 is as follows:


2. Constant cells

When the data is written to the cell directly, if the cell can interpret the string as a constant, then this cell can be regarded as a constant cell. Its cell value is the constant.

The default text in the constant cell is pink. Based on the data in the cell, the constant will be parsed into various data types. If the data is unidentifiable, it will be interpreted as a string.

The double quotation marks are not necessary when a string is defined in the constant cell.

In addition, in the constant cell, the constant can be represented as a percentage, like 5%:

1 5%
2 =A1*1000

After the computation, the cell values of A1 and A2 are as follows:


In the constant cell A1, 5% will be converted to the corresponding float value 0.05. Note: The writing style of 5% cannot be used in the expressions. It is only valid in the constant cells.

In particular, the value in the constant cell can also be true, false or null:

1 true
2 false
3 null

As can be seen from above, the constant cell value is the corresponding Boolean value or null value at this point:


The string constant cell can be used to specify the value of a cell as a string. The cell string in a string constant cell starts with the single quotation mark ‘ of English font. The string constant cell is used to define the strings containing special characters or those composed of figures:

1 ‘abc\d
2 ‘1234.5
3 1234.5

In the above, the value of the constant cell A1 is the string abc\d; the cell value of A2 is the string 1234.5; the cell value of A3 is the number 1234.5:


In the constant string cells, the escape character \ is not necessary if any special character exists in the string:

1 ‘C:\Program Files\Java
2 ‘”I can come today,” she said, “but not tomorrow.”

Values of strings in A1and A2 are as follows:


In a constant cell, we can also define the sequence constant with the brackets [], and use commas to separate the sequence members. For example:

1 [2,3,5,7,11]
2 [Gold,Silver,Bronze]

The sequence constants in A1 and A2 are as follows:


In defining a sequence constant, the double quotation marks are also unnecessary for indicating the string members in a sequence.

In an expression, we can use the cell name to reference the constant cell:

1 1944-6-6
2 =interval@y(A1,now())

The result in A2 is as follows:


3. The sequence of constant cells

In esProc, once constants are saved in multiple cells, these cells are often combined to form a constant sequence for use in the expression. For example:

  A B C D E F
1 1 2 4 8 16 32
2 =[A1:F1]          

In A2, the expression [A1:F1] indicates a sequence composed of the values of all cells in the A1~F1 area. The sequence is as follows:


The cells in the sequence can also be in a continuous area:

  A B C
1 1 2 4
2 8 16 32
3 =[A1:C2]    

In A3, expression [A1:C2] indicates a sequence composed of values of cells in an area from A1 to C2, and in which the members follow the order of first-row-then-column.


In esProc, an area of constant cells is often used to make up a TSeq:

  A B C D E
1 German 2 1 0 7
2 American 1 1 1 4
3 Portugal 1 1 1 4
4 GHana 0 1 2 1
5 =create(Team,W,D,L,Points)        
6 >A5.record([A1:E4])        

In A5, a new TSeq is created. In A6, the record function is used to fill the TSeq with the values of the constant cells in the area of A1~E4.


With such method, the dfx file can be used to store the tabular data.

Leave a Reply

Hi,You need to fill in the Username and Email!

  • Username (*)
  • Email (*)
  • Website