Constants in esProc

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

1.Directly using constant in the expression

Constants can be directly used in the esProc expression:

esProc_constant_1

When using the constant in the expression, the integer and float can be used directly, while the string must be quoted with the double quotation mark “”. For the Boolean constant true and false, they can be used directly in the expression, but there is few cases of using it. .

In particular, the capitalized L can be added 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:

esProc_constant_2

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. As can be noticed, in the further computing, if one of the operands involved in the integer computing is the long integer, the result is the long integer.

In the string within the expression, if there are special characters like ” and , an escape character is required as indicator before each special character:

esProc_constant_3

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

esProc_constant_4

2.Constant cell

When populating the data to the cell directly, if the cell can interpret the character string as a constant, then this cell can be regarded as the 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 cell string in the cell is not understandable, they will be interpreted into string. For example:

esProc_constant_5

As may be noticed, the double quotation marks are not necessary when defining a string in the constant cell.

Otherwise, in the constant cell, the constant can be represented as percentage, like 5%:

esProc_constant_6

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 expression. It is only valid in the constant cell.

In particular, the value in the constant cell can also be true, false or null. The constant cell value is the corresponding Boolean value or null value:

esProc_constant_7

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

esProc_constant_8

When using the constant string cell, the escape character is not necessary if any special character exists in the  string:

esProc_constant_9

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

esProc_constant_10

when defining the sequence constants, the double quotation marks are also unnecessary for indicating the members of  string in the sequence.

In the expression, we can use the cell name to make references to the constant cell:

esProc_constant_11

3.The sequence of constant cells

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

esProc_constant_12

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

The cells in the sequence can also be used in a range of continuous areas:

esProc_constant_13

In the A3 expression, [A1:C2] indicates a sequence composed of cell values in this area from A1 to C2, following the order of first-row-then-column to form the sequence.

In esProc, the range of constant cells are often populated to a TSeq:

esProc_constant_14

In A5, a new TSeq is created. In A6, the record function is used to populate the values of constant cells in the range of A1~E4 area to the TSeq. With such method, the dfx file can be used to store the tabular data.

4.Program parameter

In esProc, some common constants are often set as the program parameter. Firstly, we need to define the program parameters in esProc. When defining the default for the  parameters, the similar constant cell will also parse the type automatically:

esProc_constant_15

When defining the  parameters, we can also choose to set the parameter before each running, and modify the parameter value before cellset computing. The parameter can be used in a similar way as using constants:

esProc_constant_16

Likewise, the sequence can also be used in the program parameter:

esProc_constant_17

Advertisements

About datathinker

a technical consultant on Database performance optimization, Database storage expansion, Off-database computation. personal blog at: datakeywrod, website: raqsoft
This entry was posted in Data Analytics, Unique and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s