Types of Cells

Read(5211) Label: cell, cell type,

In esProc, cells are automatically classified into different types according to their values or the expressions they contain. In a cellset, each type of cell has its own appearance, making the code written in it clearer.

1.5.1 esProc cell types

Constant cell

A cell holding a data string that can be interpreted as a constant is a constant cell. Its value is the constant.

The constant cell has the following types of values:

 

A

1

54

2

43.31

3

-4.45E3

4

abcd

5

2010-1-3

6

23:04:23

7

raqsoft

A1’s value is interpreted as an integer; A2’s value a real number; A3’s a real value according to scientific notation; A4’s a string; A5’s a date; A6’s a time; and A7’s a string. The constants in A1~A7 are:

   

  

The text in a constant cell is diplayed in pink by default. Depending on the format, the cell value will be parsed into the corresponding data type. For the unrecognized format, the value will be interpreted as the string type data.

Note: The format of 3% is unacceptable in any expression, but it is acceptable in the constant cell.

String constant cell

A string constant cell is a cell holding a string that starts with single quote ', indicating the cell has a string value. The value is the string of characters after the single quote. In this case, all characters following the single quote will be parsed as string type, without requiring any additional quotes, escape characters, etc. An example is already cited in the previous section:

 

A

1

'abc\d

2

'1234.5

3

1234.5

The strings in both A1 and A2 are headed by a single quotation mark, meaning the value is string type. A3’s string is automatically interpreted as a real number. Values of A1, A2 and A3 are shown below. Note the difference of A2 and A3’s values in display.

   

Calculation cell

A calculation cell is a cell holding an expression that starts with =. Its value is the result of the expression, which can reference values of other cells.

=5*(3+2)

=A1*3

=A1/B2+B1

The text in a calculation cell is in black by default.

Click the icon  to execute the code and you will find that the background of the calculation cell turns to light yellow, indicating its value has been computed. Click the cell and its value will be shown in the value view section. That is the calculation result.

In the expression, you can use various basic operators to compute cell value:

Ø  a+b, a-b, a*b and a/b

Stand for add, subtract, multiply, and divide operations.

=3*4  12

=1+2*3  7

Ø  a%b

Get the remainder of a divided by b.

=121%11  0, indicating that 121 is a multiple of 11 and is divisible by 11

=100%7  2

Ø  a\b

Perform integer division, which uses the integer parts of a and b to perform the operation and returns the interger part of the result.

=11\4  2, which discards the decimal part of the result

 

=6.1\2.9  3, which is equal to 6\2 whose result is also 3

Ø  s1+s2

Concatenate string s1 and s2. Note that the string will be ignored if added to a real number.

="Stephen"+" "+"Rolfe"    String Stephen Rolfe

="A"+3  Integer 3, string "A" is ignored

="A"+string(3)  String A3. If you do need to concatenate a string and a real number, convert the real number to string first.

Execution cell

An execution cell is a cell holding a string that starts with > for performing a certain operation. An execution cell has no value. If it starts with a reserved word, such as if and for, then > will be omitted.

An execution cell can assign value to another cell, by referencing cells as variables.

 

Comment cell

A comment cell is a cell containing a string that starts with /. Its value is null.

Comment cells will be ignored during execution.

The comment text is displayed in green by default.

1.5.2 Color settings

esProc provides the users with options to set the font styles and the foreground and background colors of different types of cells. Click Tool ->Options on the menu bar to view and modify the settings on the Appearance tab.