• esProc
Tutorial
Function Reference
Code Reference
User Reference
External Library Guide
Data File Tool Manual
DQL Tutorial
Cluster Server Manager Manual
SPL WIN Manual
• YModel
User Reference
JSON-style Parameter Guide
• ReportLite
User Reference
• Official Website

# range()

Read（2221）

Here’s how to use range() functions.

## range(s,e,k:n)

Description:

Get the beginning members of the specified segment and its next segment.

Syntax:

range(s,e,k:n)

Note:

The function evenly divides an interval defined by starting data s and ending data e (both parameters can be integers) into n segments and returns the beginning member of the kth segment and that of the (k+1)th segment as a two-member sequence. The precision of the returned data is determined by the date type. For example, the maximum precision date type data is day, and that of datetime data is second. If parameter k is absent, return the beginning members and ending members of all segments, which means the returned sequence will have n+1 members.

Parameter:

 s Starting data e Ending data k The kth segment whose beginning member is to be returned n The number of segments data is divided

Return value:

Sequence

Example:

 A 1 =range(date("1982-08-09"),date("1992-08-09"),2:3) The maximum precision of the date data is day. 2 =range(datetime("2006-01-01 10:20:30:111"),datetime("20016-01-01 10:20:30:111"),2:3) The maximum precision of the datetime data is second. 3 =range(1,9,2:3) Parameter s and e are integers. 4 =range(date("1982-08-09"),date("1992-08-09"),3) As parameter k is absent, return the beginning members and ending members of all segments.

## A.range()

Description:

Divide a sequence into a specified number of equal segments according to its length and returns the kth segment.

Syntax:

A.range(k:n)

Note:

The function divides sequence A into n equal segments according to its length and retrieves the kth segment to return. It returns all segments when parameter k is absent. The colon (:) after parameter k cannot be omitted when k is absent.

Parameter:

 A A numeric sequence k An integer, which is the sequence number of a specified segment n An integer representing the total number of segments

Return value:

A sequence

Example:

 [1,5,2,6,8,7].range (2:3) Return sequence [2,6]. to(8).range (1:3) Return sequence [1,2,3]. to(8).range (3:3) Return sequence [7,8]. to(8).range (:3) Return sequence [[1,2,3],[4,5,6],[7,8]].