round()

Description:

Truncate data at the specified position and round off the remaining part.

Syntax:

round(numberExp, {nExp})

Note:

The function truncates the data numberExp at the specified position nExp, and rounds off the remaining part.

Parameter:

numberExp

Data to be truncated

nExp

An integer specifying the position at which data is truncated; taken as 0 when it is omitted

>0: Truncate data at nExp decimal place(s) to the right of the decimal point

<0: Truncate data at nExp decimal place(s) to the lft of the decimal point

=0: Truncate data at the current decimal place

Return value:

Numeric value

Example:

round(3451251.274,0)

3451251.0

round(3451251.274,-1)

3451250.0

round(3451251.274,-2)

3451300.0

round(3451251.274,1)

3451251.3

round(3451251.274,2)

3451251.27

Related function:

ceil()

floor()

row()

Here’s how to use row() functions.

k. row()

Description:

Find the record where the key value(s) is/are the specified one(s).

Syntax:

k.row(T)

Note:

The function finds the record whose key value is k in a record sequence/a table sequence/a sequence.

Parameter:

k

A key value; multiple key values will be represented by a sequence

T

A record sequence/a table sequence/a sequence

Return value:

A record

Example:

 

A

 

1

=demo.query("select * from sales")

2

=A1.keys(ORDERID)

Set the key.

3

=2.row(A1)

Find the record whose key value is 2.

4

=A1.select()

Generate a record sequence from A1’s table sequence.

5

=A1.keys(ORDERID,SELLERID)

Set multiple keys.

6

=[1,17].row(A1)

Find the record where key values are [1,17] .

Related function:

A.find()

k.row()

Description:

Find records from an in-memory table according to the specified primary key value(s).

Syntax:

k.row(T)

Note:

The function finds records from in-memory table T according to the specified primary key value(s) k.

Parameter:

k

Primary key value(s); use a sequence to represent multiple key values

T

An in-memory table

Return value:

Record

Example:

 

A

 

1

=demo.cursor("select EID,NAME,GENDER from employee where EID< 10")

Return a cursor.

2

=A1.memory()

Return an in-memory table.

3

=A2.keys(EID)

Set EID as the in-memory table’s key.

4

=2.row(A2)

Find the record where the primary key value is 2.

 

5

=A2.keys(EID,GENDER)

Set EID and NAME as the keys of the in-memory table

6

=[3,"F"].row(A2)

Find the record where the primary key value is [3,"F"].