content esProc

 

 

 

Function Reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Data Type[1][2]

   esProc offers the following functions that return data type information.

Ø  “”,$[]

String

Ø  ‘’

Variable name

Ø  0x12

Hexadecimal long integer

Ø  1L

Long integer

Ø  \s

A character that invokes an alternative interpretation on special characters in a string

Ø  bool()

Convert to a boolean value

Ø  date()

Convert a string or an integer to a date

Ø  datetime()

Convert a string or a long integer to a datetime

Ø  decimal()

Convert to big decimal number

Ø  float()

Convert to double-precision floating-point number

Ø  false

False value

Ø  ifdate()

Find whether the type of parameter is date or datetime

Ø  ifnumber()

Find whether the parameter is of numeric data type

Ø  ifstring()

Find whether the type of parameter is string

Ø  iftime()

Find whether the parameter is of time data type

Ø  int()

Convert to integer

Ø  k()

Generate a serial byte with a specified number of bytes

Ø  k{}

Get certain bytes from a serial byte to form a new serial byte

Ø  long()

Convert to long integer

Ø  k.len()

Get the length of a serial byte

Ø  number()

Convert to number

Ø  null

Null value

Ø  string()

Convert to string

Ø  time()

Convert a string or an integer to a time

Ø  true

True value

Operators[3][4]

   esProc offers a series of operators and related functions to perform general computations.

Ø  ${ }

Macro

Ø  %,\

Get and discard the remainder

Ø  &

Generate a new sequence by merging members of two sequences (or two single values) in a certain order; common members appear only once

Ø  &&,||,!

Logical operations

Ø  (x1,x2,…,xk)

Compute a series of expressions in sequence, and return the result of the last expression; each expression is allowed to reference the variable value computed by the previous expression for value assignment

Ø  *

Generate a new sequence by duplicating members of a sequence

Ø  ++,--,**,//,%%,\\

Generate a new sequence by performing Arithmetic Operations, Mod operation or integer division between members in the same position in two sequences which are of the same length, such as alignment addition, alignment subtraction, alignment multiplication, and so on.

Ø  +,-,*,/

Signs of the four arithmetic operations

Ø  -a

Opposite number

Ø  ==,!=,<,>,<=,>=

Comparison operations

Ø  A.eq()

Judge if a given sequence can be generated by adjusting positions of the members of another sequence

Ø  \

Generate a new sequence by removing members (or the single value) of sequence B from sequence A

Ø  ^

Return a new sequence composed of common members of two sequences

Ø  a=x

Assign the result of an expression to a variable and return this result

Ø  a?=x

Compound assignment

Ø  k1+k2

Concatenate serial bytes

Ø  between()

Check if Parameter 1 is between Parameter 2 and Parameter 3

Ø  case()

Return the value of the expression that satisfies the specified condition

Ø  cmp()

Compare the values of two expressions or two sequences

Ø  eval()

Dynamically parse and compute the expression

Ø  f@o(…)

The function syntax that a function is computed with different options

Ø  if()

Return different values according to different results of a boolean expression

Ø  s1+s2

Concatenate two or more strings end-to-end

Ø  s1/s2

Concatenate a string with one or more pieces of non-string data

Ø  z()

Locate a member of set that is split into multiple subsets

Ø  |

Concatenate members (or single values) of two sequences so as to generate a new sequence

Mathematical Functions[5][6]

   esProc provides the following mathematical functions that return mathematical values.

Ø  abs()

Return the absolute value

Ø  acos()

Return the arc cosine value

Ø  acosh()

Return the inverse hyperbolic cosine

Ø  and()

Perform bitwise AND operation on integers

Ø  asin()

Return the arc sine value

Ø  asinh()

Return the inverse hyperbolic sine

Ø  atan()

Return the arc tangent value

Ø  atanh()

Return the inverse hyperbolic tangent

Ø  bits()

Convert to decimal numbers

Ø  ceil()

Truncate data at the specified position, and carry the remaining part if any

Ø  combin()

Return the number of combinations

Ø  cos()

Return the cosine value

Ø  cosh()

Return the hyperbolic cosine

Ø  exp()

Return e to the nth power

Ø  fact()

Return the factorial

Ø  floor()

Truncate data at the specified position, and reject all the remaining part if any

Ø  gcd()

Return the greatest common divisor

Ø  hash()

Return a hash value

Ø  inf()

Return positive infinity value

Ø  -inf()

Return negative infinity value

Ø  lcm()

Return the least common multiple

Ø  lg()

Return the logarithm with 10 as the base

Ø  ln()

Return the natural logarithm

Ø  not()

On integers, perform bitwise NOT operation to get the logical negation on each bit

Ø  or()

Perform bitwise OR operation on integers

Ø  permut()

Return the number of permutations

Ø  pi()

The ratio of a circle’s circumference to its diameter

Ø  power()

Perform exponentiation or find the nth root of a number

Ø  product()

Return the product of a set of numbers

Ø  rand()

Return a random value

Ø  rgb()

Convert the red, green, blue, and transparency values to the corresponding color value

Ø  round()

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

Ø  shift()

Perform a shift operation

Ø  sign()

Judge whether the parameter is a positive or negative number or a 0

Ø  sin()

Return the sine value

Ø  sinh()

Return the hyperbolic sine

Ø  sqrt()

Return the square root

Ø  tan()

Return the tangent value

Ø  tanh()

Return the hyperbolic tangent

Ø  xor()

Perform bitwise XOR operation on integers

String Functions[7][8]

   esProc offers string functions that handle string values.

Ø  A.export()

Convert a sequence into a string.

Ø  A.regex()

Match each member of a string sequence with a regular expression

Ø  A.concat()

Concatenate members of a sequence with the delimiter and return result as a string

Ø  S.import()

Retrieve contents from a string as records and return them as a table sequence

Ø  asc()

Obtain the Unicode value of a character at the specified position in a string

Ø  base64()

Base64-encode the given data

Ø  char()

Get corresponding characters according to the given Unicode or ASCII code

Ø  concat()

Concatenate parameters into a string

Ø  fill()

Concatenate multiple strings to create a new string

Ø  format()

Generate a formatted string in Java

Ø  htmlparse()

Get text data under a specified tag in an html file

Ø  json()

Parse a string, a record or a table sequence in JSON format

Ø  isalpha()

Check if a string is composed of letters

Ø  isdigit()

Check if a string is composed of numbers

Ø  islower()

Check if a string is composed of lower case letters

Ø  isupper()

Check if a string is composed of upper case letters

Ø  left()

Get a substring starting from the leftmost side of a source string

Ø  len()

Compute the length of a string

Ø  like()

Find if a string matches the format string

Ø  lower()

Convert all characters of a string to lower case

Ø  md5()

Return a string’s MD5 signature

Ø  mid()

Return the substring of a string

Ø  pad()

Pad a string to a certain length by adding another string on the left

Ø  parse()

Parse a string into the corresponding data type

Ø  pos()

Get the position of a substring in its parent string

Ø  rands()

Get a random string

Ø  replace()

Replace a specified substring of a source string

Ø  right()

Get the substring starting from the rightmost side of a source string

Ø  s.regex()

Match a string with a regular expression

Ø  s.split()

Split a string into a sequence by the delimiter

Ø  s.words()

Extract the English words from a string

Ø  sql.sqlparse()

Split a SQL query into a sequence

Ø  sql.sqltranslate()

Translate standard SQL functions into functions a specified database defines

Ø  substr()

Find a substring and return the string after the substring

Ø  string()

Convert the data type of an object to the string data type

Ø  trim()

Remove the blank characters on both ends of a string

Ø  upper()

Convert all characters in a string to upper case

Ø  urlencode()

Encode a URL string

Ø  xml()

Parse a string/a table sequence in the XML format

Date/Time Functions[9][10]

   esProc offers date/time functions that return date, time and datetime values.

Ø  age()

Compute the number of whole years between a specified date and the current time

Ø  date()

Convert a string or an integer to a date

Ø  date(datetimeExp)

Get the date part of the datetime value

Ø  datetime()

Convert the string or long integer to datetime

Ø  datetime(datetimeExp)

Adjust the precision of the datetime expression and return the expression

Ø  day()

Get the day from a date value

Ø  days()

Get the number of days of the year, quarter or month to which the specified date belongs

Ø  deq()

Compare the specified two dates, accurate to the day by default

Ø  elapse()

Get the date/time which is a certain time period before or after a given date/time

Ø  hour()

Get the hour from a specified datetime

Ø  interval()

Compute the interval between two datetime values

Ø  millisecond()

Get the millisecond from a specified datetime value

Ø  minute()

Get the minute from a specified datetime value

Ø  month()

Get the month from a specified date/datetime value

Ø  now()

Get the current system date/time

Ø  pdate()

Get the first day and the last day of the week/month/quarter to which a specified date belongs

Ø  periods()

Generate a sequence of datetime values by specified regular intervals

Ø  range()

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

Ø  second()

Get the second from a specified datetime value

Ø  time()

Convert a string or an integer to time

Ø  time(datetimeExp)

Get the time part of the datetime value

Ø  workday()

Find a date which is the nth workday after the specified date

Ø  workdays()

Return a sequence of workdays between two dates inclusive

Ø  year()

Get the year from a date value

Sequence Functions[11][12]

   esProc offers sequence functions that handle sequence values.

Ø  A(i)

Get a member from a sequence

Ø  A(i)=x

Assign values to members of a sequence

Ø  A(p)

Create a new sequence by getting members from a sequence according to the sequence numbers of members of an integer sequence

Ø  A(p)=X

Assign members of sequence X to corresponding members of another sequence in order

Ø  A(p)=x

Assign value x to corresponding members of another sequence

Ø  A.cand()

Perform logical AND operation over members of a sequence

Ø  A.cor()

Perform logical OR operation over members of a sequence

Ø  A.delete()

Delete specified members from a sequence

Ø  A.icount()

Count the number of distinct members in a sequence

Ø  A.insert()

Insert members into a sequence

Ø  A.inv()

Adjust the order of members of a sequence

Ø  A.len()

Get the length of a sequence

Ø  A.m()

Get members of a sequence at specified positions

Ø  A.m(a:b,c,d:e)

Get members of a sequence at specified positions to form a new sequence

Ø  A.median()

Divide a sequence into multiple segments and return the specified bordering member(s)

Ø  A.modify()

Assign values to one or more members of a sequence according to the specified position(s)

Ø  A.p()

Get sequence numbers of the members at specified positions

Ø  A.pad()

Add members of a sequence to another one until the latter reaches a certain length

Ø  A.psort()

Return the sequence numbers of the sorted members in the original sequence

Ø  A.rvs()

Generate a new sequence by reversing the members in a sequence

Ø  A.segp()

Return the member in a sequence corresponding to a certain interval number

Ø  A.shift()

Get a shuffled sequence

Ø  A.step()

Create a sequence by getting members from a sequence according to the specified starting position and step

Ø  A.swap()

Generate a new sequence by swapping the positions of two intervals in a sequence specified by two integer sequences

Ø  A.to()

Get members from a sequence starting from a specified position to create a new sequence

Ø  []

Define an empty sequence

Ø  [a1,…,an]

Define a sequence constant

Ø  ifa()

Find whether an object is a sequence

Ø  p.inv(k)

Compute the sequence numbers of an integer squence’s members in another integer sequence

Ø  to()

Generate a sequence composed of a series of consecutive integers

Table Sequence Functions[13][14]

   Learn about table sequence functions that are unique in esProc and that handle table sequence values.

Ø  A.field(F)

Get the values in a specified field of a sequence

Ø  A.field(F,x)

Modify the value of a specified field in a sequence

Ø  P.run()

Compute the given expression for each record of the record sequence

Ø  T.create()

Generate an empty table sequence by duplicating the data structure of another table sequence

Ø  T.delete()

Delete specified records from a table sequence

Ø  T.fname()

Get names of fields of a table sequence

Ø  T.fno()

Get the serial number(s) of a single or multiple specified fields in a table sequence

Ø  T.index()

Create an index table for the key of a table sequence

Ø  T.insert()

Insert one or more records into a table sequence

Ø  T.keys()

Set a key for a table sequence

Ø  T.keys(Ki,…;n)

Create an index over a primary key when the latter is set

Ø  T.modify()

Modify one or more records of a table sequence

Ø  T.paste()

Loop through the records of a sequence to modify the specified field of a table sequence in order.

Ø  T.record()

Use the members of a sequence to form new records of a table sequence

Ø  T.reset()

Clear the members of a table sequence

Ø  T.rename()

Modify field names

Ø  T.select()

Return members of a table sequence/memory table which satisfy a condition

Ø  create()

Create an empty table sequence

Ø  create(#F)

Create an empty table sequence with one or more keys set

Ø  ifr()

Find whether an object is a record

Ø  ift()

Find whether an object is a table sequence

Ø  k.r(T.F)

Find a certain field of a specified row in a table sequence/memory table

Ø  r.F

Get value for field F of record r

Ø  r.F=x

Assign x to field F of record r

Ø  r.array()

Get the field values from a record respectively and return them as a sequence

Ø  r.create()

Create a table sequence by copying the data structure of a specified record

Ø  r.field(F)

Get the value of a certain field in a record

Ø  r.field(F,x)

Modify values in the specified field of a record

Ø  r.fname()

Get the name of a field of the record according to the serial number of the field

Ø  r.fno()

Get the serial number of field F of record r in a table sequence

Ø  r.key()

Get the primary key value of a record

Ø  r.modify()

Modify the field values of a record

Ø  r.record()

Modify field values of a record with members of a sequence

Ø  v.v()

Get the primary key value of the record pointed by a referencing field

Loop Functions[15][16]

   esProc offers loop functions that perform loop operations.

Ø  A.(x)

Compute an expression with each member of a sequence, and return the results

Ø  A.avg()

Compute the average value of the non-null members in a sequence

Ø  A.avg(x)

Compute x with each member of the sequence and then compute the average value of the non-null members of the new sequence

Ø  A.calc()

Compute an expression with one or more specified records and return the results

Ø  A.conj()

Concatenate all the members in a sequence whose members are sequences

Ø  A.conj(x)

Compute x with each member of the sequence whose members are sequences, and then concatenate the computed results

Ø  A.contain()

Check whether a given data object is a member of a certain sequence

Ø  A.count()

Count the number of non-null members in a sequence

Ø  A.count(x)

Compute x with each member of the sequence and then count the number of non-null sequence members of the new sequence

Ø  A.diff()

Compute difference between members of a sequence which are also sequences

Ø  A.diff(x)

Compute x with each member of the sequence whose members are sequences, and then compute difference between members of the new sequence

Ø  A.f(x)

The common rules of loop functions

Ø  A.find(k)

Find a record according to its primary key value

Ø  A.ifn()

Get the first non-null member from a sequence

Ø  A.ifn(x)

Compute x with each member of the sequence and return the first non-null member of the new sequence

Ø  A.isect()

Compute the intersection of the member sequences of a sequence

Ø  A.isect(x)

Compute x with each member of the sequence whose members are sequences, and then compute intersection of members of the new sequence

Ø  A.iterate()

Perform interative loop on a record sequence and return the result of the last calculation of a given expression

Ø  A.max()

Compute the maximum value of all the non-null members in a sequence

Ø  A.max(x)

Compute x with each member of the sequence and then find the maximum value of the members of the new sequence

Ø  A.maxp()

Return the member that makes the maximum value for the expression

Ø  A.min()

Compute the minimum value of all the non-null members in a sequence

Ø  A.min(x)

Compute x with each member of the sequence and then find the minimum value of the members of the new sequence

Ø  A.minp()

Return the member that makes the minimum value of the expression

Ø  A.nvl()

Get the first non-null member that isn’t double quoted from an integer sequence

Ø  A.pfind()

Find the sequence number of a record by its primary key

Ø  A.pmax()

Return the sequence numbers of members with the maximum value in a sequence

Ø  A.pmin()

Return the sequence numbers of members with the minimum value in a sequence

Ø  A.pos()

Get the position of a member in a sequence

Ø  A.pos(x)

Get the positions of sequence members in another sequence

Ø  A.pseg(x,y)

Return the sequence number of the interval in which the parameter falls

Ø  A.pselect()

Return the sequence numbers of members that satisfy the query criterion

Ø  A.psort()

Return the sequence numbers of the sorted members in the original sequence

Ø  A.ptop()

Get sequence numbers of top n smallest members of the sequence

Ø  A.rank(y)

Compute the ranking of a specified value in a sequence

Ø  A.rank(y,x)

Get the ranking of a specified value in a computed sequence

Ø  A.ranks()

Compute the ranking of each member in a sequence

Ø  A.ranks(x)

Get the rankings of members of sequence A.(x)

Ø  A.run(x1,x2,…xi)

Compute one or more expressions with each member in a sequence and return the modified sequence

Ø  A.select()

Return members that make the value of the expression true

Ø  A.sort()

Generate a new sequence by sorting the members of a sequence

Ø  A.sum()

Compute the sum of members of a sequence

Ø  A.sum(x)

Compute x with each member of the sequence and compute the sum of the members of the new sequence

Ø  A.top()

Get the n smallest members from a sequence

Ø  A.union()

Compute the union of members in a sequence whose members are sequences

Ø  A.union(x)

Compute x with each member of the sequence whose members are sequences, and then compute union of members of the new sequence

Ø  A.xunion()

Generate a new sequence by uniting and rearranging distinct members in each of a sequence’s sub-sequences

Ø  A.xunion(x)

Calculate an expression with each member of every sub-sequence of a sequence to generate a new sequence by uniting and rearranging distinct members in each of the resulting sub-sequences

Ø  cum()

An iterative loop to get a cumulative value over records in which one of its fields has same values

Ø  iterate()

An iterative loop for calculating an expression

Ø  k.row()

Ø  n.f(x)       

Find one or more records according to specified key value(s)

Perform a loop operation by declaring an integer loop variable

Ø  r.(x)

Compute an expression with a record and return the result

Ø  r.run()

Compute an expression based on a record and return the modified record

Ø  rank()

An iterative loop for numbering records according to the values of certain fields

Ø  ranki()

An iterative loop for numbering records according to the values of certain fields

Ø  seq()

An iterative loop for numbering records in which a certain field contains same values

Ø  ~,#,F,A[i]...

Introduce the common rules of expressions in a loop function

Functions for Associative Operations[17][18]

   The following are functions that deal with esProc associative operations.

Ø  A.derive()

Add one or more fields to a table sequence/record sequence

Ø  A.group(xi,…)

Perform equi-grouping according to one or more fields or expressions

Ø  A.group(x:F,…;y:G,…)

Group a sequence and then perform aggregate operations

Ø  A.groups()      

Group a table sequence and then get the aggregating result cumulatively

Ø  A.id()

Perform merging and sorting, then the distinct operation on a sequence, and return the result of distinct

Ø  A.join()

A foreign-key-style join between table sequences/record sequences, or a table sequence and a record sequence

Ø  A.merge()

Merge multiple table sequences/record sequences

Ø  A.new(xi:Fi,…)

Generate a new table sequence/record sequence, whose field values are computed from the field values of a table sequence/record sequence

Ø  A.news(X;xi:Fi,…)

Compute field values based on a table sequence/record sequence, and concatenate them to generate a new one

Ø  A.pivot()

Perform row-to-column transposition for a sequence

Ø  A.switch()

Switch the values of the reference field between the corresponding primary key values and the referenced records, or, sometimes switch between them in a reverse direction

Ø  E.penum()

Judge to which enum group of a record sequence a field value or an expression belongs, and return the serial number(s) of the group(s) satisfying the grouping criterion

Ø  P.align()

Align the records of a record sequence to another sequence or record sequence by the relational fields and then sort them, so as to group the record sequence

Ø  P.derive()

Generate a table sequence according to a record sequence

Ø  P.enum()

Generate a new record sequence by performing enumeration grouping on a record sequence according to another record sequence of conditional expressions

Ø  P.nodes()

Find the children nodes of a specified record

Ø  join()

Join multiple sequences together

Ø  r.prior()

Among the records, query fields referred by the foreign key recursively

Ø  xjoin()

Perform a cross join on multiple sequences

Ø  xjoinx()

Perform cross join over single cursors or table sequences

File-handling Functions[19][20]

   esProc offers file-processing functions that handle file-related computations.

Ø  directory()

List the file name(s) satisfying a wildcard path

Ø  f.date()

Return the time and date of a file last modified

Ø  f.exists()

Check if a file exists

Ø  f.export()

Write a sequence/record sequence/table sequence into a file

Ø  f.name()

Return a file’s path relative to the main directory

Ø  f.import()

Read the contents of a file and return them as a table sequence

Ø  f.property()

Read the property value from the property file

Ø  f.read()

Read contents of a file and return them as strings

Ø  f.size()

Return the length of a file

Ø  f.write()

Write a string or a string sequence into a file

Ø  f.xlsexport()

Write a table sequence/cursor to an Excel file

Ø  f.xlsimport()

Retrieve contents of an Excel file and return them as a table sequence

Ø  f.xlsopen()

Read an Excel file and return an Excel file object

Ø  f.xlswrite()

Save an Excel file object into an Excel file

Ø  file()

Open a file with the specified name

Ø  filename()

Split up a full path to get the file name and extension

Ø  movefile()

Copy, move, delete or rename a file across partitions

Ø  SQL+

Automatically translate to SPL

Ø  xo.xlscell()

Enter values to an Excel file object or read values from it

Ø  xo.xlsclose()

Close an Excel file object

Ø  xo.xlsexport()

Write a sequence into an Excel file object

Ø  xo.xlsimport()

Retrieve a table sequence from an Excel file object

Database Functions[21][22]

   esProc supplies database functions that return database-related information.

Ø  connect()

Establish a connection to a datasource

Ø  db.close()

Close a database connection

Ø  db.commit()

Commit the database transaction manually

Ø  db.error()

Obtain the last error information from the database connection

Ø  db.execute()

Execute a SQL statement through a specified database connection

Ø  db.isolate()

Define transaction isolation level for the connection according to the option and return the original level

Ø  db.proc()

Call a database stored procedure

Ø  db.query()

Execute a SQL statement by a database connection and return the query results                                             

Ø  db.query(sql)

Query an external table using simple SQL and return the query result

Ø  db.rollback()

Roll back the database transaction

Ø  db.savepoint()

Set the savepoint to which you can later rollback

Ø  db.update()

Update a database table according to a sequence/record sequence

Cursor Functions[23][24]

   esProc provides cursor functions that handle cursor-related computations.

Ø  A.cursor()

Generate a cursor from a sequence

Ø  A.cursor@m()

Generate a multicursor from a sequence

Ø  A.push()

Push data in a given sequence into a channel

Ø  CS.conjx()

Concatenate members of a cursor sequence and return result as a cursor

Ø  CS.mcursor()

Generate a multicursor based on a sequence of cursors

Ø  CS.mergex()

Merge members of a sequence of cursors

Ø  ch.()

Compute a given expression over each member in a channel

Ø  ch.attach()

Attach an operation to a channel

Ø  ch.conj()

Split each of the records in a channel, union the members and return the resulting union as a channel

Ø  ch.derive()

Add fields to records in a channel

Ø  ch.fetch()

Fetch and store the existing data in a channel

Ø  ch.group()

Group records in a channel by comparing each one with its neighbor(s) and return a channel

Ø  ch.groupn()

Group records in a channel and push them respectively into a sequence of channels

Ø  ch.groups()

Group records in a channel

Ø  ch.groupx()

Group records in a channel and return a channel

Ø  ch.id()

Generate a channel consisting of values of one or more fields

Ø  ch.iterate()

Perform interative loop on record sequences in a channel and return the result of the last calculation of a given expression

Ø  ch.join()

A foreign-key-style join between a channel and a record sequence

Ø  ch.joinx()

Join up a channel and a bin file/an entity table acocording to the foreign key

Ø  ch.new()

Return a channel with newly-computed field values for its records

Ø  ch.news()

Get new values for the fields of records in a channel and update them into the channel

Ø  ch.push()

Push data in a channel into another channel

Ø  ch.result()

Get result of an operation performed in a channel

Ø  ch.run()

Compute an expression against each of the records in a channel and return the channel with new field values

Ø  ch.select()

Return a channel with records that meet the given condition

Ø  ch.select(x,ch’)

Send records in a channel that can’t meet the given condition into another channel

Ø  ch.sortx()

Sort records in a channel

Ø  ch.switch()

Switch the values of a reference field in a channel between the corresponding primary key values and the referenced records, or, sometimes switch between them in a reverse direction

Ø  ch.total()

Perform aggregatgion over records in a channel

Ø  channel()

Create a channel

Ø  channel(cs)

Create a channel and push data in a specified cursor into it

Ø  channel(ch)

Create a channel and push data in another channel into it

Ø  cs.(x)       

Compute an expression over each member in the cursor and return results as a cursor

Ø  cs.close()

Close a cursor

Ø  cs.conj()

Split each of the records in a cursor, union the members and return the original cursor

Ø  cs.derive()

Add one or more fields to a cursor

Ø  cs.fetch()

Fetch one or more records from a cursor

Ø  cs.group()

Group cursor records by comparing only adjacent records and return the original cursor

Ø  cs.group(x:F,...;y:G,…)

Group records of a given cursor by comparing each with its neighbors, perform aggregation over each group and return the original cursor

Ø  cs.groupn(x;C)

Group records in a cursor and push them respectively into a sequence of channels

Ø  cs.groupn(x;F)

Group records of a cursor and write the subset groups as a sequence of bin files

Ø  cs.groups()

Group records in a cursor

Ø  cs.groupx()

Group records in a cursor and return result as a cursor

Ø  cs.id()

Generate a sequence consisting of values of fields in a given cursor

Ø  cs.iterate()

Perform interative loop on record sequences in a cursor and return the result of the last calculation of a given expression

Ø  cs.join()

A foreign-key-style join between a cursor and a table sequence/record sequence

Ø  cs.joinx()

Join up a cursor and a segmentable bin file according the foreign key

Ø  cs.mcursor()

Generate a multicursor based on one cursor

Ø  cs.mergex()

Merge all parts of a cluster cursor into a local ordinary cursor

Ø  cs.new()

Return a cursor with newly-computed field values for its records

Ø  cs.news()

Compute new cursor field values to update them into the original cursor

Ø  cs.push()

Push data in a cursor into a channel

Ø  cs.rename()

Rename a returned field of a cursor

Ø  cs.regex()

Match the string members in a cursor with a regular expression

Ø  cs.reset()

Reset a cursor by moving it back to the beginning

Ø  cs.run()

Compute one or more expressions against each of the records in a cursor and return the modified cursor

Ø  cs.select(x;f)

Write the records that unsatisfy the specified expression into a bin file

Ø  cs.select()

Return a cursor with records meeting the given condition

Ø  cs.select(x,ch')

Send records in a cursor that can’t meet the given condition into a channel

Ø  cs.skip()

Skip records while fetching records from a database cursor, and return the number of skipped records

Ø  cs.sortx()

Sort data in a cursor

Ø  cs.switch()

Replace values of a specified field in a cursor with the referencing field values of the corresponding record in another table

Ø  cs.total()

Perform aggregatgion over records in a cursor

Ø  db.cursor()

Create a database cursor by executing an SQL statement and return it

Ø  db.execute()

Execute a SQL statement through a specified database connection

Ø  db.update()

Update a database table according to a cursor

Ø  f.cursor()

Create a cursor based on a file

Ø  f.cursor@m()

Create a multicursor based on a file

Ø  f.export()

Retrieve data from a cursor and write it to a file

Ø  f.iselect()

Create a cursor based on an ordered file and return it

Ø  joinx()

Join table sequences retrieved from a series of cursors

Ø  mcs.cursor(n)

Merge subcursors in a multicursor into a single cursor or a new multicursor with a smaller number of parallel subcursors

Ø  mcs.fetch()

Get records from a multicursor

Ø  mcs.mergex()

Merge multicursors into an ordinary cursor

Statements[25][26]

   The following are statements and program-related functions in esProc.

Ø  #c

The variable generated during the process of loop

Ø  Cr

Define a cell name

Ø  [a:b]

Get values from row/column/cell a to row/column/cell b to create a sequence

Ø  @

Value of the current cell referenced in an expression

Ø  'x,=x,>x,/x

Cell type

Ø  ==x,>>x,//x,??

Code block type

Ø  $()sql

Query local text files/bin files/composite table files using simple SQL

Ø  $(db)sql;…

Execute the specified SQL statement on the data source and return result

Ø  arguments()

Return a list of the current dfx file’s argument names

Ø  break {a}

Break the current loop

Ø  call()

Call the cellset file and return the first result set

Ø  clear

Clear the values of certain cells

Ø  cursor cs cursor … cursor

Set up cursors to define pipes for each cursor

Ø  cursor(dfx,…)

Generate a cursor using a program

Ø  end s

Log the error message

Ø  for cs,n;x

Loop through the cursor

Ø  for x

Start a loop

Ø  for a,b,s

Execute a loop according to the specified scope and span

Ø  fork Ai

Use multithreads to execute the code block in a cellset

Ø  fork cs

Perform parallel computation over a multicursor

Ø  fork...fork...

Execute multiple code blocks in parallel

Ø  func …{return xi}

Define a function block

Ø  func()

Call a subroutine

Ø  if x

If statement

Ø  if x else

If statement

Ø  if x …{ else { if x}… }

If statement

Ø  if x…else …

If statement

Ø  goto C

Jump to execute cell C

Ø  next {a}

Skip the current loop and continue with the next loop

Ø  register(f,dfx)

Register a dfx file as a function to be called

Ø  return xi

Return the result xi,…

System- & interface-related Functions[27][28]

   esProc offers system- & interface-related functions that handle system and interface information and operations.

Ø  >statement

With esProc JDBC, generate the contextual execute statement and return every possible result set once the statement is executed

Ø  =expression

With esProc JDBC, execute the statement directly and return the result set

Ø  $(db)sql;…

With esProc JDBC, execute the specified SQL statement and return the result set

Ø  call path/dfx(…)

Search for a program file locally via esProc JDBC; if the file can’t be found, then search the server

Ø  clipboard()

Set system clipboard content

Ø  dfx(…)

With esProc JDBC, search for and execute a program file locally; if not found, then search the server

Ø  env()

Assign value to the global variable

Ø  httpfile()

Package the returned result of URL as file flow and return it

Ø  ifv()

Check whether a variable exists

Ø  invoke()

Invoke the static function of class in the package

Ø  lock()

Use a synchronization lock

Ø  output()

Output data to the console

Ø  sizeof()

Calculate the memory space an object occupies

Ø  sleep()

Make esProc program sleep

Ø  system()

Execute the system command

Cluster Computing Functions[29][30]

   esProc offers cluster computing functions that handle cluster computations.

Ø  callx(dfx,…;h,s;x)

Compute a cellset file using parallel processing and return a sequence consisting of results sets of the parallel tasks

Ø  file(fn:z,h)

Open a remote file with the specified name

Ø  fork...;h,s reduce

Execute a code block with multiple threads on multiple nodes

Ø  hosts(h,n)

Search the main processes to get nodes containing specified data zones

Ø  sync()

Synchronize the nodes

Ø  zone(h)

Get data partitions from nodes

Ø  zone(i)

Number a memory data zone

Chart-plotting Functions[31][32]

   esProc offers chart-plotting functions used for plotting charts.

Ø  G.draw()

Draw on a canvas

Ø  G.hlink()

Return the hyperlink string of a canvas

Ø  G.plot()

Compute the chart plotting string and its parameters, plot them onto the canvas and return the result

Ø  canvas()

Return the canvas object

Financial Functions[33][34]

   esProc supplies a financial functions that return financial information.

Ø  Faccrint()

Calculate the accrued interest for a security that pays periodic interest

Ø  Faccrintm()

Calculate the accrued interest for a security that pays interest at maturity

Ø  Fcoupcd()

Calculate the coupon date

Ø  Fcoups()

Calculate the number of coupons payable between a security’s settlement date and maturity date/ the number of days in a coupon period that contains the settlement date/ the number of days from the beginning of a coupon's period to the settlement date / the number of days from the settlement date to the next coupon date

Ø  Fdb()

Calculate the depreciation of an asset for a specified period

Ø  Fddb()

Calculate the depreciation of an asset for a specified period

Ø  Fdisc()

Calculate the discount rate for a security

Ø  Fduration()

Return the modified duration of a security that pays periodic interest with an assumed par value

Ø  Fintrate()

Calculate the interest rate for a security that pays interest at maturity

Ø  Firr()

Calculate the internal rate of return for a series of cash flows represented by numeric values

Ø  Fmirr()

Calculate the modified internal rate of return for a series of periodic cash flows

Ø  Fnper()

Calculate the number of periods required to pay off a loan according to a specified periodic payment

Ø  Fnpv()

Calculate the net present value of an investment

Ø  Fpmt()

Calculate each period’s amount required to pay off an investment loan

Ø  Fprice()

Calculate the price of a security

Ø  Frate()

Calculate the interest rate required to pay an investment

Ø  Freceived()

Calculate the amount received at maturity for a security

Ø  Fsln()

Calculate the straight-line depreciation of an asset for each period

Ø  Fsyd()

Calculate depreciation of an asset for a specified period, using the sum-of-years’ digits method

Ø  Fv()

Calculate the future value of an investment

Ø  Fvdb()

Calculate the depreciation of an asset for a specfied period

Ø  Fyield()

Calculate the yield rate

External Library Functions[35][36]

   esProc has external library functions that access and handle data stored in various places.

Ø  ali_client()

Connect to Alibaba Cloud and return result as a cursor

Ø  ali_close()

Close the connection to Alibaba Cloud

Ø  ali_query()

Query a certain part of the data, and return result as a cursor

Ø  es_close()

Close REST Client connection

Ø  es_delete()

Execute a delete command over an ES server

Ø  es_head()

Execute a head command over an ES server

Ø  es_get()

Execute a get command over an ES server

Ø  es_open()

Connect to Elasticsearch (ES) server

Ø  es_post()

Execute a post command over an ES server

Ø  es_put()

Execute a put command over an ES server

Ø  ftp_cd()

Set the remote working directory/directories on the FTP server

Ø  ftp_client()

Create an FTP client

Ø  ftp_close()

Exit an FTP client program

Ø  ftp_dir()

List all directories and files under the current directory on an FTP server

Ø  ftp_get()

Download a file from the FTP server

Ø  ftp_mget()

Download multiple files from a FTP server

Ø  ftp_mput()

Upload multiple files onto a FTP server

Ø  ftp_put()

Upload a file to the FTP server

Ø  hbase_close()

Close a HBase connection

 

Ø  hbase_cmp()

Compare data with the HBase-supplied comparator

 

Ø  hbase_filter()

Filter data with the HBase-supplied filter

 

Ø  hbase_filterlist()

Filter data with multiple filters

 

Ø  hbase_get()

Query data in HBase database and return a single row

 

Ø  hbase_open()

Create a HBase connection

 

Ø  hbase_scan()

Query a HBase database and return result as a cursor or a table sequence

 

Ø  hdfs_client()

Connect to the HDFS file system and return an HDFS client object

Ø  hdfs_close()

Close the HDFS connection

Ø  hdfs_dir()

List the file names in a specified path in an HDFS file system

Ø  hdfs_file()

Open a specified directory and return an HDFS file flow

Ø  hive_client()

Create a Hive database connection

Ø  hive_close()

Close a Hive database connection

Ø  hive_cursor()

Query a Hive database, and return the result as a cursor

Ø  hive_execute()

Execute Hive’s SQL-like queries

Ø  hive_query()

Query a Hive database, and return the result as a sequence

Ø  ifx_close()

Close Informix database connection

Ø  ifx_conn()

Create Informix database connection

Ø  ifx_cursor()

List the fragmentation information of a specified table with cursors

Ø  ifx_listfrag()

List the fragmentation information of a specified table with table sequences

Ø  ifx_savefrag()

Save the fragmentation information file stored in the memory as a new file

Ø  ifx_setfrag()

Set the fragmentation information of a specified table

Ø  ifx_takefrag()

Extract fragmentation information from the database

Ø  kafka_close()

Close a Consumer connection

Ø  kafka_commit()

Commit the current consumer offset position

Ø  kafka_poll()

Return records in a Consumer topic as a table sequence

Ø  kafka_subscribe()

Connect to Kafka server

Ø  mongo_close()

Close the connection to MongoDB

Ø  mongo_insert()

Insert data to a MongoDB database

Ø  mongo_open()

Connect to MongoDB server

Ø  mongo_shell()

Query MongoDB and return the query result

Ø  olap_close()

Close connection to a multidimensional database

Ø  olap_open()

Establish connection to multidimensional database

Ø  olap_query()

Query data in a multidimensional database and return the result

Ø  redis()

Connect to a Redis database under the single machine model

Ø  redis_close()

Close a Redis database connection

Ø  redis_cluster()

Connect to Redis cluster

Ø  redis_get()

Get the values of all the given keys

Ø  redis_getrange()

Get a substring of the string stored at a key

Ø  redis_hkeys()

Get all the fields in a hash

Ø  redis_hlen()

Get the number of fields in a hash

Ø  redis_hmget()

Get the values of all the given hash fields

Ø  redis_hvals()

Get the values of all hash fields

Ø  redis_keys()

Find all keys matching the specified pattern

Ø  redis_lindex()

Get a member from a list by its index

Ø  redis_llen()

Get the length of a list

Ø  redis_lrange()

Get a range of members in a list with indexes within the given values

Ø  redis_pool()

Connect to Redis database in buffer pool mode

 

Ø  redis_scard()

Get the number of members in a set

Ø  redis_sdiff()

Get members of the difference set of all the given sets

Ø  redis_select()

Change the selected database for the current connection

Ø  redis_sentinel()

Connect to distributed Redis cluster

 

Ø  redis_shared()

Connect to a Redis database in shared pool mode

 

Ø  redis_sharedpool()

Connect to a Redis database in a mode of both buffer pool and shared pool

 

Ø  redis_sinter()

Get members of the intersection of all the given sets

Ø  redis_sismember()

Determine if a given value is a member of a set

Ø  redis_smembers()

Get all members of a set

Ø  redis_srandmember()

Get one or multiple random members from a set

Ø  redis_strlen()

Get the length of the string value stored in the key

Ø  redis_sunion()

Get the members of the union of all the given sets

Ø  redis_type()

Get the data type of the value stored in the key

Ø  redis_zcard()

Get the number of members in a sorted set

Ø  redis_zcount()

Count the number of members in a sorted set with scores between a given interval

Ø  redis_zrange()

Return a range of members in a sorted set, by index

Ø  redis_zrangebyscore()

Return a range of members in sorted set, by score

Ø  redis_zrank()

Determine the ranking of a member in a sorted set

Ø  redis_zscore()

Get the score associated with the given member in a sorted set

Ø  report_config()

Read information from the configuration file

Ø  report_exportHtml()

Export a report as a HTML file or an MHT file

Ø  report_exportPdf()

Export a report as a PDF file

Ø  report_exportXls()

Export a report as an xls file or an xlsx file

Ø  report_open()

Read a report file

Ø  report_run()

Compute a report file

Ø  sap_client()

Connect to an SAP server

Ø  sap_close()

Close an SAP server connection

Ø  sap_cursor()

Return the list of table-valued result set as a cursor

Ø  sap_excute()

Get a function object according to the import parameter(s)

Ø  sap_getparam()

Get data records according to the import parameter(s)

Ø  sap_table()

Return a list according to the import table-valued parameter

Ø  spark_client()

Create a Spark database connection

Ø  spark_close()

Close a Spark database connection

Ø  spark_cursor()

Query a Spark database, and return the result as a cursor

Ø  spark_query()

Query a Spark database, and return the result as a sequence

Ø  stax_close()

Close connection to the Cassandra database

Ø  stax_connect()

Create connection to the Cassandra database

Ø  stax_query()

Query a Cassandra database and return query result as a table sequence

Ø  ws_call()

Create a web service client

Ø  ws_client()

Send a query request to the web service server to get the returned data

Ø  ym_build_model()

Perform model building operation

Ø  ym_close()

Close Python service to reduce source usage

Ø  ym_env()

Initialize the environment by setting an environment variable

Ø  ym_importance()

List the degrees of importance for model building variables

Ø  ym_list()

List model files under a specified directory

Ø  ym_model()

Load data for model building

Ø  ym_performance()

Get information about the performance of a model

Ø  ym_predict()

Generate a model object based on a model file

Ø  ym_present()

Get model description data

Ø  ym_result()

Generate the prediction result according to a model object and the data for prediction

Ø  ym_setparam()

Set model building parameters

Ø  ym_statistics()

Get a series of information about a specified  variable

Ø  ym_target()

Set a target variable for model building

Ø  zip()

Perform file compression operations

Ø  zip_add()

Add one or more files to a zip file

Ø  zip_close()

Close a zip file

Ø  zip_compress()

Set compression mode and level for a would-be zip file

Ø  zip_del()

Delete one or more files from a zip file

Ø  zip_encrypt()

Set encryption mode for a zip file

Ø  zip_extract()

Extract one or more files from a zip file

Composite-Table-Related Functions[37][38]

The following are composite-table-related functions that handle computations over composite tables that are unique in esProc.

Ø  C

A column in a table, its parent table, or a table above them

Ø  channel(cs)

Create a cluster channel and push data in a specified cluster cursor into it

Ø  channel(ch)

Create a cluster channel and push data in another cluster channel into it

Ø  cs.fetch()

Fetch data from a distributed cursor

Ø  cs.group()

Group a cluster cursor by comparing each record with its next neighbor

Ø  cs.group(x:F,...;y:G,...)

Group a cluster cursor by comparing each record with its next neighbor and then aggregate each group

Ø  cs.groups()

Group the records in a cluster cursor

Ø  cs.groupx()

Group records in a cluster cursor and return result as a synchronously segmented cluster cursor

Ø  cs.join()

A foreign-key-style join between a cluster cursor and a record sequence

Ø  cs.joinx()

Join up a cursor and an entity table by the foreign key

Ø  cs.memory()

Generate a memory table from a cursor

Ø  cs.memory()

Generate a cluster memory table from a cluster cursor

Ø  cs.sortx()

Sort data in a cluster cursor

Ø  cs.switch()

Replace values of a specified field in a cluster cursor with the referencing field values of the corresponding record in another table

Ø  f.append()

Concatenate two same-structure composite tables

Ø  f.create()

Open a composite table

Ø  f.create()

Open a cluster composite table

Ø  f.create(C:b1,…;K:b2;pw:pr)

Generate a composite table’s base table from a file

Ø  f.create(C:b1;...;K:b2;pw:pr;x)

Generate a cluster composite table’s base table from a distributed file

Ø  f.reset()

Copy a composite table file to another composite table file

Ø  f.rollback()

Restore a composite table file to the previous state when update error happens

Ø  file(fn,h)

Generate a cluster file from a remote composite table file

Ø  joinx()

Join multiple synchronously segmented cluster cursors/multicursors

Ø  k{}

Get certain bytes from a serial byte to form a single-byte serial byte

Ø  k1+k2

Concatenate serial bytes

Ø  k.row

Find one or more records from a memory table according to specified key value(s)

Ø  memory()

Generate a cluster memory table from a local memory table

Ø  T.append(cs)

Append records in a cursor/distributed cursor to an attached entity table

Ø  T.attach(T’)

Retrieve an attached table from a cluster composite table

Ø  T.attach(T’,C…)

Add an attached table to a composite table’s base table

Ø  T.C

Retrieve a specified column from an attached table

Ø  T.cgroups()

Perform grouping and aggregation over a pre-summarized data cube

Ø  T.close()

Close a composite table file

Ø  T.cuboid()

Store the result set of grouping an entity table as a pre-summarized data cube

Ø  T.cursor(x:C,…;wi,...;k:n)

Segment an entity table and return the cursor of a specified segment

Ø  T.cursor(x,...;wi,...)

Return one or more specified columns of a cluster entity table/cluster memory table as a cluster cursor

Ø  T.cursor(x:C,...;wi,...;mcs)

Synchronously segment an entity table according to a multicursor and return a multicursor

Ø  T.cursor(x:C,...;wi,...;mcs)

Synchronously segment a cluster entity table according to a cluster multicursor and return a cluster multicursor

Ø  T.cursor(C,…;wi,...;k:n)

Segment a memory table/cluster memory table and return cursor of the specified segment

Ø  T.cursor(...;w;mcs)

Divide a memory table in sync with a memory multicursor and return it also as a memory multicursor

Ø  T.delete(P)

Delete specified record(s) from an entity table

Ø  T.delete(P)

Delete specified record(s) from a memory table

Ø  T.delete(P)

Delete specified records from a cluster table

Ø  T.derive()

Add fields of a composite table to a table sequence/cursor according to the latter's key values

Ø  T.derive()

Add fields of a cluster composite table to a table sequence/cursor according to the latter's key values

Ø  T.dup()

Join up cluster memory table into a local memory table

Ø  T.dup(h)

Copy a local memory table onto nodes to create a duplicate cluster memory table

Ø  T.f(C)

Perform an aggregate operation over an attached table’s column

Ø  T.find(k,…)

Find the record(s) according to the specified primary key value(s) from a memory table

Ø  T.find(k;x:C,...)

Find the record(s) according to the specified primary key value(s) from the base table

Ø  T.icursor(C,;w,I)

Use index to filter an entity table according to the filtering condition

Ø  T.icursor(C,...;w,I)

Use index to filter a cluster table according to the filtering condition

Ø  T.import()

Read in records from an entity table and return them as a sequence, record sequence or table sequence

Ø  T.index(I:h,w;C,…;F,…)

Create an index file for an entity table

Ø  T.index(n)

Create an index for the key of a memory table

Ø  T.keys()

Define the key(s) for a memory table

Ø  T.len()

Get the number of records in a memory table

Ø  T.memory()

Convert a compressed memory table into an uncompressed one

Ø  T.memory(C,…;w)

Generate a memory table from an entity table

Ø  T.memory(C,…;w)

Generate a cluster memory table from a cluster entity table

Ø  T.new(A/cs,x:C,...;wi,…)

Retrieve non-key fields from a composite table according to key values of a table sequence/record sequence or a cursor and return a table sequence or a cursor

Ø  T.new(A/cs,x:C,...;wi,…)

Retrieve non-key fields from a cluster composite table according to key values of a table sequence/record sequence or a cursor and return a table sequence or a cluster multcursor

Ø  T.news(A/cs,x:C,...;wi,...)

Retrieve fields from a table sequence or a cursor according to key values to form a new table sequence

Ø  T.rename(F:F’,…)

Modify a field name or the index name

Ø  T.update(P)

Update records in an entity table

Ø  T.update(P)

Update records in a memory table

Ø  T.update(P)

Update records in a cluster composite table

Ø  T{x:C,...}

Return an attached table’s records as a sub table sequence

Functions[39][40]

This reference guide includes all functions used in esProc. Each function reference consists of all or most of these items – Description, Syntax, Note, Parameters, Options, Return value, and Example.

#c[41][42]

Description:

The variable generated during the process of loop.

Note:

c

The cell where for statement is placed

#c

The sequence number of the loop

Example:

 

A

B

C

 

1

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

 

 

[1,2,4,5,7,10,11]

2

=[]

 

 

 

3

for A1

 

 

In the process of loop, insert the sequence numbers of loops for all departments - except for Sales into sequence A2

4

 

if A3.DEPT=="Sales"

 

5

 

 

next

6

 

>A2=A2|[#A3]

 

 

$(db)sql;…[43][44]

Here’s how to use $(db)sql;… function.

$(db)sql;…[45][46]

Description:

Execute the specified SQL statement on the data source and return the result.

Syntax:

$(db)sql;

Note:

On the data source db, execute the specified SQL statement sql and return the execution result. db is the database connection object. If omitting (db), then use the data source specified by the previous statement. If there isn’t an existing data source for uset, then use any one of the currently connected data sources.

Parameters:

sql

A SQL statement in the form of select * from table, for example; here the SQL statement must be a select/insert/delete/update statement.

(db)

Data source name

Argument value passed to the SQL statement

Return value:

A table sequence composed of results of executing the SQL statement.

Example:

Ø  SELECT statement

 

A

 

1

$select * from EMPLOYEE

Error:" Missing the database connection factory "

2

$(demo)select * from EMPLOYEE where EID=?;1

Find the employees whose EID is 1

3

$select * from EMPLOYEE where EID in (?) or GENDER=?;[1,3,5,7],"M"

Find the employees whose EID is [1,3,5,7] and gender is M

 

Ø  INSERT statement

 

A

B

 

1

$(demo)insert into EMPLOYEE (EID, NAME) values(?,?);100,"test"

 

2

[51,52,53,54]

 

3

for A2

 

 

4

 

$insert into STATECAPITAL (STATEID) values(?);A3

 

Ø  DELETE statement

 

A

 

1

$(demo)delete from EMPLOYEE where EID =? or EID=?;100,101

 

2

$delete from EMPLOYEE where EID in(?);[1,5,7,9]

 

3

$delete from EMPLOYEE where NAME ='Rebecca'

 

Ø  UPDATE statement

 

A

 

1

$(demo)update EMPLOYEE set NAME =?, GENDER=?

where EID =?;"testnew","M",100

 

2

$update EMPLOYEE set NAME ='Peter' where EID =10

 

3

$(sql)update Family set Name='Rose' where Eid=?;2

Update the name of a record of Family whose Eid is 2 by connecting to a data source named sql

Related functions:

db.query()

$(db)sql;…[47][48]

Description:

Through esProc JDBC, execute the specified SQL statement in the database and return the result set.

Syntax:

$(db)sql;

Note:

In the specified database db, the function executes the specified SQL statement, with the parameters represented by … after semicolons, and returns the result set once executed. Use st.executeQuery() for the execution and return the result set. Make sure the database db must be connected. There aren’t necessarily parameters used in the statement; but if there are, they always start with arg.

In JDBC, a string starting with select or with will be interpreted as a simple SQL statement for execution. If the string is followed by a pair of parentheses, it will be interpreted as a dfx file name. For instance, selectTab() represents a dfx file name.

Parameters:

sql

A SQL statement, like select * from table; it should be any of the select/insert/delete/update statements

(db)

Datasource name

SQL parameter’s value

Return value:

A set

Example:

public void testDataServer() {

                Connection con = null;

                java.sql.Statement st;

                try{

                        Class.forName("com.esproc.jdbc.InternalDriver");

                        con= DriverManager.getConnection("jdbc:esproc:local://");   

                        st=con.createStatement();

                        // Query demo database student table to find the data of students who are older than 16

                        ResultSet set = st.executeQuery("$(demo)select * from STUDENTS where AGE>?;16");

                        printRs(set);

                }

                catch(Exception e){

                        System.out.println(e);

                }

                finally{

                        // Close the connection

                        if (con!=null) {

                                try {

                                        con.close();

                                }

                                catch(Exception e) {

                                        System.out.println(e);

                                }

                        }

                }

        }

$()sql;…[49][50]

Description:

Query an external table using simple SQL.

Syntax:

$()sql;…    

Note:

The function performs a query over an external data file. As a normal table sequence, the external file can be directly queried by using “file name.extension” as its name, which makes it the external table. The query syntax, which we call simple SQL, is similar to the SQL syntax of the database query.

Support external data files in the format of txt, csv, xlsx, xls, btx (segmented binary files). An external data table file has headers by default. Use a relative path or an absolute path to access an external data table file; the relative path is relative to esProc main directory.

Refer to db.query(sql) function to learn more about the syntax of simple SQL.

Parameters:

sql

A “simple SQL” statement, like select * from filename.txt

A parameter value in the simple SQL statement

 

 

 Note: the parentheses in the $()sql;… function can be omitted.

Return value:

   Table sequence

Example:

 

A

 

1

$()select * from Persons.txt

Retreive records from the external table Persons.txt and return result as a table sequence

2

$select * from D:/Orders.txt

Make the query via the absolute path and return result as a table sequence

3

$select * from Persons.csv where Id_P=? or Id_P>?;2,2

Get records where Id_P is equal to or greater than 2 from the external table

4

$select  *  from Persons.txt  P  join Orders.txt  O  on P.Id_P = O.Id_P

Perform a query through a join

5

$select  distinct(Id_P)  from Orders.btx

Get records where Id_P value is unique from the external table

${macroExp}[51][52]

Description:

This is used to complete the macro replacement operation.

Syntax:

${macroExp}

Note:

The macro here is taken as an expression to be computed, the result must be a string, which will replace the ${macroExp}.

The macro enclosed in quotation marks or populated in the constant cell will not be replaced.

Parameters:

macroExp

The macro expression, the result of which will replace the ${macroExp}, so the result must be a string.

Return value:

String

Example:

 

A

 

1

="1"

 

2

=${A1}+3

After replacing, the expression becomes =1+3, so the return value is 4

3

="${A1}+3"

Macro is enclosed in quotation marks, so it will not be replaced, and the return value is still "${A1}+3"

4

=demo.query("select * from EMPLOYEE limit 5")

 

5

=A4.(age(~.HIREDATE))

Find ages of the first 5 employees

6

=A4.(${age(A4.~.HIREDATE)}+5)

Characters in a macro will be replaced only when the expression is first parsed; a macro can’t be parsed repeatedly

=expression[53][54]

Description:

Through the esProc JDBC, execute the statement directly and return the result set

Syntax:

=expression

Note:

This statement works similarly to an expression in the esProc calculation cell. The Statement can be generated by directly using con.createStatement(). Use st.executeQuery() to execute the statement directly, and return the result set. If the statement contains the tab/enter separator, a cellset will be dynamically generated for executing it. Notice that the expression must start with an equal sign. There aren’t necessarily parameters used in the statement; but if there are, they always start with arg.

Parameters:

expression

SQL statement or expression. If there are multiple expressions in the bracket, the expressions will be computed one by one and the value of the last expression will be returned, for example: (arg1=1,arg2=2,arg1+arg2), the return value is 3

Return value:

Result set

Example:

public void testDataServer() {

Connection con = null;

java.sql.PreparedStatement st;

java.sql.Statement st2;

try{

Class.forName("com.esproc.jdbc.InternalDriver");

con=DriverManager.getConnection("jdbc:esproc:local://");    

// Call the stored procedure

st=con.prepareCall("call test(3)");

// Execute statement directly, return result set

ResultSet set = st.executeQuery("=(arg=3,arg+3)");

// Print results

printRs(set);

// Create Statement directly

st2=con.createStatement();                     

ResultSet set2 = st2.executeQuery("=(arg=3,arg+4)");

printRs(set2);

// If the statement contains the tab/enter separator, a cellset will be dynamically generated for executing it

ResultSet b =st2.executeQuery("==null\nfor 1,11,5\n\t>A1=A1+A2");

printRs(b);

}

catch(Exception e){

System.out.println(e);

}

finally{

// Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}

>statement[55][56]

Description:

Through esProc JDBC, generate the contextual execution statement, and return every possible result set once the statement is executed

Syntax:

>statement

Note:

This statement works similarly to the expression in the esProc execution cell if it contains only a single line. There will be no result set returned once it is executed. If it contains multiple lines separated by tab/enter, every possible result set will be returned once it is executed. In the esProc JDBC, the Statement can be generated by directly using con.createStatement(). Use st.execute() to execute the statement directly. There aren’t necessarily parameters used in the statement; but if there are, they always start with arg.

Parameter:

statement

A statement/a clause

Example:

1.     The statement contains merely a single line:

public void testDataServer() {

Connection con = null;

java.sql.Statement st;

try{

Class.forName("com.esproc.jdbc.InternalDriver");

con= DriverManager.getConnection("jdbc:esproc:local://");

// Create Statement directly

st=con.createStatement();

// Execute statement directly to perform an operation over the specified data set

boolean b =st.execute(">demo.execute(\"delete from STUDENTS where ID = 1\")");

// Print execution result

System.out.println(b);

}

catch(Exception e){

System.out.println(e);

}

finally{

// Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}

 

2.      The statement contains multiple lines:

public void testDataServer() {

Connection con = null;

java.sql.Statement st;

try{

Class.forName("com.esproc.jdbc.InternalDriver");

con= DriverManager.getConnection("jdbc:esproc:local://");

//Create Statement directly

st=con.createStatement();

//Execute Statement and return every possible result set

ResultSet b =st.executeQuery("==null\nfor 1,11,5\n\t>A1=A1+A2");

//Print execution result

printRs(b);

}

catch(Exception e){

System.out.println(e);

}

finally{

//Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}

 

[a:b][57][58]

Description:

Get values from row/column/cell a to row/column/cell b to create a sequence.

Syntax:

[a:b]

Note:

The function creates a sequence by getting values from row/column/cell a to row/column/cell b.

If a and b are in the same row, get values from cell a to cell b to create a sequence;

If a and b are in the same column, get values from cell a to cell b in this column to create a sequence;

If a and b are neither in the same row nor in the same column, get values from a rectangular area whose diagonal is the line connecting cell a and cell b to create a sequence.

The function can also be written as [a,b], which means getting values of cell a and cell b to creat a sequence; allow multiple parameters, like [a:b,c,d:e].

Parameters:

a

Cell name

b

Cell name

Return value:

A sequence

Example:

 

A

B

C

 

1

1

2

3

 

2

a

b

c

 

3

%

&

*

 

4

=[A1:C1]

 

 

[1,2,3]

5

=[A1:A3]

 

 

[1,a,%]

6

=[A1:C3]

 

 

[1,2,3,a,b,c,%,&,*]

7

=[A1:C1,A2,C2:C3]

 

 

[1,2,3,a,c,*]

@[59][60]

Description:

Value of the current cell referenced in an expression.

Example:

 

A

B

 

1

[1,2,3,4,5,6]

 

 

2

for A1

 

 

3

 

=@+A2

Calculate the sum of members in A1’s sequence by loop; @ is the value of the current cell B3, which adds the next member value; the final resul is 21

A()[61][62]

Here’s how to use A() function.

A(i)[63][64]

Description:

Get a member from a sequence.

Syntax:

A (i)

Note:

Get the ith member from the sequence A.

Parameters:

A

Sequence

i

A member’s sequence number expression, which starts from 1

Return value:

Values of members in a sequence

Example:

 

A

 

1

=[1,2,4]

 

2

=A1(3)

4

3

=["a","b"](1)

"a"

Related functions:

A (p)

A(p)[65][66]

Description:

Get members of a sequence according to the sequence numbers of members of an integer sequence to create a new sequence.

Syntax:

A(p)

Note:

Here are sequence A whose lengh is n and the integer sequence p whose length is m. Get members in p and use their values as sequence numbers to get members in A in order to generate a new sequence.

Parameters:

p

An integer sequence; the range of its member values is 0 and n. If P is an empty sequence, then return an empty sequence.

A

A sequence whose length is n

Return value:

A new sequence whose length is m

Example:

 

A

 

1

[a,b,c,d,e,f,g]

 

2

[1,3,5]

 

3

=A1(A2)

[a,c,e]

4

[1,3,5,10]

 

5

=A1(A4)

Report errors, as the index is out-of-bound

6

=A1([])

[]

7

=A1([1,2,3,3])

[a,b,c,c]

Related functions:

A (i)

A.(x)[67][68]

Description:

Compute an expression with each member of a sequence.

Syntax:

A.(x)

                                                                 

A.()

return A itself

Note:

The function generates a new sequence composed of the results of computing expression x with each member in sequence or record sequence A. Use "~" in x to reference the current member in A.

Parameters:

A

A sequence/a record sequence

x

An expression, which is generally a field name or a legal expression composed of field names and in which "~" is used to reference the current record.

Return value:

A new sequence composed of the results of computing expression x with each member in A

Example:

 

[a1,…an][69][70]

Description:

Define a sequence constant.

Syntax:

 [a1,a2…, an]

Note:

The function defines a sequence composed of members a1an.

Return value:

A sequence constant

Example:

 

A

 

1

[11,34,67,89]

 

 

Return a constant of sequence composed of 11, 34, 67 and 89

abs()[71][72]

Description:

Compute the absolute value of the parameter.

Syntax:

abs(numberExp)

Note:

The function computes the absolute value of numberExp.

Parameters:

numberExp

Data for which you want to compute the absolute value

Return value:

Numeric

Example:

abs(-3245.54)

3245.54

abs(-987)

987

acos()[73][74]

Description:

Compute the arc cosine value of the parameter.

Syntax:

acos(number)

Note:

The parameter number is a real number between -1 and 1.

Parameters:

number

The real number for which you want to compute the arc cosine

Return value:

Arc cosine

Example:

acos(-1)

3.141592653589793

acos(cos(pi()/2))

1.5707963267948966

acos(cos(0))

0.0

Related functions:

asin()

atan()

acosh()[75][76]

Description:

Return the inverse hyperbolic cosine.

Syntax:

 acosh(number)

Note:

 The parameter number is a real number.

Parameters:

number

The real number for which you want to find the inverse hyperbolic cosine

Return value:

The inverse hyperbolic cosine

Example:

acosh(10)

2.993222846126381

age()[77][78]

Description:

Compute the number of whole years between a specified date and the current time

Syntax:

age(dateExp{, formatExp })

age(stringExp,formatExp)  

Note:

The function computes the number of whole years between the date specified by parameter dateExp and the current time

Parameters:

dateExp

Date expression whose result is the date

stringExp

String expression whose result must be a date or datetime format string

formatExp

Format expression, such as "yyyyMMdd","yyyy-MM-dd"

Options:

@y

The result is accurate to the year

@m

The result is accurate to the month

The computation is accurate to the day by default

Return value:

An integer

Example:

age(date("1980-09-01"))

 

age@m(datetime("1980-09-01 12:23:56"))

 

age@y("19800227","yyyyMMdd")

 

 

 

align()[79][80]

P.align()

Description:

Align the records of a record sequence to a sequence, so as to group the record sequence.

Syntax:

P.align(A:x,y)

If omitting x,y, then align the current records of P with members of A.

P.align(n,y)

Equal to P.align (to(n),y), and support @r.

Note:

Align the records of P to A by the associated fields x and y, which means that, compute y against each record of P and compute x against each record of A, and then compare each value of x and y, if two of them are equal, then the two records are aligned.

This function is mainly for the scenario of primary table and subtable. Usually, there is a ref field of the subtable associated with the primary table to reference the associated record of the primary table. In this occasion, the x expression usually acts as the ref field. Then, retrieve the values from the ref field in the subtable, judging if the records match the corresponding record in the primary table. If they match, then it indicates that the two tables are aligned.

There is usually the one-to-many correspondence between the primary table and the subtable, that is, a record in A is associated with multiple records in P. Therefore, construct a sequence composed of multiple associated records of P, take and store this sequence as a member of the result sequence, then the number of members in the result sequence is the same as that of the A.

Parameters:

P

Sub record sequence/table sequence

A

Primary record sequence/ primary table sequence, according to which another record sequence is aligned

x

The field or field expression of A for relational operation. If omitted, then it is interpreted as ~

y

The alignment expression of P; If omitted, then it is interpreted as P.~

n

Integer

Options:

@a

Of P records, return all members which are aligned according to the members of A, and group the resulting sequence. By default, only the first member will be returned.

@b

If A is an ordered sequence, the binary search will be used.

@r

y is an integer sequence, and every member of y is taken as the alignment position for aligning P to A. P will be aligned to the designated position of n overlappedly.

@p

The return value is composed of the sequence numbers of members in the P

@n

Return all members of P whose records can be aligned to members of A. Of the result sets, there is an extra group to hold those members whose records fail to be aligned.

@s

In P, sort members by the same order as members of A, and put non-corresponding member(s) to A at the tail.

Return value:

Aligned table sequence/sub record sequence

Example:

Ø  Computation after the subtable has been aligned to the primary table

 

A

 

1

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

 

2

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

 

3

=A2.align@a(A1:DEPT,DEPT)

Align the EMPLOYEE table to the DEPARTMENT table

4

=A1.new(DEPT, A3(#).count():NUMBER)

Perform the relational operation on A3 and A1

5

=A2.align(A1:DEPT,DEPT)

Return the first satisfying member by default

Ø  For special sorting

 

A

 

1

=create(Class,Score)

 

2

=A1.record(["class four",99,"class one",89,

"class three",98,"class two",79])

3

=["class one","class two","class three","class four"]

 

4

=create(class,ID,Score)

 

5

=A4.record(["class four",1,99,"class one",1,89,

"class three",1,98,"class two",1,79, "class four",2,89,

"class one",2,99,"class three",2,96,"class two",2,78])

6

=A5.align@a(A3,class)

In this case, if using the sort function, the order will be "four,one,three,two" according to the alphabetical order.

7

=A5.align@a(A2:Class,class)

 

Ø  Alignment with integer sequence, which can usually speed up the computation

 

A

 

1

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

 

2

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

3

=A1.align@b(A2:EID,EID)

A2 is sorted and you can use the binary search to speed up the computation

Ø  @r option is to align the primary table to the subtable overlappedly by the position designated by the integer sequence

 

A

 

1

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

 

2

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

 

3

=A1.derive(A2.pselect@a(EID==A1.EID): SubtableNo)

First, find the sequence numbers of EMPLOYEE records corresponding to the FAMILY table, second, store these sequence numbers in the SubtableNo field as the integer sequence

4

=A33.align@r(11,SubtableNo)

Align to n directly by the SubtableNo

5

=A3.align@rp(11,SubtableNo)

Add the @p option, return the sequence number of the record instead of the record itself

Ø  @n option is to align the primary table to the subtable and return all members. The result set’s last group will be used to store the unaligned members.

 

A

 

1

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

 

2

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

 

3

=A1.align@n(A2:ID,ID)

The members in [5,6,7] are unaligned

Ø  @s option is to sort the records in the subtable by the members of primary table.

 

A

 

1

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

 

2

=demo.query("select * from STUDENTS1 order by ID desc")

 

3

=A1.align@s(A2:ID,ID)

 

ali_client()[81][82]

Description:

Connect to Albaba Cloud and return result as a cursor.

Syntax:

ali_client(ali_url,user,password,dbname)

 

Note:

 This external library function connects to Alibaba Cloud. The parameters user and password represent the Access ID and Access Key that the cloud provides to a user for accessing the service.

Parameters

ali_url

The URL for accessing Alibaba Cloud.

user

The Access ID for Alibaba Cloud.

password

The Access Key for Alibaba Cloud.

dbname

A database name.

Return value:

Cursor

Example:

 

A

 

1

=ali_client("http://test.ots.aliyuncs.com","LTAIXZNG5zzSPHTQ","YHKJHhdf","test")

 

Related functions:

ali_query()

ali_close()

 

ali_close()[83][84]

Description:

Close connection to Alibaba Cloud.

Syntax:

ali_close(ali_client)

Note:

This external library function closes the connection to Alibaba Cloud.

Prameters:

ali_client

A connection to Alibaba Cloud.

Example:

 

A

 

1

=ali_client("http://test.ots.aliyuncs.com","LTAIXZNG5zzSPHTQ","YHJHhdf","test")

 

2

=ali_close(A1)

Close connection to Albaba Cloud.

Related functions:

ali_query()

ali_client()

 

ali_query()[85][86]

Description:

Query data and return result as a cursor or a table sequence.

Syntax:

ali_query(ali_client, tableName, keyName, keyValue, selectCol, filter)   Return a table sequence.

ali_query(ali_client, tableName, keyName, startValue:endValue, selectCol, filter)   Query a certain part of a table and return the result as a cursor.

Note:

External library function. With a composite primary key, the format of the parameter startValue:endValue will be [startKey1,startKey2]:[endKey1:endKey2], like [3,"003"]:[5,"009"]. However, if there is no such record as [3,"003"], but only the record [3,"002"]; then the latter will be used according to the rule of Alibaba Cloud.

Parameters:

ali_client

An object to be connected on Alibaba Cloud.

tableName

A table name.

keyName

For a one-field key, the parameter is the key name; for a composite key, it is a sequence consisting of field names.

keyValue

Primary key value. If it is a single value, query one record; if it is a sequence, perform batch query on multiple records. When it is a sequence of single values, query one record; when it is sequence of sequences, perform batch query on multiple records.

startValue

The starting value of the primary key values. When it is null or omitted, it represents an infinitesimal; and the colon shouldn’t be omitted.

endValue

The ending value of the primary key values. When it is null or omitted, it represents an infinite value; and the colon shouldn’t be omitted.

selectCol

The column(s) to be returned. The parameter will be a column name when the target is a single column; and a sequence of column names when multiple columns are desired. All fields will be selected when the parameter isn’t supplied.

filter

A filtering expression, which can be omitted.

In the expression, following operators are allowed:

Logical operators including &&, ||, and !

Relational operators including  >, >=, ==, <, <=, and !=

The format of the expression is like this: <field name> relational operator <value expression>

For instance: col1 > arg1 && col1 < arg2 || col2 != arg3

A boolean field needs to be written in a format like this: <boolean field == false>, instead of <!boolean field>.

Options:

@x

The option closes the connection to Alibaba Cloud after the query finishes.

@z

The option initiates a query on a certain part of data in reverse order.

Return value:

Cursor or table sequence.

Example:

 

A

 

1

=ali_client("http://test.ots.aliyuncs.com","LTAIXZNG5zzSPHTQ","sa","test")

 

2

=ali_query(A1,"test",["id1","id2"],[1,"10001"]:[10,"70001"], ["id1","id2","f1","f2"],f1>=2000.0)

3

=ali_query(A1, "test",["id1","id2"],,,f1>=2000.0&&f1<=10000.0&&(id2=="10003"||id2=="10004"||id2=="10005"))

The query doesn’t supply parameters startValue:endValue and selectCol, and uses a composite filtering.

4

=ali_query@z(A1,"test",["id1","id2"],[10,"70001"]:[1,"10001"],,f1>=2000.0 && f1<=10000.0 && (id2=="10003" || id2=="10004" || id2=="10005"))

 

5

=ali_query@x(A1,"test",["id1","id2"],[3,"10003"],,)

Related functions:

ali_close()

ali_client()

 and()[87][88]

Description:

Perform bitwise operation on integers.

Syntax:

and(xi,…)

and(A)

Note:

The function performs bitwise operation on integers.

Parameter:

A

Sequence

xi

The numerical expression based on which you perform the bitwise AND operation

Return value:

An integer

Example:

and(6,11)

2

 

append()[89][90]

Here’s how to use append() function.

T.append(cs)[91][92]

Description:

Append records in a cursor/distributed cursor to an entity table.

Syntax:

T.append(cs)

 

Note:

The function appends records in cursor/distributed cursor cs to entity table T. Append records to the last file if T is a file group; structures of cs and T should be the same if the former is a distributed cursor; the appending action can be performed only when the parent table isn’t empty and data is ordered by a key and maintains unique, because the attached table needs to be segmented according to the order of data in the base table. Append records to a cluster table with a segmentation function when cs isn’t a distributed cursor.

The data appended to an attached table must be ordered by a dimension. Data in an attached table should be aligned with the data in the base table through the primary key. The parent table can have records that don’t exist in a sub table, but the opposite situation is not allowed; otherwise the appending to an attached table will be disabled.

If a table has an attached table, appending data to the parent table requires that data be ordered and be unique; otherwise error will be reported. An empty cluster composite table can only receive data from a cluster cursor; but if it isn’t empty, it can receive data from an ordinary cursor.

Parameters:

T

An entity table

cs

A cursor/distributed cursor

Options:

   @m  A merge appending; doesn’t support an attached table

@i

Real-time appending whenever a retrieval happens and when the application exits; by default an appending is executed only when there is a specified number of new records

Return value:

An entity table

Example:

1

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Create a table sequence

2

=create(k1,k2,v2).record([1,1,"a",3,1,"c"])

Create a table sequence

3

=create(k1,v3).record([1,"red",1,"blue",2,"red",2,

"yellow",2,"red",2,"red",4,"black",4,"red",4,"red",

4,"red",4,"red",4,"red",10,"red"])

Create a table sequence

4

=file("D:/ctb.ctx")

 

5

=A4.create(#k1,v1)

Create the composite table’s base table, where k1 is a dimension and v1 is the base table’s column

6

=A5.attach(table2,#k2,v2)

Add attached table table2 to A5’s base table; k1 and k2 are the attached table’s dimensions and v2 is its column

7

=A5.attach(table3,v3)

Add attached table table3 to A5’s base table; k1 is the attached table’s dimension and v3 is its column

8

=A5.append(A1.cursor())

Append cursor records to the base table

9

=A6.append(A2.cursor())

Append cursor records to attached table table2

10

=A7.append(A3.cursor())

Append cursor records to attached table table3

11

=A5.cursor().fetch()

Return data of the base table

12

=A6.cursor().fetch()

Return data of the attached table table2

13

=A7.cursor().fetch()

Return data of the attached table table3

14

=file@zw("emp1.ctx",["192.168.0.131:8281"])

 

15

=A14.create(#EID,NAME,GENDER;;"@!*123":"12")

Create an encrypted cluster composite table

16

=file@0("employee1.ctx",["192.168.0.131:8281"])

Generate a cluster duplicated file

17

=A16.create()

Create a duplicated cluster composite table

18

=A17.cursor(EID,NAME,GENDER;EID<6)

Return cluster composite table employee1 as a cursor

19

=A15.append(A18)

Append data of the cluster cursor into the newly-created encrypted composite table emp1

20

=A15.cursor(EID,NAME,GENDER;EID<4).fetch()

Below is the fetched data:

21

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

Return an ordinary cursor

22

=A15.append(A21)

As the cluster composite table already has data, it can receive data from an ordinary cursor

23

=A15.cursor(EID,NAME,GENDER;EID<4).fetch()

Below is the table after data appending:

24

=file(["D:\\emp12.ctx","D:\\emp11.ctx"])

 

25

=A24.create()

 

26

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

 

27

=A25.append(A16)

 

28

=A24.create().cursor().fetch()

29

=A25.append@m(A16)

Perform merge appending with @m option

30

=A19.create().cursor().fetch()

 

f.append()[93][94]

Description:

Cocatenate two same-structure composite table.

Syntax:

f.append( f’,p)

 

Note:

The function appends an unencrypted composite table file f’ to another composite table file f. The two should have same structure, otherwise the appending will fail. Once the appending fails, use rollback() function to restore the previous state. Parameter p can be omitted if f is an unencrypted composite table file.

Parameters:

f’

A composite table file

p

The write password for composite table file f

Options:

@x

Delete f’after the appending

Return value:

A composite table file

Example:

 

A

 

1

=file("D:\\append1.ctx")

 

2

=A1.create(#EID,NAME,DEPT,SALARY)

Create the composite table’s base table

3

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID")

 

4

=A2.append(A3)

Append cursor records to the entity table

5

=file("D:\\append2.ctx")

 

6

=A5.create(#EID,NAME,DEPT,SALARY)

Create the composite table’s base table

 

7

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where  EID>10and  EID<20  order by  EID")

 

8

=A6.append(A7)

Append cursor records to the entity table

9

=A1.append(A5)

Append unencrypted composite table f’ to another unencrypted composite table f

10

=A9.create().cursor().fetch()

11

=file("D:\\append3.ctx")

 

12

=A11.create(#EID,NAME,DEPT,SALARY;;"123":"11")

Create an encrypted base table for the composite table

13

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<5 order by  EID")

 

14

=A12.append(A13)

Append cursor records to the entity table

 

15

=A11.append(A5,"123")

Append unencrypted composite table f’ to encrypted composite table f

16

=A11.create(;;"11").cursor().fetch()

 

arguments()[95][96]

Description:

Return a list of the current dfx file’s argument names.

Syntax:

arguments()

Note:

The function returns a list of the current dfx file’s argument names.

Return value:

A sequence

Example:

 

A

 

1

=arg1+" world!"

 

2

=arg2+88

 

3

=arguments()

Return a list of the current dfx file’s argument names

array()[97][98]

Here’s how to use array() function.

r.array()[99][100]

Description:

Get the field values from a record sequentially and return them as a sequence.

Syntax:

r.array(Fi,…)

Note:

The function gets the values of Fi,… fields of the record r in order and returns them as a sequence. Get all the field values when parameter Fi is omitted.

Parameters

r

A record

Fi

Field name

Return value

A sequence

Example

 

A

 

1

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

 

2

=A1(1).array()

3

=A1(1).array(STUDENTID,SCORE)

[1,84]

 

asc()[101][102]

Description:

Get the Unicode value of a character at the specified position in a string.

Syntax:

asc( string{, nPos} )

Note:

The function obtains the Unicode value of a character at the specified position nPos of string, if it is ASCII character, then returns its ASCII code.

In general, English characters and their extended characters are all the ASCII characters; Asian language characters, such as Chinese, Japanese, Korean, are all Unicode characters. ASCII character is an 8-bit character set, and the Unicode character is a 16-bit character set, of which 3 bits are used to indicate the character type.

Parameters:

string

A string

nPos

Integer expression, the default is 1

Return value:

An integer

Example:

asc("def")

100 (ascii)

asc("def",2)

101 (ascii)

asc("中国")

20013(Unicode)

asc("中国",2)

22269(Unicode)

Related functions:

char()

asin()[103][104]

Description:

Compute the arc sine value of the parameter.

Syntax:

asin(number)

Note:

The parameter number is a real number between -1 and 1.

Parameters:

number

The real number for which you want to compute the arc sine value

Return value:

Arc sine value

Example:

asin(-1)

-1.5707963267948966

asin(sin(pi()/2))

1.5707963267948966

asin(sin(0))

0.0

Related functions:

acos()

atan()

asinh()[105][106]

Description:

Return the inverse hyperbolic sine.

Syntax:

asinh(number)

Note:

The parameter number is a real number.

Parameter:

number

The real number for which you want to find the inverse hyperbolic sine

Return value:

The inverse hyperbolic sine

Example:

asinh(10)

2.99822295029797

atan()[107][108]

Description:

Compute the arc tangent value of the parameter.

Syntax:

atan (number)

Note:

The parameter number is a real number.

Parameters:

number

Real number for which you want to compute the arc tangent

Return value:

Arc tangent

Example:

atan(1)

0.7853981633974483

atan(tan(pi()/2))

1.5707963267948966

atan(tan(0))

0.0

Related functions:

asin()

acos()

 

atanh()[109][110]

Description:

Return the inverse hyperbolic tangent.

Syntax:

atanh(number)

Note:

The parameter is a real number.

Parameter:

number

Any real number between -1 and 1

Return value:

The inverse hyperbolic tangent

Example:

atanh(0.5)

0.5493061443340549

attach()[111][112]

Here’s how to use attach() function.

T.attach(T’)[113][114]

Description:

Retrieve an attached table from a cluster composite table.

Syntax:

T.attach(T’)

Note:

The function retrieves attached table T’, which should already exist, from cluster composite table T.

Parameters:

T

A cluster composite table

T’

An attached table

Return value:

An attached table

Example:

Here’s composite table emp1.ctx:

 

A

 

1

=file("D:\\emp1.ctx")

 

2

=A1.create(#EID,NAME)

Create the composite table’s base table

3

=demo.cursor("select EID,NAME from employee ")

 

4

=A2.append(A3)

Append records to the base table

5

=A2.attach(t1, SURNAME,DEPT )

Add attached table t1 to the base table

6

=demo.cursor("select EID,SURNAME,DEPT from employee")

 

7

=A5.append(A6)

Append records to attached table t1

8

=A2.attach(t2,GENDER,SALARY)

Add attached table t2 to the base table

9

=demo.cursor("select  EID,GENDER,SALARY from employee ")

 

10

=A8.append(A9)

Append records to attached table t2

 

 

A

 

1

=file@0("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Generate a duplicate cluster file

2

=A1.create()

Create a duplicate cluster composite table

3

=A2.attach(t1)

Retrieve attached table t1

T.attach(T’,C…)[115][116]

Description:

Add an attached table to the base table of a composite table.

Synatx:

T.attach(T’,C…)

Note:

The function adds attached table T’ to a composite table’s base table T. A composite table can have one or multiple attached tables. The attached table’s dimensions include the dimensions of its parent table (the base table); its column names should be different from the base table’s column names.

Parameters:

T

A base table

T’

An attached table

C

Attached table column, can be omitted; return an attached table named T’ if it is absent; a C preceded by # is a dimension

Return value:

An attached table

Example:

 

A

 

1

=file("D:/ctb.ctx")

 

2

=A1.create(#k1,v1)

Create the composite table’s base table where k1 is the dimension and v1 is the column

3

=A2.attach(table2,#k2,v2)

Add attached table table2 to A2’s base table; k1 and k2 are the attached table’s dimensions and v1 and v2 are its columns

4

=A2.attach(table3,v3)

Add attached table table3 to A2’s base table; k1 is the attached table’s dimension and v1 and v3 are its columns

ch.attach()[117][118]

Description:

Attach an operation to a channel.

Syntax:

ch.attach(…)

Note:

The function attaches an operation to channel ch. The sign ~ used in the expression parameter … represents the result of the previous operation performed in the channel.

Parameters:

ch

Channel

An expression of performing an operation over a sequence

Return value:

Channel

Example:

 

A

 

1

=demo.query("select EID,NAME,SALARY  from EMPLOYEE")

2

=channel()

Create a channel

3

=A2.select(SALARY>10000)

Attach a ch.select() operation to the channel

4

=A2.attach(~.sort(-SALARY))

Attach a A.sort() operation to the channel

5

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

6

=A1.push(A2)

Push the data in A1’s sequence into the channel

7

=A2.result()

Get the result of the last operation performed in the channel

 

avg()[119][120]

Here’s how to use avg() function.

A.avg()[121][122]

Description:

Compute the average value of the non-null members in a sequence.

Syntax:

A.avg()

Equivalent to avg(x1,…,xn)

Note:

The function computes the average value of the non-null members in a sequence, and is equal to A.sum()/A.count(). If the number of non-null members is 0, the average value will be null. Members that are not numerical values will be automatically skipped.

Parameters:

A

A sequence

Return value:

The average value of the non-null members in sequence A

Example:

 

A

 

1

=[1,3,5,6].avg()

3.75

2

=[2,null,4,3].avg()

3.0

3

=[].avg()

null

4

=[2,4,3,"aaa"].avg()

3.0 Skip members that are not numerical values

5

=avg(2,null,4,3)

3.0

Related functions:

A.sum()

A.count()

A.min()

A.max()

 

A.avg(x)

 

A.avg(x)[123][124]

Description:

 Compute x with each member of the sequence and then compute the average value of the non-null members of the new sequence.

Syntax:

A.avg(x)

Equivalent to A.(x).avg()

Note:

The function computes x with each member of the sequence and returns the average value of the non-null members of the new sequence.

Parameters:

A

A sequence

x

Generally an expression of a single field name, or a legal expression composed of multiple field names

Return value:

Numerical values

Example:

 

A

 

1

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

 

2

=A1.avg(SALARY)

Compute the average value of non-null values of SALARY

3

=A1.(SALARY+100).avg()

Add 100 to each value of SALARY and then compute the average value

Related functions:

A.avg()

base64 ()[125][126]

Description:

Base64-encode the given data.

Syntax:

base64(x:cs,cs')

Note:

 The function retrieves data from a BLOB in charset cs and encodes it into a base64 string, or it encodes a base64 string into a string in charset cs’. In the latter case, convert the string into BLOB data if the charaset isn’t provided.

Parameters:

x

BLOB data or an ordinary string

cs

Charset

Return value:

BLOB data or a base64 string

Example:

 

A

 

1

=base64("i\xb7\x1d\xfb\xef\xff")

Encode the given string as BLOB data

2

=base64(A1)

Encode the BLOB data as a base64 string

3

=base64("6ZuG566X5Zmo","utf-8")

4

=base64("6ZuG566X5Zmo":"GBK")

between()[127][128]

Description:

Check if Parameter1 is between Parameter 2 and Parameter 3 according to a passed-in parameter.

Syntax:

between(x,a:b)

Find if x falls between a and b. By default the interval enclosed by a and b is closed.

Note:

The function checks whether x falls between a and b.

Parameters:

x

An expression that returns value of any data type that is capable of being compared, including numbers, strings, dates, and sequences.

a

An expression that returns value of any data type that is capable of being compared, including numbers, strings, dates, and sequences.

b

An expression that returns value of any data type that is capable of being compared, including numbers, strings, dates, and sequences.

Options:

@l

The interval is left-open and right-closed

@r

The interval is right-open and left-closed

@b

Make the function returns -1 if x<a; returns 1 if b<x; and retrun 0 for the rest of the cases

Return value:

        Boolean value

Example:

between(4,5:6)

false

between(4,3:6)

true

between(4,4:6)

true

between@l(5,5:6)

false

between@r(6,5:6)

false

between@b(5,6:9)

-1

Related functions:

if()

case()

string()

bits()[129][130]

Description:

Convert to a decimal number.

Syntax:

bits(xi,…)

Note:

This function is equal to sum(2i-1*xi), which converts a number of other numeral systems to a decimal integer. First convert xi to an integer if it is a string.

If there is only a single xi and it is a string, split it into a sequence of single characters first.

Parameters:

xi

The integer/string to be converted

Options:

@h

Equivalent to sum(16i-1*xi). First convert xi to the integer according to the rules of hexadecimal numeral system if it is the string

@d

Equivalent to sum(10i-1*xi). First convert xi to the integer if it is the string

@n

Equivalent to sum(2i-1*if(xi,1,0)). Convert null or nonnull xi to corresponding value

@s

It works with other options to return a string that is equivalent to the number of the specified numeral system

Return value:

Numeric value

Example:

 

A

 

1

[1,0,1,1]

 

2

=bits(A1)

13

3

=bits("1011")

13. Split the single string into a sequence. It is equal to  =bits("1","0","1","1")

4

=bits@d(1,1,1,5)

5111

5

=bits@n(1,1,1,5)

15

6

=bits@h("A",1,1,5)

20762

7

=bits@sn(12)

1

8

=bits@sd(12)

12

9

=bits@sh(1212)

4bc

 

bool()[131][132]

Description:

Convert a data object to a boolean value.

Syntax:

bool(expression)

Note:

The function converts the data type of a given expression expression to a boolean type. It returns false when the parameter value is null, the string “false” (case-sensitive), and the boolean value false; otherwise it returns true.

Parameters:

expression

A constant or an expression that you want to convert to a boolean value

Retrun value:

True/False

Example:

 

A

 

1

 

 

2

=bool(123)

True

3

=bool(A1)

False

break {a}[133][134]

Description:

Break the current loop.

Syntax:

break {a}

Note:

The function reaks a loop whose master cell is a. If a has value, then break the current loop.

Parameters:

a

The master cell of a loop block. If a is omitted, then the function indicates the current loop.

Example:

 

A

B

C

D

 

1

=[]

 

 

 

[1, 1, 2, 2, 3, 3]

2

for 5

 

 

 

The computation of A1 is a sequence [1, 1, 2, 2, 3, 3]; break A2 is to control the loop of the A2 level

 

3

 

for 2

 

 

4

 

 

if A2==4

break A2

5

 

 

>A1=A1|[A2]

 

 

6

=create(ID,Dept)

7

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

 

8

for A7

 

 

 

 

9

 

if A8.NAME=="Alexis"

Extract the data of DEPT from the EMPLOYEE table and insert them to a table sequence uninterruptedly until the record whose NAME value is "Alexis" appears

10

 

 

break

11

 

>A6.insert(0,A8.EID:ID,A8.DEPT:Dept)

 The return value of A6 is shown in the figure

C[135][136]

Here are operations related to composite table colomns.

C[137][138]

Description:

A column in a table, its parent table, or a table above them.

Note:

It is a column in a table, its parent table, or a higher level parent table; can be referenced directly by name without being prefixed by the table name. For example, if table A is table B’s parent table, then a column of table A can be directly referenced by name from table B, instead of using a format like A.C.

Note: If one of table B’s columns is referenced from table A, the format should be B.C.

Example:

 

A

 

1

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

2

=create(k1,k2,v2).record([1,1,"a",3,1,"c"])

3

=file("D:/ctb.ctx")

 

4

=A3.create(#k1,v1)

Create the composite table’s base table

5

=A4.attach(table2,#k2,v2)

Add attached table table2 to the base table

6

=A4.append(A1.cursor())

 

7

=A5.append(A2.cursor())

 

8

=A4.cursor(k1,v1,table2.v2).fetch()

Reference column v2 of the subtable table2 from its parent table

9

=A5.cursor(k1,v1,v2).fetch()

Reference columns k1 and v1 of the parent table from the subtable

T.C[139][140]

Description:

Get a specified column from an attached table.

Note:

Get the value of column C from attached table T. Its value will be recorded as empty if the current record doesn’t have column C. If the value of column C corresponds to multiple records, only get the first record.

Parameters:

T

An attached table

C

A column of the attached table

Example:

 

A

 

1

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Create a table sequence

2

=create(k1,k2,v2).record([1,1,"a",2,4,"c",2,8,"b"])

Create a table sequence

3

=file("D:/ckv.ctx")

A composite table file

4

=A3.create(#k1,v1)

Create the composite table’s base table

5

=A4.attach(table2,#k2,v2)

Add an attached table to the base table

6

=A4.append(A1.cursor())

Append data to the base table

7

=A5.append(A2.cursor())

Append data to the attached table

8

=A4.cursor(k1,v1,table2.k2,table2.v2).fetch()

Retrieve columns k1 and v1 from the composite table’s base table, and columns k2 and v2 from attached table table2; record values of k2 and v2 as empty if a record doesn’t have the two fields. Get the first record if there are multiple records in the attached table that correspond to one value

 

T.f(C)[141][142]

Description:

Perform an aggregate operation over an attached table’s column.

Syntax:

       T.f(C)

Note:

The function performs an aggregation (function f) over the multiple records corresponding to one value.

Parameters:

T

An attached table

f

An aggregate operation performed over the attached table; support count, sum, max, min, avg, top and iterate

C

An attached table’s column

Example:

 

A

 

1

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Create a table sequence

2

=create(k1,k2,v2).record([1,1,"a",2,4,"c",2,8,"b"])

Create a table sequence

3

=file("D:/ckv.ctx")

A composite table file

4

=A3.create(#k1,v1)

Create the composite table’s base table

5

=A4.attach(table2,#k2,v2)

Add an attached table to the base table

6

=A4.append(A1.cursor())

Append data to the base table

7

=A5.append(A2.cursor())

Append data to the attached table

8

=A4.cursor(k1,table2.sum(k2):k2_sum).fetch()

Perform a sum operation over each value of column k2 in attached table table2, and name the new column k2_sum

9

=A4.cursor(table2.count(k2)).fetch()

Perform count operation over each value of column k2 in attached table table2

10

=A4.cursor(table2.max(k2)).fetch()

Perform max operation over each value of column k2 in attached table table2

11

=A4.cursor(table2.min(k2)).fetch()

Perform min operation over each value of column k2 in attached table table2

12

=A4.cursor(table2.avg(k2)).fetch()

Perform average operation over each value of column k2 in attached table table2

13

=A5.cursor().top(2;k2)

Return the records corresponding to the first two smallest values in column k2 in entity table table2

14

=A5.cursor().derive(iterate(~~*2,10):F1).fetch()

Perform an iteration over entity table table2

T{x:C,…}[143][144]

Description:

Return an attached table’s records as a sub table sequence.

Syntax:

       T{x:C,…}

Description:

The function returns an attached table’s records that match the current primary key value as a sub table sequence.

Parameters:

T

An attached table

x

An attached table’s column

C

Column alias; can be omitted

Example:

 

A

 

1

=create(k1,v1).record([1,10,2,20,3,30,4,40,10,100])

Create a table sequence

2

=create(k1,k2,v2).record([1,1,"a",2,4,"c",2,8,"b"])

Create a table sequence

3

=file("D:/ckv.ctx")

A composite table file

4

=A3.create(#k1,v1)

Create the composite table’s base table

5

=A4.attach(table2,#k2,v2)

Add an attached table to the base table

6

=A4.append(A1.cursor())

Append data to the base table

7

=A5.append(A2.cursor())

Append data to the attached table

8

=A4.cursor(k1,table2{k2,v2}:t2).fetch()

Return records of attached table table2 as a table sequence

Cr()[145][146]

Description:

Define a cell name.

Note:

The function defines a cell name. Cr represents a cell which at the intersection of row r and column c.

Example:

calc()[147][148]

Here’s how to use calc() function.

A.calc()[149][150]

Description:

Compute an expression with one or more specified records and return a result.

Syntax:

A.calc(k,x)

Compute x against the kth member of A and return the result

A.calc(p,x)

Compute x against the members of A specified by the integer sequence p and return a sequence

Note:

The function computes an expression against one or more specified records and return a result.

Parameters:

A

A sequence/a record sequence

x

An expression, which is generally a field name or a legal expression composed of field names, and "~" is used to reference the current record.

k

An integer specifying a record

p

An integer sequence specifying multiple records

Return value:

The result of x or a sequence composed of results of x

Example:

Ø  Compute x against the kth member

 

A

 

1

=[1,3,6,2,8]

 

2

=A1.calc(3,~*2)

12

Compute expression "~*2" against the third member of sequence A1, "~" indicates the current member. The result is 12.

Ø  Compute x against the members of A specified by the integer sequence p

 

A

 

1

=[1,3,6,2,8]

 

2

=A1.calc([4,3],~*2)

[4,12]

Compute expression "~*2" against the fourth and the third members of sequence A1 separately and the result is [4,12].

Ø  Do the computation against a table sequence

 

A

 

1

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

 

2

=A1.calc(2,age(HIREDATE)+5)

Compute expression against the second record, the result is 11

3

=A1.calc(A1.pselect@a(DEPT=="Administration"),

age(HIREDATE)+5)

Compute "age(HIREDATE)+5" against all the records whose DEPT is "Administration" and return the result sequence   [19,11,11,10]

call()[151][152]

Description:

Call a cellset file and return the first result set.

Syntax:

call(dfx,arg1,…)

Note:

The function calls the cellset file dfx while passing in the parameter arg1,…, returns the first value that dfx returns, and ends the invocation. It is a non-cellset function and so can be used outside the cellset. The function will automatically use the @s option to search for the dfx among the file names with non-absolute paths in a specified order: Class path -> Search path -> Main path. The default main path is the current path.

When calling the call function, parameters arg1,... will be assigned to dfx’s parameters in order, which is irrelevant to the parameter names in dfx’s parameter list.

Parameters:

dfx

Cellset file

arg1,

Parameters

Options:

@r

Disable the default buffer call

Example:

Below are the contents of the cellset file C:\\test.dfx where arg1 is the cellset parameter:

 

A

B

1

=connect("demo").query("select * from Students1 where Age>?",arg1)

2

return A1

 

 

 

A

 

1

=call("C:\\test.dfx",15)

Call the cellset file, and return the first returned value. Query the data of students who are above 15 years old

 

Note:

Use the comma to separate the multiple results returned. E.g. return A1,B2.

call path/dfx()[153][154]

Description:

Search for a program file locally via esProc JDBC and execute it. If the file can’t be found, then search the server.

Syntax:

call path/dfx(…)

Note:

The function calls a cellset file dfx to execute it while passing in parameters …. It first searches the local cellset files with absolute or relative search paths for the desired one. If the file can’t be found locally, then search the server (configure the server list in the raqsoftConfig.xml file). Once the computation is completed, the function returns a sequence composed of members of the result set; if there are multiple result sets, then return a sequence composed of these result sets. This is similar to calling a stored procedure in the normal database driver. During execution, use con.prepareCall() to call a statement in which the parameters can be written directly or set with st.setObject(). Once the statement is generated, use st.execute() to execute it and return the result set.

When calling the function, the parameters arg1,... will be assigned to dfx’s parameters, which is irrelevant to the parameter names in dfx’s parameter list.

Parameters:

path

The relative search path or absolute search path of a file. The default setting is the relative search path when this parameter isn’t specified.

dfx

Cellset file.

Parameter. Use comma to separate the multiple parameters. The parameter names are irrelevant to the acceptance of the values, which, instead, will be assigned to the parameters in order.

Example:

Below are the contents of the cellset file test.dfx, in which StuId and Class are the cellset parameters.

 

A

1

=connect("demo")

2

=A1.query("select * from SCORES where STUDENTID=? and CLASS=?",StuId,Class)

3

=A2.sum(SCORE)

4

>A1.close()

5

return A3

 

 

 

 

 

 

 

 

Test code is as follows:

public void testDataServer() {

                Connection con = null;

                java.sql.PreparedStatement st;

                try{

                        Class.forName("com.esproc.jdbc.InternalDriver");

                        con= DriverManager.getConnection("jdbc:esproc:local://");

                        // Call the stored procedure in which test is the name of the dfx file

                        st =con.prepareCall("call test(?,?)");

                        // Set the first parameter

                        st.setObject(1,"4");

// Set the second parameter

                        st.setObject(2,"Class one");

                        // Execute stored procedure

                        st.execute();

                        // Get result set

                        ResultSet set = st.getResultSet();

                        // Print results

                        printRs(set);    

                        // The following statement gets same result as the above-mentioned calling method has

                        st =con.prepareCall("call test(4,\"Class one\")");

                        st.execute();

                        set = st.getResultSet();

                        printRs(set);

                }

                catch(Exception e){

                        System.out.println(e);

                }

                finally{

                        // Close the connection

                        if (con!=null) {

                                try {

                                        con.close();

                                }

                                catch(Exception e) {

                                        System.out.println(e);

                                }

                        }

                }

        }

callx()[155][156]

Description:

Compute cellset file dfx with parallel processing and return a sequence composed of result sets of the multiple subtasks.

Syntax:

callx(dfx,;h,s;x)

Note:  

When parameter h and s are absent, the function executes script dfx using multiple threads on the local machine; split parameter to distribute to the multiple threads if it is a sequence; and copy it to the multiple threads if it is a single value; the length of the parameter sequence is the number of subtasks. Perform multiprocess computing if there are multiple processes on the machine. The actual number of parallel tasks is the preferred task number for the current machine; the extra tasks will wait in queue for any available process.

When parameter h is present, the function distributes the computational task among the node process list h and executes script dfx to inherit the task space.

When the number of subtasks is equivalent to the length of node list h, the function allocates subtasks evenly among the nodes while ignoring parameter x, the reduce action; when the number of subtasks is greater than the length of node list h, the function sorts h according to the computing ability of each node, gives the appropriate number of subtasks to the top node, and then reassests the computing ability of the rest of the nodes for distribution; the process continues until the number of subtasks is less than a certan threshold value and nodes will be started to compute. A node will ask for more jobs only after it finishes its current ones; the computation loops like this until it is completed.

Parameter s is a sequence of integer sequences. Each integer sequence is a sequence of task numbers the corresponding node will perform. The task distribution needs to check whether or not a node can perform certain tasks; won’t perform the check if s is absent.

Parameter x is the reduce action. The function returns a sequence consitting of the result sets of the subtasks if x is absent. When x is present, the function calculates reduce using ~, the result of each subtask, and ~~, the current reduce result and puts the result of x into ~~ to go on calculating reduce and returns the final result of ~~ as the result sequence of all node subtasks.

Parameters:

dfx

The cellset file, for which an absolute or a relative path can be set. The relative path is the Search Path under the Tool->Option-> [Environment] menu.

x

Reduce action; can be omitted

The parameter for passing value to dfx. It is usually in the form of a sequence. The number of parameters to be passed to dfx is the number of the sequences. The parallel algorithm will divide a computational task into multiple subtasks according to the length of the parameter sequence and pass each member of the sequence to the corresponding subtask as the parameter value of dfx. If a parameter is single-value, then it will be copied to every subtask.

h

The server sequence in which each server is represented by a string in the form of "address:port number", like "192. 168. 0. 86: 4001". By default, the servers will not be specified, and the computation will be distributed to multiple threads in the current process.

s

A sequence made up of integer sequences

Options:

   @a       Distribute subtasks among nodes randomly without considering equal loads. If a node happens to be invalid or returns an error, replace it with another.

Example:

test.dfx is the deployment file for the remote node server. The node machines are respectively the [”192.168.0.204”,” 192.168.0.205”,” 192.168.0.206”], and the port number is 8081. The file contents are shown below:

1)      Single Parameter

 

A

B

1

=connect("demo").query("select * from SCORES where SUBJECT=?",arg1)

2

return A1

return A1.(SCORE)

 

 

A

 

 

 

1

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081"])

Allocate three subtasks to servers on the two machines running in parallel.

2

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8281","192.168.0.206:8081"])

Tasks will be allocated strictly in order as there are same number of servers 

3

=callx("test.dfx",["English","Math","PE"];)

Run parallelly and locally. The file is stored under the search path in Tools->Options->[Environment] menu.

4

=callx("test.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081"],[[1],[2,3])

Distribute subtasks to specified nodes: Node 192.168.0.204:8081 gets the subtask 1 and Node 192.168.0.205:8081 gets subtasks 2 and 3

5

=callx("test.dfx":~~|~,["English","Math","PE"])

Perform parallel processing on the local machine to calculate the aggregate expression is ~~|~ and return the sequence of node results

 

2)      Multiple Parameters

 

A

 

1

=connect("demo")

 

 

2

=A1.query("select * from EMPLOYEE where EID in (?)and GENDER=?",arg1,arg2)

 

 

3

=A1.close()

 

 

4

return A2

 

 

 

 

A

 

1

=callx("test.dfx",[[1,20,6,14,5]],"F";"192.168.0.204:8081")

Pass two parameters, which are string type and sequence type respectively, to one node machine.

2

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],"F";["192.168.0.204:8081","192.168.0.205:8081"])

Send multiple parameters to multiple node machines. For a parameter that has the same value, it can be passed in the form of single value.

3

=callx("test.dfx",[[1,20,6,14,5],[22,33,44]],["F","M"];["192.168.0.204:8081","192.168.0.205:8081"])

When multiple node machines receive the same parameter with different values, the parmeter should be passed in the form of a sequence.

 

cand()[157][158]

Description:

Perform the logical AND operation over members of a sequence.

Syntax:

A.cand()

Note:

The function performs a logical AND operation and returns a boolean value. It returns true when all members of sequence A are true; othewise it returns false. The data type of the operators in a logical operation needs to be boolean; will automatically convert to boolean type if an operator isn’t a boolean value.

Parameters:

A

A table sequence

Return value:

true/false

Example:

       

A

 

1

=[2<10,3>4,1!=1]

Return members true, false and false

2

=A1.cand()

false

3

=[1==1,1<2].cand()

true

4

=[20,1<2].cand()

True; automatically convert to the boolean data type

5

=[null,1<2].cand()

false

canvas()[159][160]

Description:

Create a canvas object.

Syntax:

canvas()

Note:

To define canvas in esProc, simply use the canvas() function in a cell. Then, the plotting program can invoke the canvas object with the cell name directly, set the plotting parameters, or plot straightforwardly.

Example:

 

A

 

1

>map1=canvas()

Assign the canvas to map1 which can be referenced directly in plotting.

 

case()[161][162]

Description:

Return the value of the expression that satisfies the specified condition.

Syntax:

case(x,x1:y1,…,xk:yk;y)

Note:

This function computes from left to the right. First compute the conditional expression x that comes first, and then compute the other xk. If there is any expression xk that satisfies the result of x, then return the result of yk and terminate the computation. If there is no eligible expression xk, but there exists a default expression y, then return the result of y, otherwise, return null.

Parameters:

x

Conditional expression

xk

Value expression

yk

Result expression

y

Default expression

Example:

 

A

 

1

=3

 

2

=case(A1,1:"Dept 1",2:"Dept 2",3:"Dept 3";"Admin Dept")

Dept 3

3

>A1=4

 

4

=case(A1,1:"Dept 1",2:"Dept 2",3:"Dept 3",4:;"Admin Dept")

null

Related functions:

if()

between()

ceil()[163][164]

Description:

Truncate data at the specified position, and carry the remaining part if any.

Syntax:

ceil(numberExp, {nExp})

Note:

The function truncates data numberExp at the specified position nExp, and carry the remaining part (if any).

Parameters:

numberExp

Data to be truncated

nExp

An integer number specifying the truncate position; taken as 0 when it is omitted

>0: Move the decimal point to the right for nExp places,

<0: Move the decimal point to the left for nExp places,

=0: Indicate the current decimal place.

Return value:

Numeric

Example:

ceil(3450001.004,0)

3450002.0

ceil(3450001.004,-1)

3450010.0

ceil(3450001.004,-2)

3450100.0

ceil(3450001.004,1)

3450001.1

ceil(3450001.004,2)

3450001.01

Related functions:

floor()

round()

cgroups()[165][166]

Here’s how to use cgroups() function.

T. cgroups(Fi,…;y:Gi,…;w)[167][168]

Description:

Perform grouping and aggregation over a pre-summarized data cube.

Syntax:

T.cgroups(Fi,…;y:Gi,…;w)

Note:

For a grouping & aggregation operation over entity table T, the function automatically searches for and query an eligible cube. It will first query a cube where the grouping field is in a more front position; if there isn’t such a cube, query the whole entity table. Parameter Fi is the grouping condition, parameter Gi is the result of calculating the aggregate function y, and parameter w is the filtering condition.

Parameters:

T

Entity table

Fi

Grouping field

y

Aggregate function

Gi

Field names in result set

w

Filtering condition

Options:

@m(...;n)

Enable parallel processing; use default value when parameter n is absent (the default is the max number of parallel tasks set in Tool-Option

Return value:

A table sequence

Example:

 

A

 

1

=file("D://test/orders.ctx").create()

Open composite table file orders.ctx:

 

2

=A1.cgroups(OCount;count(OAmount):COUNT)

3

=A1.cgroups(OCount;count(OAmount):COUNT;OAmount<=3000)

Add filtering condition to A2

4

=A1.cgroups@m(OCount;count(OAmount):COUNT;OAmount<=3000;)

Parallel processing, as the number of parallel tasks is absent, use the default value

5

=A1.cgroups@m(OCount;count(OAmount):COUNT;OAmount<=3000;4)

Parallel processing with the number of parallel tasks being 4

ch.()[169][170]

Description:

Compute a given expression over each member in a channel.

Syntax:

ch.(x)

ch.()            Return the channel ch itself

Note:

The function computes a given expression over each member in a channel and returns the results as a channel. Use ~ to reference the current member in the expression. This is an attached computation.

Parameters:

ch

Channel

x

An expression, which is a field name generally or a legal expression consisting of field names; use ~ to reference the current record.

Return value:

A new channel consisting of the results of computing the expression over each member of a channel

Example:

 

A

B

C

 

1

=demo.cursor("select EID,NAME,BIRTHDAY,SALARY from EMPLOYEE where EID<10")

 

 

 

2

=channel()

=channel()

=channel()

Create a channel

3

=A2.(age(BIRTHDAY))

 

 

 

4

=A2.fetch()

 

 

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

5

=B2.(SALARY)

 

 

 

6

=B2.(~*~)

 

 

Use ~ to reference the current member of a sequence

7

=B2.fetch()

 

 

Attach ch.fetch() function that gets the final result set to B2’s channel to fetch and store the existing data in the channel

8

=C2.()

 

 

Return channel C2

9

=C2.fetch()

 

 

Attach ch.fetch() function that gets the final result set to C2’s channel to fetch and store the existing data in the channel

10

=A1.push(A2,B2,C2)

 

 

Be ready to push data in A1’s cursor into channel A2, B2 and C2, but the action needs to wait.

11

=A1.fetch()

 

 

Data in A1’s cursor is pushed into the channel and operations are performed as data retrieval is performed over A1

12

=A2.result()

 

 

13

=B2.result()

 

 

14

=C2.result()

 

 

 

channel()[171][172]

    Here’s how to use channel() function.

channel()[173][174]

Description:

Create a channel.

Syntax:

channel()

Create a channel

Note:

The function creates a channel.

Return value:

A channel

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=channel()

Create a channel

3

>A2.select(STUDENTID==1)

 

4

>A2.fetch()

 

5

=A1.push(A2)

Push data in A1’s cursor to A2’s channel

6

=A1.fetch()

 

7

=A2.result()

channel(cs)[175][176]

Description:

Create a channel and push data in a specified cursor into it.

Syntax:

channel(cs)

 

Note:

The function creates a channel, pushes data in cursor cs into it, and returns a channel. This is equivalent to cs.push(channel()).

Parameters:

cs

A cursor

Return value:

A channel

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=channel(A1)

Create a channel  and be ready to push data in A1’s cursor into the new channel, which is equivalent to =A1.push(channel()), and return a channel

3

>A2.select(STUDENTID==1)

 

4

>A2.fetch()

 

5

=A1.fetch()

 

6

=A2.result()

channel(cs)[177][178]

Description:

Create a cluster channel and push data in a specified cluster cursor into it.

Syntax:

channel(cs)

 

Note:

The function creates a cluster channel as synchronously segmented as cluster cursor cs, pushes data in cs into it, and returns a cluster channel.

Parameters:

cs

A cluster cursor

Return value:

A cluster channel

Example:

 

A

 

1

=file@n("E:/emp1.ctx","192.168.0.119:8281")

 

2

=A1.create()

Open a cluster table

3

=A2.attach(table1)

Retrieve cluster entity table table1

4

=A3.cursor()

Return a cluster cursor

5

=channel(A4)

Create a channel, be ready to push data in the cluster cursor into the new channel, and return a cluster channel

6

=A5.fetch()

Keep data of the cluster channel

7

=A4.fetch()

 

8

=A5.result()

Get data from the cluster channel

 

channel(ch)[179][180]

Description:

Create a channel and push data in another channel into it.

Syntax:

channel(ch)

 

Note:

The function creates a channel, pushes data in channel ch into it, and returns a channel. This is equivalent to ch.push(channel()).

Parameters:

ch

A channel

Return value:

A channel

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=channel()

Create a channel

3

=channel(A2)

Create a channel  and be ready to push data in A2’s channel into the new channel, which is equivalent to =A2.push(channel())

4

>A2.select(STUDENTID==1)

 

5

>A3.select(STUDENTID==2)

 

6

=A2.fetch()

 

7

=A3.fetch()

 

8

=A1.push(A2)

 

9

=A1.fetch()

 

10

=A2.result()

11

=A3.result()

channel(ch)[181][182]

Description:

Create a cluster channel and push data in another cluster channel into it.

Syntax:

channel(ch)

 

Note:

The function creates a cluster channel as synchronously segmented as cluster channel ch, pushes data in ch into it, and returns a cluster channel.

Parameters:

ch

A cluster channel

Return value:

A cluster channel

Example:

 

A

 

1

=file@n("E:/emp1.ctx","192.168.0.119:8281")

 

2

=A1.create()

Open a cluster table

3

=A2.attach(table1)

Retrieve cluster entity table table1

4

=A3.cursor()

Return a cluster cursor

5

=channel(A4)

Create a channel, be ready to push data in A4’s cluster cursor into the new channel, and return a cluster channel

6

=channel(A5)

Create a channel, be ready to push data in A5’s cluster channel into the new channel, and return a cluster channel

7

=A5.fetch()

Keep data of the cluster channel

8

=A6.fetch()

Keep data of the cluster channel

9

=A4.fetch()

 

10

=A5.result()

Get data from the cluster channel

11

=A6.result()

Get data from the cluster channel

 

char()[183][184]

Description:

According to the given Unicode or ASCII code, get the corresponding characters.

Syntax:

char(int)

Note:

In general, the English characters and their extended characters are all the ASCII code; Chinese, Japanese, Korean, and other Asian characters are all Unicode characters. ASCII character is an 8 bit character set, and Unicode character is a 16 bit character set, of which 3 bits are used to indicate the character type.

Parameters:

int

Integer expression, Unicode code or ASCII code

Return value:

Character

Example:

char(87)

'W'

char(66)

'B'

Related functions:

asc()

clear[185][186]

Description:

Clear the cell value.

Syntax:

clear a:b,c,d:e

Note:

The function clears the values of certain cells. With only a: specified, it clears the cell values in a code block where a is the master cell.

Parameters:

a:b,c,d:e

The cells whose values need to be cleared.

Example:

 

A

 

1

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

 

2

clear A1

Clear value of cell A1

 

 

A

B

 

1

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

=[]

 

2

>B1=A1.select(EID>6)

 

 

3

=[]

 

 

4

if A1.len()>10

 

 

5

 

>A3=A1.len()+10

 

6

clear A1:B2

 

Clear values of cells from A1to B2

7

clear A4:

 

Clear cell values in a code block whereA4 is the master cell

 

clipboard()[187][188]

Description:

Set system clipboard content.

Syntax:

clipboard(s)

Note:

The function sets the content of the system clipboard; return the clipboard content in string format if parameter s is absent.

Parameters:

s

The content to be copied to clipboard, whose data type can be table sequence, string, numeric, date, time, and datetime; can be omitted

Return value:

    Boolean/string

Example:

 

A

 

1

=clipboard("runqian")

Set system clipboard content as runqian

2

=clipboard()

Return the clipboard content since parameter s is absent

close()[189][190]

Here’s how to use close() function.

cs.close()[191][192]

Description:

Close a cursor.

Syntax:  

cs.close()

Note:  

The function clears the file handles and database connections used by cursors and their root cursors. By default, all of them will be closed automatically when fetch operation finishes.

Parameters:

cs

A cursor

Example:

 

A

 

1

=demo.cursor("select * from SCORES")

Return a cursor of retrieved data

2

=A1.fetch(10)

Retrieve some records

3

=A1.close()

Close the cursor

Related functions:

cs.fetch()

db.cursor()

db.close()[193][194]

Description:

Close a datasource connection.

Syntax:

db.close()

Note:

Close a database connection. By default, data will be committed before closing the database.

Parameters:

db

Database connection

Example:

 

A

 

1

=connect("demo")

 

2

>A1.close()

Close the connection to database demo

Note:

connect and close must be used in pairs; otherwise, the connection cannot be closed.

Related functions:

connect()

db.error()

db.commit()

db.rollback()

T.close()[195][196]

Description:

Close a composite table.

Syntax:

T.close()

Note:

The function closes a composite table.

Parameters:

T

A composite table.

Example:

 

A

 

1

=file("D:\\employee3.ctx")

 

2

=A1.create()

Open a composite table

3

=A2.close()

Close the composite table

cmp()[197][198]

Description:

Compare two expressions or two sequences.

Syntax:

cmp(x, y)

When comparing two expressions x and y, return 0 if they are equal; return 1 if x is greater than y; return -1 if x is less than y;

cmp(A{, B})

When comparing two sequences A and B having same number of members, return 0 if all members are equal, otherwise compare members of them in a normal order; for the first members that are not equal, return 1 if the one in A is larger and return -1 if the one in A is smaller. If the number of members in the two sequences are not the same and members in the sequence whose member number is smaller are completely equal to their corresponding ones in the other sequence, then the sequence with less members will be smaller.

cmp(A;B)

When the lengths of sequences A and B are equal, compare members of them in normal order; return 1 if a member in A is larger and return -1 if a member in A is smaller and return 0 if all members are equal. If the length of sequence A is less than that of sequence B, return 1 if a member in A is larger and return -1 if a member in A is smaller; return -1 if members of sequence A are equal to their counterparts in sequence B.

When sequences A and B have same number of members, return 0 if all members are equal, otherwise compare members of them in a normal order; for the first members that are not equal, return 1 if the one in A is larger and return -1 if the one in A is smaller. Return 0 if the number of members in the two sequences are not the same and if the length of sequence A is greater than or equal to that of sequence B and if members in sequence B are equal to their counterparts in sequence A.

cmp(A,0)

When parameter B is absent, sequence B is by default a sequence having members of 0s, then the comparison becomes one happening between sequence A and sequence [0…0] of the same lengh.

cmp(r1,r2)

When comparing two records r1 and r2, return 0 if all field values of both are equal, otherwise compare field values in a normal order; for the first field values that are not equal, return 1 if the one in r1 is larger and return -1 if the one in A is smaller. If the number of fields in r1 and r2 are not the same and field values in the record that has less fields are completely equal to their corresponding ones in the other record, then the record with less fields will be smaller.

 

Note:

The function compares two expressions x and y or two sequences A and B or two records r1 and r2. An error will be reported if x and y , A and B or r1 and r2 cannot be compared.

 

Parameters:

x

Expression

y

Expression

A

A sequence whose length is n; can be a single value which is regarded as a sequence having one member

B

A sequence whose length is m; can be a single value which is regarded as a sequence having one member

r1

Record

r2

Record

Example:

 

A

 

 

1

=cmp(9,5*1.2)

1

 

2

=cmp([3,2,1],[1,8,9])

1

 

3

=cmp([-1,4,8])

-1; equivalent to cmp([-1,4,8],[0,0,0])

 

4

=cmp([0,3,5],0)

1; equivalent to cmp([0,3,5],[0,0,0])

 

5

=cmp(1000,"a")

The numeric value and the string cannot be compared

 

6

=cmp("s","a")

1

 

7

=cmp([0,3],[0,3,-5])

-1

 

8

=demo.query("select EID,GENDER,SALARY from EMPLOYEE")

 

9

=demo.query("select EID,GENDER from EMPLOYEE")

 

10

=cmp(A8(1),A9(1))

1; as field values of A9 that has less fields are completely equal to their corresponding ones in A8, A9 is smaller

11

=cmp(A8(1),A8(2))

-1

12

=cmp([-1,-4,8,9],[-1,-4,8,9,10])

-1

13

=cmp([-1,-4,8,9];[-1,-4,8,9,10])

-1; as the length of sequence A is less than that of sequence of B and members of the former are equal to their counterparts in the latter, the sequence with less members is smaller

14

=cmp([-1,-4,8,9],[-1,-4,8])

1

15

=cmp([-1,-4,8,9];[-1,-4,8])

0; because the length of sequence A is greater than that of sequence of B and members of the latter are equal to their counterparts in the former

Related functions:

Difference between sequences

Intersection of sequences

Union of sequences

Multiplication of sequences

Alignment Arithmetic Operations

Concatenation of sequences

cor()[199][200]

Description:

Perform logical OR operation over members of a sequence.

Syntax:

A.cor()

Note:

The logical OR operation. The function returns true when at least one member of sequence A is true; otherwise returns false.

Parameters:

A

A sequence

Return value:

true/false

Example:

       

A

 

1

=[2<10,3>4,1!=1]

Return members true, false and false

2

=A1.cand()

true

3

=[1!=1,3<2].cor()

false

4

=[20,1>2].cor()

True; automatically convert to a boolean data type

5

=[null,1<2].cor()

true

combin()[201][202]

Description:

Return the number of combinations.

Syntax:

combin(n,k)

Note:

The number of ways of picking k elements from n objects.

Parameters:

n

An integer that is the number of given objects

k

An integer that is the number of elements you want to pick from the given set of objects

Return value:

A number

Example:

combin(8,2)

28

commit()[203][204]

Here’s how to use commit() function.

db.commit()[205][206]

Description:

Commit the database transaction manually.

Syntax:

db.commit()

Note:

The function commits the transaction manually, which is the same as commit() of the Connection class in Java.

Parameters:

db

Database connection

Options:

@k

After the execution is completed, the transaction won't be committed. If this option is omitted, the transaction will be committed.

Example:

 

A

B

 

1

=file("D://files//student.txt")

 

2

=A1.import@t()

 

3

=connect@e("demo")

Create a connection and automatically control the commit and rollback operations

4

>A3.execute@k(A2,"update STUDENTS2 set NAME=?,GENDER=?,AGE=? where ID=?",NAME,GENDER,AGE,ID)

The transaction is not committed

5

=A3.error()

 

Read the error code generated by the execution of the previous sql

6

if A5==0

>A3.commit()

Commit if there is not an error

7

else

>A3.rollback()

Roll back if there is an error

8

>A3.close()

 

Close the connection

Related functions:

db.close()

db.error()

connect()

db.rollback()

concat()[207][208]

Here’s how to use concat() function.

concat()[209][210]

Description:

Concatenate parameters into a string.

Syntax:

concat(xi,…)

Note:

The function concatenates parameters into a string in which quotation marks will not be used

Parameters:

xi

Any value that can be converted to a string; if it is a sequence, it will be broken up before concatenation.

Return value:

A string

Example:

 

A

 

1

=demo.query("select * from SCORES where SCORE>90")

 

2

=A1.(SCORE)

 

3

=A1.(SUBJECT)

 

4

=concat(A2,A3)

979691939797979691939797PEEnglishPEEnglishMathMathPEEnglishPEEnglishMathMath

5

=concat(2,3,"a")

23a

Related functions:

s.split()

A.concat(d)[211][212]

Description:

Concatenate members of a sequence with the delimiter and return result as a string.

Syntax

A.concat(d)

Note:

The function concatenates members of A delimited by d and returns result as into a string; the sub-sequences of the string will be handled in a same way. Concatenate the members without a delimiter when parameter d is omitted.

Options:

@q

Add quotation marks to string members when concatenating them into a string. If this option is omitted, do not use the quotation marks.

@c

Concatenate with the comma

@i

Enclose string members to be concatenated with single quotes

Parameters:

A

A sequence of strings

d

Delimiter

Return value:

A string after concatenation

Example:

 

A

 

1

=[1, ["a","b"],[2,"c"]]

 

2

=A1.concat()

1[ab][2c]

3

=A1.concat(":")

1:[a:b]:[2:c]

4

=A1.concat@q()

1["a""b"][2"c"]

5

=A1.concat@c()

1,[a,b],[2,c]

6

=A1.concat@i()

1['a''b'][2'c']

conj()[213][214]

Here’s how to use conj() function.

A.conj()[215][216]

Description:

Concatenate all the members in a sequence whose members are sequences.

Syntax:

A.conj(x)

Note:

The function generates a new sequence by concatenating all the members in sequence A whose members are sequences; compute expression x by loop and then concatenate the results when parameter x is present.

Options:

@r

Recursively concatenate members until there isn’t any sequence members

Parameters:

A

A sequence whose members are sequences

x

An expression that returns a sequence as the result

Return value:

The new sequence by concatenating all the members in sequence A

Example:

 

A

 

1

=[[1,2,3],[4,5,6]].conj()

[1,2,3,4,5,6]

2

=[[1,[2,3]],[2,5,6]].conj()

[1,[2,3],2,5,6]

3

=[[1,2,3],[3],[7]].conj()

[1,2,3,3,7]

4

=[[1,[2,3]],[2,5,6]].conj@r()

[1,2,3,2,5,6]

5

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

6

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

7

=[A5,A6].conj(~.(NAME))

[Rebecca,Ashley,…] Form a sequence by concatenating NAME field of A1 and A2

Related functions:

A.union()

A.diff()

A.isect()

A.xunion()

ch.conj()[217][218]

Description:

Split each of the records in a channel, union the members and return the resulting union as a channel.

Syntax:

ch.conj()

Note:

The function computes a given expression over the records in channel ch to split each of them into a sequence or a records sequence, union the members and return the resulting union as a channel. This is an attached computation.

Parameters:

ch

Channel

An expression that returns a record sequence/table sequence

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from GYMNASTICSWOMEN")

The above is the content of GYMNASTICSWOMEN table

2

=channel()

Create a channel

3

=A2.conj(create(ID,NAME,COUNTRY,SUBJECT,SCORES).record([ID,NAME,COUNTRY,"VAULT",VAULT,ID,NAME,COUNTRY, "UNEVENBARS",UNEVENBARS,ID,NAME,COUNTRY,"BALANCEBEAM",BALANCEBEAM,ID,NAME,COUNTRY,"FLOOR",FLOOR]))

Split up the records in A2’s channel into a sequence, union the records and return the union result as a channel

3

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

4

=A1.push(A2)

Be ready to push data in A1’s cursor into the channel, but the action needs to wait; data in A1’s cursor is pushed into the channel and operations are performed as the fetch() operation is performed over A1

5

=A1.fetch()

 

6

=A2.result()

cs.conj()[219][220]

Description

 Split each of the records in a cursor, union the members and return the original cursor.

Syntax

cs.conj()

Note

The function computes the expression over the records in cursor cs to split each of them into a sequence or a record sequence, union the members and return the original cursor. Support a multicursor.

Parameters

cs

A cursor

An expression that returns a record sequence (or a table sequence)

Return value

The original cursor cs

Example

 

A

 

1

=demo.cursor("select * from GYMNASTICSWOMEN")

The above is the content of GYMNASTICSWOMEN table

2

=A1.conj(create(ID,NAME,COUNTRY,SUBJECT,SCORES).record([ID,NAME,COUNTRY,"VAULT",VAULT,ID,NAME,COUNTRY, "UNEVENBARS",UNEVENBARS,ID,NAME,COUNTRY,"BALANCEBEAM",BALANCEBEAM,ID,NAME,COUNTRY,"FLOOR",FLOOR]))

 

3

=A2.fetch()

conjx()[221][222]

Here’s how to use conjx() function.

CS.conjx()[223][224]

Description:

Union the members of a cursor sequence, and return result as a cursor.

Syntax:

CS.conjx()

Note:

The function concatenates members of CS, a sequence of cursors, and returns result as a cursor. This is actually the merging of data in the cursors. Each cursor in CS must have the same structure.

Parameters:

CS

A sequence of cursors

Return value:

Cursor

Example:

 

A

B

 

1

=directory@p("D://txt//")

=[]

Below are the three files in the txt folder

2

for A1.len()

 

 

3

 

=file(A1(A2))

 

4

 

=B3.cursor@t()

 

5

 

>B1=B1|B4

Store the cursor sequence in B1

6

=B1.conjx()

 

Union the cursors

7

=A6.fetch()

 

Fetch data from the cursor

Related functions:

A.merge()
CS.mergex()

connect()[225][226]

Description:

Establish a connection to a database.

Syntax:

connect(dataSource)

 

connect(drv,url)

Connect to a database through its driver and url in which the user name and password are written

connect()

Return the connection to a data source in the file system.

Note:

The function establishes a data source connection. Return the connection to a data source in the file system when parameters are absent.

Parameters:

dataSource

The name of a data source

drv

Database driver class

url

Database driver connection URL

Options:

@l

 

@e

Return field names and table names in lower case; by default it’s the database that handles the cases

If there is an error, return an error message to be processed automatically with the code; without the option, an interrupt occurs.

@ncurs

Transaction isolation levels for the connection, corresponding respectively to  none, commit, uncommit, repeatable, and serializable.

Return value:

Data source connection

Example:

 

A

 

1

=connect("demo")

Connect to the data source demo. If any database operation error occurs, the data source connection will be interrupted.

2

=connect@e("demo")

Connect to the data source demo. For any operation on this connection, if any error occurs, a message will be returned and processed by code.

3

=connect@c("demo")

Connect to the data source demo, with the transaction isolation level being commit.                                                                                                         

4

=connect("org.hsqldb.jdbcDriver","jdbc:

hsqldb:hsql://127.0.0.1/demo?user=sa")

Leave the password blank.

5

=connect("com.mysql.jdbc.Driver","jdbc:

mysql://127.0.0.1:3306/mysqlwp?user=root

&password=root")

 

6

=connect()

Connect to the file system

7

=connect@l("demo")

Connect to demo datasource and return field names and table names in lower case

8

=A7.query("select * from DEPT")

Related functions:

db.close()

db.error()

db.commit()

db.rollback()

contain()[227][228]

Here’s how to use contain() function.

A.contain(xi,…)[229][230]

Description:

Check whether a given data object is a member of a certain sequence.

Syntax:

A.contain(xi,…)

Note:

The function checks whether parameter xi,… are members of sequence A or not; the number of parameters x is i. Return true if all parameters are members of sequence A, and false if not.

Parameters:

A

A sequence object or an expression that returns one

xi

Data object, which can be a number, a string or a sequence

Options:

@b

The option means that sequence A is ordered, based on which a binary search is performed in an ascending or descending order

Return value:

Boolean value

Example:

   

 

A

 

1

=[1,2,8,4,5,6,7,8]

 

2

=A1.contain(8)

true

3

=A1.contain(9)

false

4

=A1.contain@b(8)

true

5

=[[1,2,3,4,5,6,7,8],[3]].contain ([3])

true

6

[1,3,6,aaa]

 

7

=A6.contain("aaa")

true

8

=A1.contain(8,1)

true

9

=A1.contain(8,9)

false

Related functions:

    A.pos()

cos()[231][232]

Description:

Compute the cosine value.

Syntax:

cos(numberExp)

Note:

The parameter numberExp is defined in radians.

Parameters:

numberExp

The radian number of the cosine to be computed

Return value:

Float type

Example:

cos(pi())

-1.0

cos(pi(2))

1.0

Related functions:

sin()

tan()

cosh()[233][234]

Description:

Return the hyperbolic cosine.

Syntax:

cosh(number)

Note:

The parameter number is a real number.

Parameter:

number

The real number for which you want to find the hyperbolic cosine

Return value:

The hyperbolic cosine

Example:

cosh(4)

27.308232836016487

count()[235][236]

Here’s how to use count() function.

A.count(x)[237][238]

Description:

Compute x with each member of the sequence and then count the number of non-null sequence members of the new sequence.

Syntax:

A.count(x)

Equivalent to A.(x).count()

Note:

The function loops through members of sequence A to compute expression x and returns the number of records that make x non-null.

Parameters:

A

A sequence.

x

Generally an expression of a single field name, or a legal expression composed of multiple field names.

Return value:

An integer

Example:

 

A

 

1

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

 

2

=A1.count(HIREDATE)

Count the number of records whose HIREDATE is not null

3

=A1.(SALARY+1000).count()

Add 1,000 to each value of SALARY and then count the number of records

Related functions:

A.count()

A.count()[239][240]

Description:

Count the number of non-null members in a sequence.

Syntax:

A.count()

Equivalent to count(x1,…,xn)

Note:

The function counts the number of the non-null members in the sequence A.

Parameters:

A

A sequence whose length is n

Return value:

An integer, which is the number of the non-null members in the sequence A

Example:

 

A

 

1

=[1,2,3,4].count()

4

2

=[1,null,3,4].count()

3

3

=count(1,null,3,4)

3

Related functions:

A.sum()

A.avg()

A.min()

A.max()

A.variance()

A.count(x)

create()[241][242]

Here’s how to use creat() function.

create(Fi,…)[243][244]

Description:

Create an empty table sequence.

Syntax:

create(Fi,…)

Note:

The function creates an empty table sequence taking Fi,… as its fields.

Parameters:

Fi

Field name

Return value:

An empty table sequence

Example:

 

A

 

1

=create(id,name,sex)

create(#Fi,…)[245][246]

Description:

Create an empty table sequence with one or more keys set.

Syntax:

create(#Fi,…)   

Note:

The function creates an empty table sequence that has the fields Fi,…. A field name headed by the sign # is a key.

Parameters:

Fi

Field name

Return value:

Empty table sequence

Example:

 

A

 

1

=create(#id,#name,gender)

id field and name field are keys

f.create()[247][248]

Description:

Open a composite table.

Syntax:

f.create()

Open an unencrypted composite table

f.create(;;p)

Open an encrypted composite table

Note:

The function opens a composite table. If parameter p is a write password, you can retrieve or update the composite table or add an attached table; if it is a read password, the composite table is read-only but can’t be modified. If an encrypted composite table has both the write password and the read password, only one of them needs to be present as needed. The composite table file f can be a file group, in which the files must have same passwords.

Parameters:

f

A composite table file

p

Write password/read password

Options:

   @o   Won’t merge data retrieved from every file in a file group; peform merge by default

Return value:

A composite table

Example:

 

A

 

1

=file("D:\\employee2.ctx")

 

2

=A1.create(#EID,NAME,GENDER;;"@!*123":"12")

Create an encrypted composite table

3

=file("D:\\employee3.ctx")

 

4

=A3.create(#EID,NAME,GENDER)

Create an unencrypted composite table

5

=A3.create()

Open an unencrypted composite table file

6

=A1.create(;;"12")

Use read password to retrieve an encrypted composite table that has both the write password and read password

7

=A1.create(;;"@!*123")

Use write password to open an encrypted composite table that has both the write password and read password

8

=file(["D:\\emp2.ctx","D:\\emp1.ctx","D:\\emp1.ctx"])

Unencrypted file group

9

=A8.create().cursor().fetch()

Perform an ordered merge by default

10

=A8.create().cursor().fetch()

Won’t perform an ordered merge with @o option

f.create()[249][250]

Description:

Open a cluster composite table.

Syntax:

f.create()

Open an unencrypted cluster composite table

f.create(;;p)

Open an encrypted cluster composite table

Note:

The function opens a cluster composite table. For a cluster composite table, the file type determines the type of its cluster base table. Distributed cluster files have a segmental cluster base table and duplicate cluster files have a duplicate cluster base table. If parameter p is a write password, you can retrieve or update the composite table or add an attached table; if it is a read password, the composite table is read-only but can’t be modified. If an encrypted composite table has both the write password and the read password, only one of them needs to be present as needed.

Parameters:

f

A cluster table file

p

Write password/read password

Return value:

A cluster composite table object

Example:

 

A

 

1

=file@0("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Generate a duplicate cluster file

2

=A1.create()

Create a duplicate cluster base table

3

=file@0("employee2.ctx",["192.168.31.72:8281"])

 

4

=A3.create(;;"12")

Use read password to retrieve an encrypted composite table that has both the write password and read password

5

=A3.create(;;"@!*123")

Use write password to open an encrypted composite table that has both the write password and read password

 

f.create(C:b1,…;K:b2;pw:pr)[251][252]

Description:

Generate a composite table’s base table from a file.

Syntax:

f.create(C:b1,…;K:b2;pw:pr)

Note:

According to file f, the function creates a composite table’s base table (which we’ll simply call the base table) consisting of columns C…; a C preceded by # is a dimension, which should be written in the first place and there can be multiple dimensions. Records in the base table must be ordered by the dimension(s). Parameter b1 is the length of serial byte key and can be omitted. Parameter K is the key according to which the composite table is segmented. If K contains serial byte data, then the first b2 bytes of K’s value are used for segmentation. The extension of a composite table file is ctx.

Parameters:

f

A local file

C

A base table column

b1

The length of serial byte key, which is an integer less than 8; parameter K isn’t a serial byte key when this parameter is absent

K

The key by which the composite table is segmented

b2

The number of bytes, which is an integer less than 8; can be omitted

pw

Write password that can be omitted; if the parameter is absent, the read password must be omitted, too

pr

Read password that can be omitted; if the write password is present, this read password can be omitted

Options:

@u

Won’t compress the base table; by default it will be compressed

@r

Generate a composite table stored by row, which doesn’t support the use of multicursor; a composite table is by default stored by column

@y

Re-create a namesake file even if the file already exists; without the option the program will terminate the execution and report an error

Return value:

A base table

Example:

 

A

 

1

=file("D:\\employee1.ctx")

 

2

=A1.create(#EID,NAME,GENDER)

Create base table employee1 without the key for ordering records and with EID, NAME and GENDER being the columns, in which EID is the dimension

3

=file("D:\\employee2.ctx")

 

4

=A3.create(#EID:3,NAME,GENDER;EID:2)

Create a base table in which EID is the key for ordering records and the first two bytes of EID values being used to segment the table and the key value has 3 bytes

5

=file("D:\\employee3.ctx")

 

6

=A5.create(#EID,NAME,GENDER;;"@!*123":"12")

Create a base table that have both the write and read passwords

7

=A1.create@y(#EID,NAME,GENDER)

Re-create a namesake file; error will be reported if @y option is absent

f.create(C:b1,…;K:b2;pw:pr;x)[253][254]

Description:

Generate a cluster composite table’s base table from a distributed file.

Syntax:

f.create(C:b1,…;K:b2;pw:pr;x)

Note:

According to file f, the function creates a cluster composite table’s base table (which we’ll simply call the base table) consisting of columns C…; a C preceded by # is a dimension; there can be multiple dimensions. Records in the base table must be ordered by the dimension(s). Parameter b1 is the length of the serial byte key. Parameter K is the key by which the composite table is segmented. If K is a serial byte field, the first b2 bytes of K’s value are used for segmentation.

The function creates a writable cluster base table only to maintain it. It supports a variety of methods including attach, index, reset, append, update, delete; a cluster cursor should first be appended to an empty cluster file when you want to perform append over this file.

Parameters:

f

A distributed file

C

A base table column

b1

The length of serial byte key, which is an integer less than 8; parameter K isn’t a serial byte key when this parameter is absent

K

The key by which the composite table is segmented

b2

The number of bytes, which is an integer less than 8; can be omitted

pw

Write password that can be omitted; if the parameter is absent, the read password must be omitted, too

pr

Read password that can be omitted; if the write password is present, this read password can be omitted

x

A segmentation function; should be present for a write-in operation

Options:

@u

Won’t compress the base table; by default it will be compressed

@r

Generate a composite table file stored by row, which doesn’t support the use of multicursor; a composite table is by default stored by column

@y

Re-create a namesake file even if the file already exists; without the option the program will terminate the execution and report an error

Return value:

A cluster table object

Example:

 

A

 

1

[192.168.31.72:8281]

 

2

=file@z("salespart.ctx", A1)

 

3

=A2.create()

 

4

=A3.cursor()

Create a cluster cursor

5

=file@zw("salespart1.ctx",["192.168.31.72:8281"])

s The writable distributed file salespart1.ctx to be opened doensn’t exist

6

=A5.create(#EID,Name,OCount;;"@!*123":"12")

Create a cluster base table that have both the write and read passwords

7

>A6.append(A4)

Append A4’s cluster cursor to A6’s cluster base table

8

=A6.cursor().fetch()

 

9

=file@n("D:\\1\\EmpCTX.ctx",A1)

EmpCTX.ctx consists of several fields – EID, Name, Dept and Age, in which EID is the serial byte key

10

=A9.create()

 

11

=A10.cursor()

Create a cluster cursor

12

=file@wz("EmpCTX2.ctx",A1)

 

13

=A12.create(#EID:4,Name,Dept,Age;EID:3)

Create a base table where EID is the serial byte key , whose length is 4, and its first 3 bytes are the key by which records are segmented

14

>A13.append(A11)

Append A11’s cluster cursor to A13’s cluster base table

15

=A13.cursor().fetch()

 

16

=file@zw("salespart2.ctx",["192.168.31.72:8281"])

Salespart2.ctx doesn’t exist; for generating a writable distributed file

17

=A5.create(#EID,Name,OCount;;"@!*123":"12";EID%2+1)

Create a cluster table with two patitions whose number begins with 1

 

T.create()[255][256]

Description:

Create an empty table sequence by duplicating the data structure of table sequence T.

Syntax:

T.create()

Note:

If table sequence T has a key, then duplicate the key at the same time.

Parameters:

T

A table sequence

Return value:

A new empty table sequence

Example:

Ø  Create from a normal table sequence

 

A

 

1

=demo.query("select top 1 * from DEPARTMENT")

2

=A1.create()

Create an empty table sequence A2 through "=A1.create ()", and this empty table sequence has the same data structure as table sequence A1. They are all composed of field DEPT and field MANAGER.

Ø  Copy the key and descriptor

 

A

 

1

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

 

2

=A1.keys(DEPT)

 

3

=A1.create()

Create a empty table sequence that has not only the same data structure, but also the same key, as table sequence A1

r.create()[257][258]

Description:

Create a table sequence by copying the data structure of a specified record.

Syntax:

r.create()

Note:

If there’s a key defined in record r, then copy the key at the same time.

Parameters:

r

A record

Return value:

A new empty table sequence

Example:

Ø  Generate an empty table sequence from an average record

 

A

 

1

=demo.query("select top 1 * from DEPARTMENT")

2

=A1(1).create()

Use “=A1(1).create()” to generate an empty table sequence A2 that has the same data structure as the record “A1(1)”. Both consist of DEPT field and MANAGER field.

Ø  Generate an empty table sequence from a record with the key and the descriptor

 

A

 

1

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

 

2

=A1.keys(DEPT)

 

3

=A1(1).create()

Generate an empty table sequence by copying the data structure of the record A1(1) and the key

cs.()[259][260]

Description:

Evaluate the expression with each member in the cursor.

Syntax:

cs.(x)

cs.()            Retrun cs itself

Note:

The function evaluates the expression using each member of the cursor and returns results as a cursor. Use ~ to to reference the current member during the calculation.

Parameters:

cs

Cursor

x

An expression that is generally a single field name; or a legal expression composed of multiple field names. Both can use ~ to reference the current record.

Return value:

A cursor consisting of values of expression x calculated from every member

Example:

 

A

 

1

=connect("demo").cursor("select * from EMPLOYEE where EID<10")

 

2

=A1.(age(BIRTHDAY))

 

3

=A2.fetch()

4

=connect("demo").cursor("select * from SCORES where SCORE<60")

 

5

=A4.(SCORE)

 

6

=A5.(~*~)

Use ~ to reference the current sequence member

7

=A6.fetch()

8

=demo.cursor("select * from DEPARTMENT")

 

9

=A8.()

Return A8

10

=A9.fetch()

 

 

cuboid()[261][262]

Here’s how to use cuboid() function.

T.cuboid(C,Fi,…;y:Gi,…)[263][264]

Description:

Store the result set of grouping an entity table as a pre-summarized data cube.

Syntax:

T.cuboid(C,Fi,…;y:Gi,…)

Note:

The function stores the result set of grouping entity table T as a pre-summarized data cube C, where Fi field is the grouping field and Gi field is the result of calculating aggregate function y.

Parameters:

T

Entity table

C

Pre-summarized data cube name; delete the pre-summarized cube with the specified name when only this parameter is present

Fi

Grouping field

y

Aggregate function, support only sum/count/max/min/top/iterate; when working with iterate(x,a;Gi,…) function, parameter Gi isn’t supported

Gi

Field name in result set

Return value:

A composite table object

Example:

 

A

 

1

=file("D://orders.ctx").create()

Open composite table file orders.ctx:

 

2

=A1.cuboid(test,OCount;count(EID):COUNT)

Group A1’s composite table by Ocount, count the number of EID in each group, and store the resul set in the pre-summarized data cube test

 

3

=A1.cuboid(test1,OCount;count(EID):COUNT,min(OAmount):MIN)

Group A1’s composite table by Ocount, count the number of EID and find the minimum value of Oamount in each group, and store the resul set in the pre-summarized data cube test1

 

4

=A1.cuboid()

Delete all pre-summarized cubes

 

5

=A1.cuboid(test)

Delete data cube test

 

cum()[265][266]

Description:

An interative loop to get a cumulative value over records in which one of its fields has same values.

Syntax:

cum(x;Gi,…)

Note:

The function performs an interative loop over records whose Gi field contains same values to compute expression x and add its previous value to the current one. Each time when the value of Gi field changes, perform a new round of calucation.

Parameters:

x

An expression

Gi

Field name

Return value:

The result of the given expression’s current value plus its previous one

Example:

 

A

 

1

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

 

2

=A1.derive(cum(SCORE+10;CLASS):F1)

3

=A1.derive(cum(SCORE+10;CLASS,STUDENTID):F1)

 

cursor()[267][268]

Here’s how to use cursor() function.

cursor()[269][270]

Description:

 Call a cellset file and return the resut set returned from the execution of the file as a cursor.

Syntax:

cursor(dfx,…)

Note:

The function calls a cellset file and returns the resut set returned from the execution of the file as a cursor. When there are multiple return statements in the dfx file, first merge the result sets returned by the return statements, and then return the merge result as a cursor. These result sets of return must be of the same structure, or error will be reported. Use either an absolute path or a relative path to search for the dfx file. With the relative path, the search order is Class path –> Search path –> Main director.

Parameters:

dfx

Cellset file name

dfx’s parameter

Options:

@c

The dfx can be represented by a cell that corresponds to a subroutine defined by func() function

Return value:

Cursor

Example:

Here’s test.dfx cellset file under the main directory in which arg1 is the cellset parameter:

 

 

A

B

 

1

for arg1

 

 

2

 

=connect("demo").query("select * from GYMNASTICSWOMEN where ID=?",A1)

 

3

 

=B2.derive(avg(VAULT,UNEVENBARS,BALANCEBEAM,FLOOR):Average)

 

4

 

return B3

Perform a loop computation and return the result sets

 

 

A

 

1

=[5,10,20,25]

 

 

2

=cursor("test.dfx",A1)

Cll test.dfx, pass A1’s sequence as the value of parameter arg1, and return result as a cursor

3

=A2.fetch()

Fetch records from the cursor; the result is the union of returned result sets by the loop computation of test.dfx

4

=call("test.dfx",A1)

Use call function to call test.dfx but only the result set of the first loop is returned                     

 

 

A

B

 

1

func

 

 

2

 

return A1.sum()

 

3

=cursor@c(A1,[2,5,7])

 

Call the code block whose master cell is A1

4

=A3.fetch()

 

14

cursor cs cursor … cursor[271][272]

Description:

Define a channel for each cursor according to a specified cursor.

Syntax:

cursor cs

cursor

cursor

Note:

The statement defines a channel for each cursor according to cursor cs (the value of the cursor cell is a channel), traverses cs to perform a calculation over the channel in the code block and write the result into the cell of cursor.

Parameters:

cs

A cursor

A code block

Return value:

Result set of channel

Example:

 

A

B

 

1

=to(100000).new(rand(1000):f1,rand(1000):f2).cursor()

 

Generate a cursor

2

cursor A1

=A2.groups(f1:count(1))

Traverse cursor A1, calculate A2’s channel in B2’s code block and write the result to A2

3

cursor

=A3.groups(f2:count(1))

Same as the above

A.cursor()[273][274]

Description:

Generate a cursor from a sequence.

Syntax:

A.cursor(k:n)

Note:

The function generates a cursor based on sequence A, divides the cursor data into n segments, and retrieves the kth segment. All segments will be retrieved if parameter k:n is absent.

Parameters:

A

A sequence

k

Segment number

n

The number of data segments; retrieve all data out when both k and n are omitted

Options:

@m

With this option:

A.    cursor@m(n) returns a multicursor; n is the number of segments; use the max number of parallel tasks defined in the designer as the number of segments if n is absent

B.     cursor@m(mcs,K:K’,...) divides an ordered sequence into several segments according to segmenting key K:K’ in sync with ordered multicursor mcs and returns them as a multicursor, too.

Return value:

Cursor/Multicursor

Example:

 

A

 

1

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

 

2

=A1.cursor(1:3)

Divide the cursor generated from A1 into 3 segments, and retrieve the first one to return

3

=A1.cursor@m(3)

Return a multicursor

4

=demo.query("select * from STUDENTS").sort(ID)

Sort the table sequence by ID

5

=demo.query("select * from STUDENTS1").sort(ID).cursor@m()

Sort the table sequence by ID and return it as a multicursor

6

=A4.cursor@m(A5,ID:ID)

Divide A4’s table sequence into multiple segments by ID and return them as a multicursor

db.cursor()[275][276]

Description:

Create a database cursor by executing an SQL statement and return it.

Syntax:

db. cursor(sql {,args …})

 

db.cursor(call dfx(){,args })

Connect to esProc-ODBC data source db to call the specified dfx file, and return result as a cursor

Note:

The function creates a database cursor by executing SQL and returns it. The cursor will be automatically closed after a full data scan.

Parameters:

db

Database connection

sql

A SQL statement, like select * from table.

args

If there are parameters in the SQL, they must get assigned; their values can be actual ones or args specified in query statement

Note: Parameters shall be separated by commas

dfx

A cellset file; can be specified using a relative path, which is relative to the search path, or an absolute path

Options:

@i

If the result set has only one column, the content of the returned cursor is a sequence

@d

Convert the numeric data type to the double data type, instead of the decimal data type

@x

Disconnect from the database automatically when the cursor is closed. This option applies to the database connection with connect only

Return value:

A cursor

Example:

 

A

B

C

 

1

=connect("demo")

 

2

=A1.cursor("select * from SCORES")

Return a cursor for retrieving data

3

=create(CLASS,STUDENTID,SUBJECT,SCORE)

Create a table sequence

4

for

 

 

5

 

if A4==1

=A2.skip(5)

When the loop number is 1, jump five rows forward

6

 

=A2.fetch(3)

Fetch three records from the cursor A2 at once

7

 

if B6==null

If B6 is empty, break the loop

8

 

 

Break

 

9

 

else

 

 

10

 

 

>A3.insert(0:B6,CLASS,STUDENTID,SUBJECT,SCORE)

Insert the records in B6 into A3

11

=A1.cursor@ix("select NAME from STUDENTS")

Use @x option to automatically disconnect from the database when the cursor is closed

12

=A11.fetch()

The content of the cursor is a sequence

13

=A1.cursor@i("select NAME from STUDENTS")

Error message saying Data Source demo is shutdown or wrong setup suggests that the data source hasn’t been enabled appears. This is because database connection is automatically closed when A11’s cursor is closed

14

=mysql.cursor@d("select * from ta")

 

15

=A14.fetch()

16

=myproc.cursor("call hsql(?)",10).fetch()

hsql.dfx is in the search path. Below is the file:

myproc is the esProc-ODBC data source name; the parameter value is 10. Below is the result:

17

=demo.cursor(“select * from dept  deptid<? and father=?”,arg1,arg2)

arg1 and arg2 are cellset parameters, whose default values are set as 10 and 1

18

=A17.fetch()

Related functions:

cs.fetch()

cs.skip()

f.cursor()[277][278]

Description:

Create a cursor based on a file.

Syntax:

f.cursor()

f.cursor(Fi:type,…; k:n,s)

Note:

The function creates a cursor based on file f and returns it. The cursor will be automatically closed after a full data scan.

Parameters:

f

File object, only supporting the textual file object

Fi

Fields to be retrieved; all fields will be retrieved by default. The to-be-retrieved field(s) can be represented by their sequence numbers headed by the sign #

type

Field types, including bool, int, long, float, decimal, string, date, time and datetime. Data type of the first row will be used by default

s

User-defined separator. The default is tab. When the parameter is omitted, the comma preceding it can be omitted, too

k

The segment number

n

The number of segments. Retrieve the whole file when both k and n are omitted

Options:

@t

Use the first row of f as the field names. If omitted, use_1,_2,… as the default field names

@b

Retrieve data from the exported binary file, with the support for parameters Fi, k and n, and with no support for parameters type and s. Ignore options @t, @s, @i, @q and @m. The segmental retrieval could result in empty segment in cases when a file has only a very small number of records

@e

Make the function return null when Fi doesn’t exist in the file; raise an error when the option is absent 

@x

Delete the source file automatically on closing the cursor

@s

Not split the to-be-retrieved field when it is imported as a cursor whose content is a table sequence consisting of strings of a single field; in this case the parameters will be ignored

@i

If the result set has only one column, the content of the returned cursor will be a sequence

@q

Remove the quotation marks, if any, from the field strings, including the field names, in the first place, and handle escape sequences

@c

Use comma as the separator when the parameter s is absent, but the user-defined separator s should take priority when there is one

@m

With the option, the f.cursor@m(Fi:type,…;n,s) function returns a multicursor;  parameter n is the number of segments; use the max number of parallel tasks defined in the designer as the number of segments if the option is absent

@o

Use quotation marks as the escape character

@k

Retain the white space on both sides of the data item; without it a trim operation will be automatically performed

@d

Delete a record if it contains unmatching data types or data formats and start examining data by type

@n

Ignore and discard rows whose number of columns don’t match the first row

@v

Verify data type matching, and, if error reports, throw an exception, terminate the execution and output the content of the problem record

Return value:

A cursor

Example:

 

A

B

C

 

1

=file("D://Student.txt").cursor@tx()

Return the cursor for retrieving data, take the record in the first row as field names, and delete the file automatically when closing the cursor.

2

=create(CLASS,STUDENTID,SUBJECT,SCORE)

Construct a new table sequence

3

for

 

 

4

 

if A3==1

=A1.skip(5)

If the number of loop is 1, then skip 5 consecutive rows.

5

 

=A1.fetch(3)

Retrieve data from cursorA1, 3 rows each time

6

 

if B5==null

Jump out from the loop when B5 is null

7

 

 

Break

 

8

 

else

 

 

9

 

 

>A2.insert(0:B5,CLASS,STUDENTID,SUBJECT,SCORE)

Insert records in B5 into A2

10

=file("D://Department.txt").cursor@t(Dept,Manager;,"/")

=A10.fetch()

Below is Department.txt:

Contents of Department. txt are separated with the slashes and read out according to the specified fields of DEPT and MANAGER

11

=file("D://Department5.txt").cursor@t(;1:2)

=A11.fetch()

With Fi and s omitted, the function separates the cursor into 2 segments and retrieves the first one

12

=file("D:// EMPLOYEE. btx").cursor@b(GENDER;1:2)

=A12.fetch()

Retrieve the GENDER field of the bin file, EMPLOYEE.btx(a segmented binary file) exported through f.export@z(); by default the exported binary file includes field names .

13

=file("D://EMPLOYEE.btx").cursor@b(;1:2)

=A13.fetch()

Retrieve the segmented binary file, EMPLOYEE1.btx, exported by f.export@b(), divide the file contents into 2 parts, and get the first part

14

=file("D://Department.txt").cursor@ts()

= A14.fetch()

Won’t split fields, the cursor contains a table sequence consisting of a single string field

15

=file("D://StuName.txt").cursor@i()

=A15.fetch()

StuName.txt is a file containing only one field, so the content of the cursor is a sequence

16

=file("D://EMPLOYEE1.txt").cursor@tc()

=A16.fetch()

Retrieve the first segment of GENDER field of comma-seperated EMPLOYEE1.txt

17

=file("D://Department3.txt").cursor@e(EID)

=A17.fetch()

Return null since EID field can’t be found in Department3.txt; without @e option, error will be reported, saying EID: field is not found

18

=file("D://Department2.txt").cursor@tq(;,"|")

=A18.fetch()

Below is Department2.txt:  

B19’s result:

19

=file("D://Department.txt").cursor@tm(DEPT:string,MANAGER:int;3,"/")

 

The cursor is devided into 3 segments and the result of A19 is returned as a multicursor

20

=file("D://Sale1.txt").cursor(#1,#3)

=A20.fetch()

Below is the Sale1.txt file:

 Below is the result of B20:

21

=file("D:/Dep3.txt").cursor@qo()

=A21.fetch()

Here is the Dep3.txt file:

Return the result:

22

=file("D:/Dep1.txt").cursor@k()

=A22.fetch()

Retain the whitespace characters on both sides of the data item

 

23

=file("D:/Department1.txt").cursor@t(id:int,name;,"|")

=A23.fetch()

Return id and name fields of Department1.txt

24

=file("D:/Department1.txt").cursor@td(id:int,name;,"|")

=A24.fetch()

Delete a record containing unmatching data types; rows where id value is a are deleted

25

=file("D:/Department1.txt").cursor@tv(id:int,name;,"|")

=A25.fetch()

Verify data type matching, and, and if error reports, throw an exception, terminate the execution and output the content of the problem record; data type doesn’t match with rows where id value is a

 

26

=file("D:/Dep2.txt").cursor@tdn(id:int,name,surname;,"|")

=A26.fetch()

Here’s the file Dep2.txt:

Ignore row 6 and row 8 because the number of columns don’t match that in row 1

Related functions:

cs.fetch()

cs.skip()

db.cursor()

T.cursor(x:C,…;wi…;k:n)[279][280]

Description:

Segment an entity table and return the cursor of a specified segment.

Synatax:

T.cursor(x:C,…;wi,…;k:n)

Note:

The function splits entity table T into n segments, computes data in the kth segment with expression x and the filtering condition wi, and returns the results as a cursor which contains a field named C. If T is an attached table, the queried data is allowed to include a parent table field.

Options:

@m

The T.cursor@m(x:C…;wi,...;n) function with this option generates a multicursor segmented into n parts. n is an integer; the function returns an ordinary cursor if n<2; use the max number of segments set inTool-Optionsif n is absent

Parameters:

T

An entity table

x

Expression

C

Column alias; can be omitted

wi

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time. You can use expression K:Ti (K is a field in the entity table; Ti is a table sequence whose primary key is K) in a condition. The expression means filtering away records where K=Ti.find(K) is false. By default the whole result set is retrieved

k

A positive integer (kn) representing the kth segment

n

A positive integer representing the number of segments

Return value:

A single-thread cursor/multicursor

Example:

 

A

 

1

for 100

 

2

=to(10000).new(#:k1,rand():c1).sort@o(k1)

Generate data

3

=to(10000).new(#:k1,rand(10000):c2,rand()*1000:c3).sort@o(k1)

Generate data

4

=A2.cursor()

Return a cursor

5

=A3.cursor()

Return a cursor

6

=file("D:\\tb4.ctx")

 

7

=A6.create(#k1,c1;k1)

Create the composite table’s base table

8

=A7.append(A4)

Append cursor records to the base table

9

=A7.attach(table4,c2,c3)

Add an attached table to the base table

10

=A9.append(A5)

Append cursor records to the attached table

11

=A9.cursor(;c2<1000;2:3)

Divide records where value of c2 field is less than 1000 into 3 segments, and return a cursor of all columns in the second segment

12

=A11.fetch()

Fetch data from the cursor

13

=A7.cursor(;c1>0.99)

Retrieve some fields from the composite table’s base table

14

=A13.fetch()

 

15

=A9.cursor(k1,c1:b,c3;c3>999)

Based on composite table table4, retrieve k1 field and c1 field from the base table and rename c1 b; and, from the attached table, retrieve records where c3 field value is greater than 999

16

=A15.fetch()

 

17

==A9.cursor@m(;;3)

 

18

=create(k1,k2).record([1,"aa",2,"bb",3,"uh",6,"kkj",7,"fdf",10,"wwwww"]).keys(k1)

Return a table sequence where k1 is the primary key

19

=A6.create()

Open a composite table

20

=A19.cursor(;c1>0.3,k1:A18;1:3).fetch()

Get k1 and c1 fields from A19’s entity table with the condition that c1>0.3 and k1 field values exist in k1 field of A18’s table sequence

T.cursor(x,…;wi,...)[281][282]

Description:

Return the specified column(s) in a cluster entity table/cluster memory table as a cluster cursor.

Syntax:

T.cursor(x,…;wi,...)

Note:

The function computes data in a cluster entity table/cluster memory table with expression x and the filtering condition w and returns the results as a cluster cursor. Perform file function and cursor function without using @z option over a cluster could cause a computational error.By default a duplicate table won’t be distributed among nodes.

Options:

@m

The function with this option generates a cluster multicursor synchronously segmented into n parts. n is an integer; the function returns an ordinary cursor if n<2; use the max number of segments set inTool-Optionsif n is absent. A duplicate table will be split on two levels, i.e. first distributed among nodes and then generate a multicursor from a segment on the node, when it works with @z.

@z

This option applies only to non-distributed cluster table; it distributes a cluster duplicate table/a cluster memory table among nodes for further processing

Parameters:

T

A cluster entity table/cluster memory table

x

Expression

wi

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time. You can use expression K:Ti (K is a field in the entity table; Ti is a table sequence whose primary key is K) in a condition. The expression means filtering away records where K=Ti.find(K) is false.By default the whole result set is retrieved

n

A positive integer representing the number of segments

Return value:

A cluster (multi)cursor

Example:

 

A

 

1

=file@n("D:/tb4.ctx","169.254.121.62:8281")

Open a duplicate table file

2

=A1.create()

Create a cluster duplicate composite table

3

=A2.attach(table3)

Retrieve cluster entity table table3

4

=A2.cursor()

Return a cluster cursor

5

=A3.cursor(NAME,GENDER;EID<6)

 Return NAME field and GENER field where EID<6 as a cluster cursor

6

=file@0("tb4.ctx",["169.254.121.62:8281","192.168.31.72:8291"])

Open a duplicate file

7

=A6.create()

 

8

=A7.cursor@z()

Return the duplicate file that is segmented among nodes using @z option

9

=file@z("tb5.ctx","192.168.31.72:8281")

 

10

=A9.create(;;"@!*123")

 

11

=A10.cursor@m(;;3)

Generate a cluster multicursor that is segmented into 3 parts

12

=A10.cursor()

 

13

=A12.memory()

Generate a cluser memory table

14

=A13.cursor()

Return a cluster cursor

T.cursor(x:C,…;wi,...;mcs)[283][284]

Description:

Synchronously segment an entity table according to a multicursor and return a multicursor.

Syntax:

T.cursor(x:C,…;wi,...;mcs)

Note:

The function synchronously segments entity table T according to multicursor mcs, during which T’s dimension and mcs’s key will be matched, and returns a multicursor; the way of distributing T and mscs among nodes must be the same and the fields for segmenting T and mcs should be consistent. If multiple entity tables are involved, use a multicursor as a reference to make sure the segmentation is synchronous.

Parameters:

T

An entity table

x

Expression

C

Column alias

wi

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time. You can use expression K:Ti (K is a field in the entity table; Ti is a table sequence whose primary key is K) in a condition. The expression means filtering away records where K=Ti.find(K) is false. By default the whole result set is retrieved

mcs

A multicursor generated from an entity table

Return value:

A multicursor

Example:

 

A

 

1

for 100

 

2

=to(10000).new(#:k1,rand():c1).sort@o(k1)

Generate data

3

=to(10000).new(#:k1,rand(10000):c2).sort@o(k1)

 

4

=to(10000).new(#:k1,rand()*1000:c3).sort@o(k1)

 

5

=A2.cursor()

 

6

=A3.cursor()

 

7

=A4.cursor()

 

8

=file("D:\\cs1.ctx")

 

9

=A8.create(#k1,c1;k1)

Create the composite table’s base table where k1 is the key by which  records are segmented

10

=A9.append(A5)

 

11

=A9.attach(table1,#c2)

Add attached table table1 to the base table

12

=A11.append(A6)

 

13

=A11.cursor@m(;;2)

Segment entity table table1 and return the segments as a multicursor

14

=A9.attach(table2,c3)

Add attached table table2 to the base table

15

=A14.append(A7)

 

16

=A14.cursor(;;A13)

Segment entity table table2 according to table1’s multicursor

 

T.cursor(x:C,…;wi,...;mcs)[285][286]

Description:

Synchronously segment a cluster entity table according to a cluster multicursor and return a cluster multicursor.

Syntax:

T.cursor(x;C,…;w;mcs)

Note:

The function synchronously segments cluster entity table T according to cluster multicursor mcs, during which T’s dimension and mcs’s key will be matched, and returns a cluster multicursor; the way of distributing T and mcs among nodes must be the same and the fields for segmenting T and mcs should be consistent. If multiple cluster entity tables are involved, use a cluster multicursor as a reference to make sure the segmentation is synchronous.

Parameters:

T

A cluster entity table

x

Expression

w

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time. You can use expression K:Ti (K is a field in the entity table; Ti is a table sequence whose primary key is K) in a condition. The expression means filtering away records where K=Ti.find(K) is false. By default the whole result set is retrieved

mcs

A cluster multicursor generated from a cluster entity table

Return value:

A cluster multicursor

Example:

 

A

 

1

=file@z("D:/cs1.ctx","169.254.121.62:8281")

 

2

=A1.create()

Open a distributed cluster composite table

3

=A2.attach(table1)

Retrieve cluster entity table table1

4

=A3.cursor@m(;;2)

Return a cluster multicursor

5

=A2.attach(table2)

Retrieve cluster entity table table2

6

=A5.cursor(;;A4)

Segment cluster entity table table2 according to table1’s multicursor

 

T.cursor(C,…;wi,...;k:n)[287][288]

Description:

Segment a memory table/cluster memory table and return cursor of the specified segment.

Syntax:

T.cursor(C,…;wi,...;k:n)

Note:

The function filters memory table T according to filtering condition wi, splits it into n segments and returns the kth segment as a cursor; return the cursor of the whole table if parameters are absent. For a cluster memory table, parameters k:n are invalid and can be omitted. Parameter C is one of T’s column; return all columns of T when C is absent. The function will return the filtered T when parameters k:n are absent. Parameters k:n have no meaning if T is a cluster memory table and thus will be omitted.

Note: Perform file function and cursor function without using @z option with them over a cluster could cause a computational error.

Parameters:

T

A memory table/cluster memory table

C

Column name in the memory table

wi

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time. You can use expression K:Ti (K is a field in the entity table; Ti is a table sequence whose primary key is K) in a condition. The expression means filtering away records where K=Ti.find(K) is false.

k

A positive integer (kn) representing the kth segment

n

A positive integer representing the number of segments

Options:

@m

T.cursor@m(...;n) returns a multicursor segmented into n parts; n is an integer; the function returns an ordinary cursor if n<2; use the max number of segments set inTool-Optionsif n is absent

Return value:

A single-thread cursor/multicursor

Example:

 

A

 

1

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

Return cursor of the retrieved data

2

=A1.memory()

Return a memory table

3

=A2.cursor(2:3).fetch()

Split the cursor generated from the memory table into 3 segments and get the 2nd one

4

=A2.cursor@m(3).fetch()

Use @m option to return a memory-table-generated multicursor that contains 3 segments

5

=file@n("D:/test.ctx","169.254.121.62:8281")

Open a duplicate file

6

=A5.create()

Create a duplicate cluster table

7

=A6.attach(table3)

Retrieve the cluster table table3

8

=A7.memory()

Return a cluster memory table object

9

=A8.cursor().fetch()

The cursor generated from a memory table hasn’t a segmentation parameter

10

=A2.cursor(EID,NAME;EID<80;2:3)

Split records where EID is less than 80 in A2’s memory table into 3 segments and return the 2nd segment consisting of EID and NAME fields

11

=A2.cursor@m(EID,NAME;EID<80;5)

Return a multicursor

 

T.cursor(…;w;mcs)[289][290]

Description:

Divide a memory table in sync with a memory multicursor and return it also as a memory multicursor.

Syntax:

T.cursor(...;w;mcs)

Note:

The function filters memory table T according to filtering condition w and returns the table as a memory multicursor in sync with multicursor mcs. The ellipsis parameter, generally omitted, represents the selected field(s), and the semicolon after it must be alwasys present.

Parameters:

T

A memory table

w

Filtering condition

mcs

A multicursor generated from a memory table or a composite table

Return value:

A memory multicursor

Example:

 

A

 

1

==demo.cursor("select * from employee where EID < 10")

Return the retrieved data as a cursor

2

=A1.memory().keys(EID)

Return a memory table for which the key is set as EID

3

=file("d://emp.ctx").create().cursor@m()

Open a composite table and return it as a multicursor

4

=A2.cursor(;SALARY>8000;A3)

Return a memory multicursor in sync with A3’s multicursor

 

mcs.cursor(n)[291][292]

Description:

Merge subcursors in a multicursor into a single cursor or a new multicursor with a smaller number of parallel subcursors.

Syntax:

mcs.cursor(n)

Note:

The function merges subcursors in a multicursor into a single cursor, which is the default, or a new multicursor with a smaller number, which is specified by parameter n, of parallel subcursors.

Parameters:

mcx

A memory table/a cluster memory table

n

Subcursor column name

Return value:

A common cursor or a multicursor

Example:

 

A

 

1

=file("D:\\dept2.txt").cursor@m()

Retrieve dept2.txt as a multicursor

2

=A1.fetch()

Fetch records from A1’s multicursor

3

=A2.cursor().groups(#3:FATHER;count(#1):TOTAL)

Merge the multicursor into a common cursor and perform grouping & aggregation

date()[293][294]

Here’s how to use date() function.

date(datetimeExp)[295][296]

Description:

Get the date part of the datetime value.

Syntax:  

date(datetimeExp)

Note:  

The function gets the date part of the datetimeExp.

Parameters:  

datetimeExp

Datetime value

Return value:  

Date type data

Example:

date(now())

2013-12-09

Related functions:

date()

datetime(datetimeExp)

time(datetimeExp)

datetime()

time()

date()[297][298]

Description:

Convert a string or an integer to a date value.

Syntax:

date(stringExp,format)

Convert stringExp to a date value according to the format defined by format

date(stringExp)

The format of the result returned by stringExp should be in consistent with the date format in configuration information; if time is contained in the result, the time will not be converted

date(year,month,day)

Convert year,month,day of integer type to date type

date(ym,day)

Convert integer ym and day into date data

Note:

The function converts string stringExp or integer year,month,day to date type data.

Parameters:

format

Format string

stringExp

String expression

year

Integer

month

Integer

day

Integer

ym

6-bit integer interpreted as year and month

Return value:

Date type data

Example:

 

A

 

1

=date("1982-08-09")

1982-08-09

2

=date("1982-08-09 10:20:30")

1982-08-09

3

=date(1982,08,09)

1982-08-09

4

=date(1982,-8,09)

1981-04-09

5

=date(1982,18,09)

6/9/1983

6

=date("12/28/1972"," MM/dd/yyyy ")

1972-12-28

7

=date(189208,08)

1892-08-08

Related functions:

date(datetimeExp)

datetime(datetimeExp)

time(datetimeExp)

datetime()

time()

f.date()[299][300]

Description:

Return the time and date of a file last modified.

Syntax:

f.date()

Note:

The function returns the time and date of file f last modified.

Parameter:

f

File object

Return value:

   Datetime data

Example:

       

A

 

1

=file("D://p1.dfx").date()

"2013-05-02 09:45:08"

Related functions:

f. exists()

f. size()

movefile()

datetime()[301][302]

Here’s how to use datetime() function.

datetime(datetimeExp)[303][304]

Description:

Adjust the precision of the datetime expression and return it.

Syntax:  

datetime(datetimeExp)

Note:  

The function adjusts the precision of datetimeExp and returns it. By default, the precision is the day.

Parameter:  

datetimeExp

Datetime value

Options:

@m

Measure to minute

@s

Measure to second

Return value:  

Datetime value

Example:

datetime(now())

2013-12-09 00:00:00

datetime@m(now())

2013-12-09 16:56:00

datetime@s(now())

2013-12-09 16:56:45

Related functions:

date()

date(datetimeExp)

time(datetimeExp)

datetime()

time()

datetime()[305][306]

Description:

Convert the string or long integer to datetime value.

Syntax:

datetime(string{, format })

Convert the data type of string to datetime type according to the format defined by format; if parameter format doesn’t exist, the format of string of string type should be the same as the format of datatime value in configuration information

datetime(long)

Convert long of long integer type to datetime value

datetime(date,time)

Concatenate date type data and time type data into data of datetime type

datetime(y,m,d,h,m,s)

Convert y,m,d,h,m,s of integer type to datetime data

datetime(ym,d,h,m,s)

Convert integer ym, d, h, m, s into datetime data

Note:

The format of string should match format.

Parameters:

string

String

format

Format string

long

Long integer counted in microseconds

date

Date type

time

Time type

y

Positive integer, year

m

Positive integer, month

ym

6-bit positive integer interpreted as year and month

d

Positive integer, day

h

Positive integer, hour

m

Positive integer, minute

s

Positive integer, second

Return value:

Datetime type data

Example:

datetime("2006-01-01 10:20:30")

2006-01-01 10:20:30

datetime("12/28/1972 10:23:43","MM/dd/yyyy HH:mm:ss")

1972-12-28 10:23:43

datetime("2006-01-01 10:20:30:111")

2006-01-01 10:20:30

datetime(12345)

1970-01-01 08:00:12

datetime(date("1982-08-09"),time("12:12:12"))

1982-08-09 12:12:12

datetime(2006,01,01,-10,-20,30)

datetime(200601,01,-10,-20,30)

2005-12-31 13:40:30

2005-12-31 13:40:30

Related functions:

date()

time()

date(datetimeExp)

datetime(datetimeExp)

time(datetimeExp)

day()[307][308]

Description:

Get the day from a date value.

Syntax:

day(dateExp)

Note:

The function gets the day from dateExp of date type.

Parameters:

dateExp

Date expression whose result must be the date or the string of Chinese date and time format.

Options:

@w

Get the day of the week from the specified date. For Sunday, return 1; For Monday, return 2, and so on. By default, get the day of the month from the specified date.

Return value:

Integer

Example:

day(datetime("19800227","yyyyMMdd"))

27

day(datetime(12345))

1

day(datetime("2006-01-15 10:20:30"))

15

day@w(datetime("19800227","yyyyMMdd"))

4

day@w(datetime("2006-01-15 10:20:30"))

1

Related functions:

year()

month()

hour()

minute()

second()

millisecond()

days()[309][310]

Description:

Get the number of days of the year, quarter or month to which the specified date belongs.

Syntax:

days(dateExp)

Note:

The function gets the number of days of the year, quarter or month to which the specified date dateExp belongs.

Parameters:

dateExp

A date or a date string of standard format

Options:

@q

Get the number of days of the quarter to which the specified date belongs

@y

Get the number of days of the year to which the specified date belongs

By default get the number of days of the month to which the specified date belongs

Return value:

Integer

Example:

days(datetime("19800227","yyyyMMdd"))

29

days(datetime("2006-01-15 10:20:30"))

31

days@y(datetime("19800227","yyyyMMdd"))

366

days@q(datetime("2006-01-15 10:20:30"))

90

decimal()[311][312]

Description:

Convert a string or numeric value to a big decimal number.

Syntax:

decimal(stringExp)

decimal(numberExp)

Note:

The parameter stringExp is a string consisting of a number (and sometimes a decimal point).

The parameter numberExp is a numeric value which is less than or equal to 64 bits. For values more than 64 bits, you will have to use the stringExp to represent them.

Parameters:

stringExp

A specified numeric string, which may contain a decimal point.

numberExp

The numeric value which is less than or equal to 64 bits.

Return value:

Big decimal number

Example:

decimal("123456789012345678901234567890")

123456789012345678901234567890

decimal(1234567890123456)

1234567890123456 (BigDecimal type)

Related functions:

float()

int()

long()

number()

string()

delete()[313][314]

Here’s how to use delete() function.

T.delete()[315][316]

Description:

Delete specified records from a table sequence.

Syntax:

T.delete(k)

Delete the kth record

T.delete(p)

Delete the records whose sequence numbers exist in p

T.delete(A)

Delete the records that exist in A

Note:

The function deletes the specified records from table sequence T, and automatically updates the index, if any, and checks distinctness. The deleted records will be always saved in the delete buffer.

Parameters:

T

A table sequence

k

A positive integer, which specifies the position of a record to be deleted

p

An integer sequence with the length of n, which specifies the positions of the records to be deleted

A

A sequence, which specifies the records to be deleted

Options:

      @n       Return the deleted record or a record sequence of the deleted records

Return value:

The table sequence T, some records of which have been deleted

Example:

 

A

 

1

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

 

2

=A1.delete(1)

Delete the first record

3

=A1.delete([2,4,6])

Delete the second, the forth and the sixth records.

4

=A1.select(EID>5)

 

5

=A1.delete(A4)

Delete the records whose EID is more than 5.

6

=A1.delete@n(1)

Return the deleted record

Note:

We use the store address, instead of the field names or field values, to judge whether the records specified by A exist in T. So to delete the specified records , we generally use the function T.delete(T.select(…)) to locate them.

Related functions:

T.modify()

T.insert()

A.delete()

A.delete()[317][318]

Description:

Delete specified members from a sequence.

Syntax:

A.delete(k)

Delete the kth member

A.delete(p)

Delete the members whose sequence numbers exist in p

Note:

The function deletes the kth member or the members whose sequence numbers exist in p from sequence A, and automatically updates the index, if any, and checks distinctness.

Parameters:

A

A sequence

k

A positive integer that indicates the position of a member to be deleted in the sequence

p

An integer sequence with the length of n that specifies the positions of the members to be deleted

Options:

@n

Return the deleted record or a record sequence of the deleted records

Return value:

A sequence

Example:

 

A

 

1

=["a","c","d","e","f"]

 

2

=A1.delete([2,4,5])

[a,d]

3

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

 

4

=A3.delete@n(2)

Return the deleted record

Related functions:

A.insert()

A.modify()

T.delete()

T.delete(P)[319][320]

Description:

Delete specified record(s) from acomposite table.

Syntax:

T.delete(P)

Note:

The function deletes from entity table T the records that matches key values of record sequence P. If T has an index, then update it automatically. If T is the base table having an attached table, delete records having same dimensions from the attached table.

Parameters:

T

An entity table

P

A record sequence having same structure as T

Options:

@n

Return the deleted record(s)

Example:

 

A

 

1

=file("D:\\emp3.ctx")

 

2

=A1.create(#EID,NAME;EID)

Create a composite table where EID field is the key by which records are segmented

3

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

 

4

=A2.append(A3)

Append data to the base table

5

=A2.attach(table3,GENDER)

Add an attached table to the base table

6

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

 

7

=A5.append(A6)

Append cursor records to the attached table

8

=demo.query("select EID,GENDER from employee where EID =3 ")

Return records of the table sequence where EID is 3

9

=A5.delete(A8)

Delete the records where EID is 3 from entity table table3

10

=demo.query("select EID,NAME from employee where EID =2")

Return records in the table sequence where EID is 2

11

=A2.delete@n(A10)

Return the deleted record

 

T.delete(P)[321][322]

Description:

Delete specified records from a memory table.

Syntax:

T.delete(P)

Note:

The function matches memory table T’s primary key with primary key values of record sequence P and deletes from T the matching records, during which T’s primary key keeps its order. Will automatically update the index if T has one.

Parameters:

T

A memory table

P

A records sequence having the same structure as T

Options:

@n

Return the deleted records

Return value:

A memory table

Example:

 

A

 

1

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

Return a cursor

2

=A1.memory()

Return a memory table

3

=A2.keys(EID)

 

4

=demo.query("select EID,NAME,GENDER from employee where EID =3 ")

Return records in the table sequence where EID is 3

5

=A2.delete(A4)

Delete records where EID is 3

6

=demo.query("select EID,NAME,GENDER from employee where EID =5 ")

Return records in the table sequence where EID is 5

7

=A2.delete@n(A6)

Return the deleted record

 

T.delete(P)[323][324]

Description:

Delete specified records from a cluster table.

Syntax:

T.delete(P)

Note:

The function matches cluster table T’s primary key with primary key values of record sequence P and deletes from T the matching records. Will automatically update the index if T has one. Only records in a distributed cluster composite table can be deleted.

Parameters:

T

A cluster table

P

A record sequence of same structure as T

Example:

 

A

 

1

=file@0@z("emp10.ctx",["192.168.0.118:8281"])

 

2

=A1.create()

Open a distributed cluster composite table

3

=demo.query("select EID,GENDER from employee where EID =3 ")

Return records of the table sequence where EID is 3

4

=A2.delete(A3)

Delete records from entity table table3 where EID is 3

deq()[325][326]

Description:

Compare the specified two dates.

Syntax:

deq(datetimeExp1,datetimeExp2)

Note:

The function compares two parameters - dateExp1 and dateExp2 - to see if they are equal.

Parameters:

datetimeExp1

Date or standard datetime format string

such as yyyy-MM-dd HH:mm:ss, yyyy-MM-dd, or HH:mm:ss

datetimeExp2

Date or standard datetime format string

such as yyyy-MM-dd HH:mm:ss, yyyy-MM-dd, or HH:mm:ss

Options:

@y

Accurate to the year

@q

Accurate to the quarter

@m

Accurate to the month

@t

Accurate to the ten-day period

@w

Accurate to the week

 

Accurate to the day by default

Return value:

A boolean value

Example:

deq("1988-12-08","1988-12-07")

false

deq@y(date("1988-11-08"),date("1988-09-12"))

true

deq@m(date("1988-11-08"),date("1988-09-12"))

false

deq@q(date("1988-12-08"),date("1988-10-12"))

true

deq@t(date("1988-10-08"),date("1988-10-12"))

false

deq@w(date("1988-10-05"),date("1988-10-08"))

true

derive()[327][328]

Here’s how to use derive() function.

A.derive()[329][330]

Description:

Add one or more fields to a table sequence or a record sequence.

Syntax:

A.derive(xi:Fi,…)

Note:

The function adds Fi,… field(s) to table sequence/record sequence A to re-structure it as a table sequence with "original fields in P plus Fi,…", and then traverses records of A to assign each Fi with value xi.

Parameters:

Fi

Field name, which shouldn’t have the same name as any of the original fields in P

xi

Expression, whose results are used as the values of the derived fields

A

A table sequence/record sequence

Options:

@m

Use parallel algorithm to handle data-intensive or computation-intensive tasks to enhance performance; no definite order for the records in the result set.

@i

Won’t generate a record if the result of expression xi is null (this won’t affect a record with null value in the original table sequence)

@x(…;n)

Unfold original fields whose values are records into n levels; default of n is 2

Return value:

A table sequence with added field(s)

Example:

 

A

 

1

=demo.query("select NAME,BIRTHDAY,HIREDATE from EMPLOYEE")

2

=A1.derive(interval@y(BIRTHDAY, HIREDATE):EntryAge,

age(HIREDATE):WorkAge)

3

=A1.derive@m(age(HIREDATE):WorkAge)

Use the @m option to increase performance of big data handling.

4

=file("D:\\txt_files\\data1.txt").import@t()

Below is the file data1.txt:

5

=A4.derive@i(SCORE:score_not_null)

If the SCORE value is null, the corresponding record won’t be generated

6

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

7

=demo.query("select NAME,GENDER,DEPT,SALARY from EMPLOYEE")

 

8

>A7.switch(DEPT,A6:DEPT)

Switch values of DEPT of A7’s table over with corresponding records

9

=A7.derive(SALARY*5:BONUS)

Add a new field:BONUS

10

=A7.derive@x(SALARY*5:BONUS)

Use @x option to unfold the DEPT field whose values are records; the default unfolding levels are 2

Note:

The difference between new() and derive(): The new() constructs a new table sequence without changing the original one. By comparison, the derive() copies the original fields and then adds new fields.

P.derive()[331][332]

Description:

Generate a table sequence according to a record sequence.

Syntax:

P.derive()

Note:

The function creates a table sequence by copying the data structure of record sequence P, in order to use the table sequence functions.

Parameters:

P

A record sequence.

Options:

@o

Do not copy the record sequence’s data structure, which will change the record sequence’s structure and which will adjust the number of fields as needed. The option will achieve a better performance as well as an increased risk of error. It’s recommended to be used only when the original record sequence is no longer needed.

Return value:

A table sequence.

Example:

 

A

 

1

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

 

2

=A1.select(SCORE>90)

Return a record sequence.

3

=A2.derive()

Generate a table sequence from the record sequence.

4

=A2.derive@o()

Directly reference the records of the record sequence, instead of generating new ones.

ch.derive()[333][334]

Description:

Add fields to records in a channel.

Syntax:

ch.derive(xi :Fi,…)

Note:

The function adds Fi,… fields to channel ch, making a new channel having “orginal fields of channel ch plus Fi,…”, and then traverse the records of ch to assign xi to each Fi. This is an attached computation.

Parameters:

ch

Channel

Fi

Field name, which shouldn’t be same as one of the existing ones

xi

An expression, whose results will be the values of the new fields

Options:

@i

Won’t generate a corresponding record if there appears null in the results of computing expression xi; won’t affect the field values of existing fields.

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select NAME,BIRTHDAY,HIREDATE from Employee")

 

2

=file("D:\\txt_files\\data1.txt").import@t()

Below is data1.txt

3

=channel()

Create a channel

4

=channel()

Create a channel

5

=A3.derive(interval@y(BIRTHDAY,HIREDATE):EntryAge, age(HIREDATE):WorkAge)

Add EntryAge field and WorkAge field in A3’s channel

6

=A3.fetch()

Attach ch.fetch() function that gets the final result set to A3’s channel to fetch and store the existing data in the channel

7

=A4.derive@i(SCORE:score_not_null)

Won’t genearate the corresponding record if a SCORE value is null

8

=A4.fetch()

Attach ch.fetch() function that gets the final result set to A4’s channel

9

=A1.push(A3)

Be ready to push A1’s data into A3’s channel, but the action needs to wait

10

=A2.push(A4)

Push data in A2’s sequence into A4’s channel

11

=A1.skip()

Data in A1’s cursor is pushed into the channel and operations are performed as the skip() operation is performed over A1

12

=A3.result()

13

=A4.result()

cs.derive()[335][336]

Description:

Add one or more fields to a cursor.

Syntax:

cs.derive(xi :Fi,…)

Note:  

The function adds Fi,… fields to cursor cs, making a new cursor having “orginal fields of channel ch plus Fi,…”, and then traverses each of the records of cs to compute expression xi. It supports multicursors.

Parameters:  

cs

Cursor

Fi

Field name. In this case, Fi cannot be of the same name as the existing fields in cs

xi

Expression, whose computed results are the field values

Options:

@i

Won’t generate a record if the result of expression xi is null (this won’t affect a record with null value in the original table sequence)

Return value:

The original cursor cs

Example:

 

A

 

1

=demo.cursor("select NAME,BIRTHDAY,HIREDATE from Employee")

 

2

=A1.derive(interval@y(BIRTHDAY,HIREDATE):EntryAge, age(HIREDATE):WorkAge)

Add fields EntryAge and WorkAge to the original cursor.

3

=A2.fetch()

4

=file("D:\\txt_files\\data1.txt").cursor@t()

Below is the file data1.txt:

5

=A4.derive@i(SCORE:score_not_null)

If the SCORE value is null, the corresponding record won’t be generated

 

6

=A5.fetch()

Related functions:

cs.new()

T.derive()[337][338]

Description:

Add a composite table’s fields to a table sequence or a cursor according to the latter’s key values.

Syntax:

T.derive(A/cs,x:C,…;wi,...)

Note:

The function adds one or more fields of composite table T to table sequence A or cursor/multicursor cs according to key values of the latter. It returns a table sequence when adding fields to a table sequence; and returns a cursor when adding fields to an ordinary cursor or a multicursor.

Parameters:

T

A composite table

A/cs

A table sequence/cursor/multicursor

x

Field value

C

Column alias;can be absent

wi

Filtering condition; separate multiple conditions, which should be met at the same time, by comma(s).

Return value:

A table sequence/cursor

Example:

 

A

 

1

=file("D:\\emp10.ctx")

 

2

=A1.create()

Open a composite table

3

=demo.query("select  EID from EMPLOYEE").keys(EID)

 

4

=A2.derive

(A3,NAME,GENDER)

Add fields of the composite table to A3’s table sequence by the latter’s key values

5

=demo.query("select  EID from EMPLOYEE").cursor()

 

6

=A2.derive(A5,NAME:NAME,GENDER:GENDER).fetch()

Add fields of the composite table to A5’s cursor by the latter’s key values

7

=file("D:/employees.ctx").create()

Open a composite table

8

=demo.query("select EID,DEPT from employee").keys(EID)

Return a table sequence with EID as the key

9

=A7.derive(A8,NAME:name,GENDER;GENDER=="M")

Add certain fields of A7’s composite table to A8’s table sequecne according to key values; filtering condition over A7 is GENDER=="M"

T.derive(A/cs,x:C,…;wi,…)[339][340]

Description:

Add fields of a cluster composite table to a table sequence/cursor according to the latter’s key values.

Syntax:

T.derive(A/cs,x:C,…;wi,...)

Note:

The function adds one or more fields of composite table T to table sequence A or cursor/multicursor cs according to key values of the latter. It returns a table sequence when adding fields to a table sequence; and returns a cursor when adding fields to an ordinary cursor or a multicursor.

Parameters:

T

A composite table

A/cs

A table sequence/cursor/multicursor

x

Field value

C

Column alias

wi

Filtering condition; separate multiple conditions, which should be met at the same time, by comma(s)

Return value:

A table sequence/cursor

Example:

 

A

 

1

=file@0("emp10.ctx",["192.168.0.118:8281"])

 

2

=A1.create()

Open a composite table

3

=demo.query("select  EID from EMPLOYEE").keys(EID)

 

4

=A2.derive

(A3,NAME,GENDER)

Add fields of the cluster composite table to A3’s table sequence by the latter’s key values

5

=demo.query("select  EID from EMPLOYEE").cursor()

 

6

=A2.derive(A5,NAME:NAME,GENDER:GENDER).fetch()

Add fields of the cluster composite table to A5’s table sequence by the latter’s key values

 

dfx ()[341][342]

Description:

Through esProc JDBC, search for and execute a program file locally. If not found, then search the server.

Syntax:

dfx (…)

Note:

Pass in the parameter … and call the cellset file dfx waiting to be executed. Firstly, locate the cellset file with relative searching path for execution. If not found, then search the server (The server list is configured in raqsoftConfig.xml file). Once the computation is completed in esProc or server, return a sequence composed of members of the result set; if there are multiple result sets, then return a sequence composed of these result sets. dfx (…) can be regarded as the simple notation of call dfx(…), which is executed with st.executeQuery() and returns a result set.

Parameter:

dfx

Cellset file, with relative addressing path or absolute path

Input parameter. Use comma to separate if there are multiple ones. These parameters will be assigned to the parameters specified in the query statement in their order, rather than according to the latter’s names.

Example:

C: \\test.dfx cellset file has the following contents, in which StuId and Class is the cellset parameters.

 

A

1

=connect("demo")

2

=A1.query("select * from SCORES where STUDENTID=? and CLASS=?",StuId,Class)

3

=A2.sum(SCORE)

4

>A1.close()

5

return A3

 

 

 

 

 

 

 

 

Here’s the test code:

public void testDataServer() {

Connection con = null;

java.sql.PreparedStatement st;

try{

Class.forName("com.esproc.jdbc.InternalDriver");

con= DriverManager.getConnection("jdbc:esproc:local://");

// Call the stored procedure in which test is the name of dfx file

st =con.prepareCall("test ?,?");

// Set the first parameter

st.setObject(1,"4");

// Set the second parameter

st.setObject(2,"Class one");

// Execute stored procedure

st.execute();

// Get result set

ResultSet set = st.getResultSet();

// Print results

printRs(set);   

// The following statement gets same result as the above-mentioned calling method has

st =con.prepareCall("test 4,\"Class one\"");

st.execute();

set = st.getResultSet();

printRs(set);

}

catch(Exception e){

System.out.println(e);

}

finally{

// Close the connection

if (con!=null) {

try {

con.close();

}

catch(Exception e) {

System.out.println(e);

}

}

}

}

 

diff()[343][344]

Here’s how to use diff() function.

A.diff()[345][346]

Description:

Generate a new sequence by removing from the first sub-sequence of a sequence the members that exist in the other sub-sequences of the sequence.

Syntax:

A .diff()

Note:

Generally sequence A contains multiple sub-sequences. The function creates a new sequence by getting the difference of A’s first sub-sequence and the other sub-sequences, ensuring that the new sequence doesn’t include any member of the other sub-sequences.

The algorithm is to compute the difference between the first sub-sequence and the second one, then compute the difference between the result and the third sub-sequence, and so on and so forth.

Parameters:

A

A sequence whose members are sequences

Return value:

A new sequence created by performing difference operations on A’s first sub-sequence and the other sub-sequences.

Example:

 

A

 

1

=[[1,2,3,4,5],[3,7,8]].diff()

[1,2,4,5]

2

=[[1,2,3],[3,2],1].diff()

[]

3

=[[1,2,2,3],2].diff()

[1,2,3] remove only one of the duplicate members

4

=demo.query("select top 2 * from EMPLOYEE")

5

=demo.query("select top 1 * from EMPLOYEE")

6

=[A4,A5].diff()

Since A4 and A5 come from different table sequences and have different store addresses, so the same records are regarded as different members

Note:

If the sub-sequences are record sequences, we can judge if they are duplicate by their store addresses.

Related functions:

A.diff(x)

A.union()

A.conj()

A.isect()

A.xunion()

A.diff(x)[347][348]

Description:

Generate a sequence by first performing a certain computation on a given sequence and then removing from the resulting sequence’s first sub-sequence the members that exist in the other sub-sequences.

Syntax:

A.diff(x)

Note:

Generally sequence A contains multiple sub-sequences. The function loops through each sub-sequence of A to compute expression x and get the difference of the resulting sequence’s first sub-sequence and the other sub-sequences, ensuring that the difference result doesn’t include any member of the other sub-sequences.

The algorithm is to compute the difference between the first sub-sequence and the second one, then compute the difference between the result and the third sub-sequence, and so on and so forth.

Parameters:

A

A sequence whose members are sequences

x

An expression that returns a sequence

Return value:

    A sequence

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

2

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

3

=[A1,A2].diff(~.(NAME))

Remove only one of the duplicate members

Related functions:

A.diff()

directory()[349][350]

Here’s how to use directory() function.

directory(path)[351][352]

Description:

List the file name(s) satisfying a wildcard path.

Syntax:

directory(path)

Note:

The function lists file name(s) satisfying wildcard path path, excluding the path names.

Parameters:

path

Wildcard path, * represents 0 or multiple characters, and ? represents a single character

Options:

@d

List the subdirectory of path

@p

Return files with full paths under the directory

@m

Create a directory

@r

Delete a directory, which must be empty

@s

Perform recursive query to get all file names under all subdirectories; mutually exclusive with @m and @r

@c

Make case-insensitive; without it the OS will have a say

Return value:

A sequence

Example:

       

A

 

1

=directory("D://*.txt")

Return the txt file list under the root directory on driver D

2

=directory@d("D://tomcat5")

List the subdirectory under the tomcat5 directory

3

=directory@m("D://test")

Create test folder under the root directory on driver D

4

=directory@r("D://test")

Delete D://test directory, but the test folder must be empty

5

=directory@s("D://tomcat5")

Return a list of files in subdirectories under the tomcat5 directory

6

=directory@p("D://tomcat5")

List full path of files under tomcat5 directory

Related functions:

f. exists()

f. size()

movefile()

dup()[353][354]

Here’s how to use dup() function.

T.dup()[355][356]

Description:

Join up cluster memory table into a local memory table.

Syntax:

T.dup()

Note:

The function joins up cluster memory table T to generate a local memory table.

Parameters:

   T      A cluster memory table

Return value:

   A memory table

Example:

 

A

 

1

=file@n("D:/test0.ctx","169.254.121.62:8281")

Open a duplicate file

2

=A1.create()

Create a duplicate cluster table

3

=A2.attach(table)

Retrieve cluster table table

4

=A3.memory()

Generate a cluster memory table

5

=A4.dup()

Join up the cluster memory table to return a local memory table

T.dup(h)[357][358]

Description:

Copy a local memory table onto nodes to create a duplicate cluster memory table.

Syntax:

T.dup(h)

Note:

The function copies local memory table T onto node or node sequence h to create a duplicate cluster memory table.

Parameters:

T

h

A local memory table

A node or a node sequence

Return value:

   A duplicate cluster memory table

Example:

 

A

 

1

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

 

2

=A1.memory()

Generate a local memory table

3

=A2.dup("169.254.121.62:8281")

Copy the local memory table into a duplicate cluster memory table

 

elapse()[359][360]

Description:

Get the date/time which is a certain time period before or after a given date/time.

Syntax:

elapse(dateExp, n)

dateExp± n           elapse(dateExp, n)

Note:

The function computes the new date which is n days/n months/n years before or after the date dateExp. When getting the same date in last year according to the specified date, if the desired date does not exist, then return the last day of the same month. For example, elapse@m("2009-03-31",-1) returns 2009-02-28.

Parameters:

dateExp

A specified date expression that should return a date or a string of standard date format.

n

An integer expression according to which a date/time n days/years/months/seconds after or before a given date/time is computed, depending on whether n is positive or negative.

Options:

@y

Compute the date which is n years before or after the specified date.

@q

Compute the date which is n quarters before or after the specified date.

@m

Compute the date which is n months before or after the specified date.

@e

If the specified date is the last day of a month, the new date will not be adjusted to the last day of the month to which it belongs. Without the option the new date will be automatically adjusted to the last day of the corresponding month. This option works with @yqm.

@s

Compute the datetime which is n seconds before or after the specified datetime

@ms

Compute the datetime which is n milliseconds before or after the specified datetime; by default the function computes the date which is n days after the specified date.

 

 

Return value:

Datetime

Example:

elapse(datetime("19800227","yyyyMMdd"),5)

1980-03-03 00:00:00

elapse@s(datetime("19800227","yyyyMMdd"),5)

1980-02-27 00:00:05

elapse@ms(datetime("19800227","yyyyMMdd"),5)

1980-02-27 00:00:00

elapse(datetime("19800227","yyyyMMdd"),-3)

1980-02-24 00:00:00

elapse@y(datetime("19800227","yyyyMMdd"),-3)

1977-02-27 00:00:00

elapse@q(datetime("19800227","yyyyMMdd"),-3)

1979-05-27 00:00:00

elapse@m(datetime("19800227","yyyyMMdd"),-3)

1979-11-27 00:00:00

elapse@s(datetime("19800227","yyyyMMdd"),-3)

1980-02-26 23:59:57

elapse@ms(datetime("19800227","yyyyMMdd"),-3)

1980-02-26 23:59:59

datetime("19800227","yyyyMMdd")+5

1980-03-03 00:00:00

datetime("19800227","yyyyMMdd")-5

1980-02-22 00:00:00

elapse@y(datetime("19770228","yyyyMMdd"),3)

1980-02-29 00:00:00

elapse@ey(datetime("19770228","yyyyMMdd"),3)

1980-02-28 00:00:00

elapse@q(datetime("19800229","yyyyMMdd"),1)

1980-05-31 00:00:00

elapse@eq(datetime("19800229","yyyyMMdd"),1)

1980-05-29 00:00:00

elapse@m(datetime("19800229","yyyyMMdd"),5)

1980-07-31 00:00:00

elapse@em(datetime("19800229","yyyyMMdd"),5)

1980-07-29 00:00:00

end s[361][362]

Description:

Log the error message.

Syntax:

end s

Note:

Execute abnormal termination deliberately, throw and log the error message s; Without s, execute normal termination.

Parameters:

s

Error message

Example:

 

A

B

C

 

1

[12,23,45,1,11,21]

=[]

 

B1 is [12,23,45]

2

for A1

 

 

 

3

 

if A2>10

 

 

4

 

 

>B1=B1|A2

 

5

 

Else

 

 

6

 

 

end "small"

Prompt and log an error message "error small" if value in A1 is not greater than 10. Terminate the program normally if no "small" is detected.

enum()[363][364]

Here’s how to use enum() function.

P.enum()[365][366]

Description:

Generate a new record sequence by performing enumeration grouping on an record sequence according to another record sequence.

Syntax:

P.enum(E, y)

Note:

The function generates a new record sequence by grouping the record sequence P according to the record sequence/sequence E.

Parameters:

P

Record sequence to be grouped

E

Record sequence/sequence

y

A field name or an expression in P. y is allowed to be omitted

Options:

@r

Repetitive enum, that is, allocate a certain record of P to multiple groups.

@p

The return value is composed of the sequence numbers of members that exist in P

@n

Group P’s records according to E’s members and return the result groups. In the result set, there is a group to store the unaligned member(s).

Function Keyword:

?

It represents the value of y

Return value:

The new record sequence generated by grouping P

Example:

Ø  E is a sequence

 

A

 

1

=["?<=60","?>=60 && ?<=90","?>=90"]

Use y to replace ? in the group condition when computing

2

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

 

3

=A2.enum(A1,SCORE)

3 groups in total, and a member will not appear in multiple groups

4

=A2.enum@r(A1,SCORE)

3 groups in total; 60 and 90 are allocated to multiple groups

5

=A2.enum@p(A1,SCORE)

3 groups in total; return the sequence numbers of members that exist in A2 by group

6

=["?<=60","?>=60 && ?<=90"]

 

7

=A2.enum@n(A6,SCORE)

3 groups in total, group 1 for those not greater than 60, group 2 for those greater than 60 and not greater than 90, and group 3 for the remaining values.

Note:

p.enum() is mainly used to conduct the enum grouping on a single record sequence. The grouping result is a sequence composed of multiple record sets, and each record set is a group. This sequence is in an order exactly equal to that of E. Therefore, you can retrieve the associated group information from E via the sequence numbers. The group result is not a record sequence, so no new data structure will be generated

Related functions:

E.penum()

env()[367][368]

Description:

Assign value to the global variable.

Syntax:

env(v,x)

Note:

The function assigns value x to the global variable v. With x omitted, the global variable will be deleted.

Parameters:

v

The global variable

x

Variable value

Options:

@j

Set the global variable v as a task variable

Return value:

The variable value or null

Example:

 

A

 

1

=env(arg1,12)

12. Assign 12 to the global variable arg1

2

=env(arg1)

Delete the global variable arg1 as the variable value is omitted

3

=env@j(arg2,3)

Set the global variable arg2 as a task variable

eq()[369][370]

Here’s how to use eq() function.

A.eq(B)[371][372]

Description:

Judge if a given sequence can be generated by adjusting the positions of the members of another sequence.

Syntax:

A.eq(B)

Note:

Judge if sequence A can be generated by changing positions of the members of sequence B.

Parameters:

A

A sequence expression

B

A sequence expression

Return value:

Boolean value.

Example:

 

A

 

1

= [1,2,5]

true

2

=[5,2,1]

 

3

=A1.eq(A2)

true

4

=["a","b","c"]

 

5

=["b","a","c"]

 

6

=A4.eq(A5)

true

7

=[5,2,2]

 

8

=A7.eq(A1)

false

error()[373][374]

Here’s how to use error() function.

db.error()[375][376]

Description:

Obtain the last error information from a database connection.

Syntax:

db.error()

Note:

The function returns the error information corresponding to the previous command related to the database. 0 indicates error free; otherwise, the error code is returned. The error message can only be called one time.

Parameters:

db

Database connection

Options:

@m

Use this option to return information in string.

Example:

 

A

 

1

=file("D://files//student.txt")

Data in the file student.txt is not correct

2

=A1.import@t()

 

3

=connect@e("demo")

Create a connection and auto-control the commit and rollback operations

4

>A3.execute@k(A2,"update STUDENTS2 set NAME=?,GENDER=?,AGE=? where ID=?",NAME,GENDER,AGE,ID)

The transaction is not committed

5

=A3.error@m()

Return the error message corresponding to sql command execution

6

>file("D:\\log.txt").write@a(A5)

Append error message to the log

 

7

>A3.close()

Close the connection

Related functions:

db.close()

connect()

db.commit()

db.rollback()

eval()[377][378]

Description:

Dynamically parse and compute the expression.

Syntax:

eval(StringExp ,{argExp})

Note:

The function parses the expression string StringExp, evaluate it, and return its result. In the expression string, the value of a keyword ? corresponds to the result of evaluating the expression argExp. If there are more than one ?, then there may be more than one argExp. Generally there is a one-to-one correspondence between argExp and ?.

If the number of ? is more than that of argExp, then the extra ? will get assigned starting from the first argExp again.

You can use a number to specify the corresponding parameter for a ?, as in eval( "?2/?1", 3, 6 ), where the first ? corresponds to the second parameter, and the second ? corresponds to the first parameter. Thus the result is 2.

Parameters:

StringExp

An expression string to be calculated

argExp

Parameter expression

Function keyword:

?

Used in StringExp to represent the value of argExp

Return value:

Result of the specified expression whose data type is determined by the expression itself.

Example:

 

A

 

1

="1+3"

 

2

=eval(A1)

4

3

=4

 

4

=eval("?+5",A3)

? is a key word, its value is A3, and the function returns the result of 9

5

=eval("(?+1)/?",3,4)

The first ? is 3, the second ? is 4, and the returned result is 1.0.

6

=eval("(?+?)*?",1,3)

The first ? is 1, the second ? is 3, the third ? is 1 again, the returned result is 4.

7

=eval("?+?",3)

The result is 6 because the number of argExp is less than ?, so argExp will be used repeatedly.

8

=eval("?2/?1",3,6)

The first ? corresponds to the second parameter, the second ? corresponds to the first parameter, so the result is 2.0.

 

es_close ()[379][380]

Description:

   Close REST Client connection.

Syntax:

   es_close(fd)

Note:

The function closes connection to REST Client and release resources.

Parameters:

fd

A REST Client object

Example:

 

A

 

1

=es_open("localhost:9200")

Connect to ES server

2

=es_close(A1)

Close the connection

 

es_delete()[381][382]

Description:

   Execute the delete command and return a boolean value.

Syntax:

   es_delete(fd, endpoint, entityheader)

Note:

  The function executes the delete command and returns true if the deletion action is successful or false if the deletion fails.

Parameters:

fd

A REST Client object

endpoint

Rest API address

entity

A parameter transmitted through http body, which is a JSON string or a block of data in JSON format

header

A variable parameter that passes http header; it is a key type JSON string

Return value

Boolean value

Example:

 

A

 

1

=es_open("localhost:9200","user":"un1234")

Connect to ES server

2

=es_delete(A1,"/accounts/person","user:jacker")

Delete the record where user is jacker under the level where index is accounts and type is person

3

=es_delete(A1,"/student")

Delete the index file where the index is student

 

es_head()[383][384]

Description:

   Execute head command and return a table sequence.

Syntax:

   es_head (fd, endpoint)

Note:

The function checks whether a document or a record exists or not. The response value is 200 OK if the document/record exist; otherwise the response value is 404 Not Found.

Parameters:

fd

A REST Client object

endpoint

The address of to-be-checked document/record

Return value:

A table sequence

Example:

 

A

 

1

=es_open("localhost:9200","user":"un1234")

Connect to ES server

2

=es_head(A1,"/accounts/person/1")

Check whether the record where index is accounts, type is person and id is 1 exists or not

 

es_open()[385][386]

Description:

Connect to Elasticsearch (ES) server in the default http protocol.

Syntax:

    es_open(host,..., user:passwd)

Note:

The function connects to the ES server. Parameters user and passwd can be omitted if there are not username and password.

Options:

@s

The https protocol

Parameters:

host

URL of the ES server, the format is: http(s)://hostname:port, in which http(s) can be omitted; the default is http protocol

user

Username for connectiong to an ES server

passwd

Password for connectiong to an ES server

Return value:

A REST Client object

Example:

 

A

 

1

=es_open("localhost:9200”)

Connect to the ES server whose hostname is localhost and port number is 9200 in the http protocol

2

 

=es_open("http://localhost:9200","user":"un1234")

Connect to the ES server whose hostname is localhost and port number is 9200 in the http protocol; the username is user and password is un1234

3

=es_open@s("https://localhosts:9200","user":"un1234")

Connect to the ES server in https protocol; other parameters are the same as the above

es_get()[387][388]

Description:

   Execute the get command and return a table sequence or a cursor.

Syntax:

   es_get(fd, endpoint, entityheader)

Note:

The function queries data through a get command and by default returns 10 records at most. There is no restriction about the number of returned records when the function queries a cursor or the ES system. If the JSON data in the result set contains multiple _index, they will be fully displayed. Parameter entity can be omitted.

Options:

@c

Query a cursor and by default return all records

@f

Parameter entity can be a file

Parameters:

fd

A REST Client object

endpoint

Rest API address

entity

A parameter transmitted through http body, which is a JSON string or the name of JSON file

header

A variable parameter that passes http header; it is a key type JSON string

Return value:

A table sequence/cursor

Example:

 

A

 

1

=es_open("localhost:9200","user":"un1234")

Connect to ES server

2

=es_get(A1, "/_cat/health")

Display the health data retrieved from ES server by complete values

3

=es_get(A1, "/_cat/health?v")

Display the health data retrieved from ES server by key values

4

=es_get(A1,"/accounts/person/1")

Query the record where index is accounts, type is person and id is 1

5

=es_get@c(A1,"/accounts/person/_search")

Query records where index is accounts and type is person via the cursor

6

=A5.fetch()

Return records fetched from the cursor

7

=es_get(A1,"/person/_mget","{\"ids\":[\"1\",\"2\",\"5\"]}")

Query in /person the records where ids is 1,2 and 5

8

=es_get@f(A1,"/person/_mget","D:/entity_docs_accounts.txt")

Same as the previous

 

Note: Here’s the file entity_docs_accounts.txt:

{"ids" : ["1", "2", "5"]}

 

es_post()[389][390]

Description:

   Execute the post command and return a table sequence or a cursor.

Syntax:

   es_post(fd, endpoint, entityheader)

Note:

The function queries data through the post command and by default returns 10 records at most. If the JSON data in the result set contains multiple _index, they will be fully displayed. Parameter entity can be omitted.

Options:

@c

Query a cursor

@f

Parameter entity can be a file

Parameters:

fd

A REST Client object

endpoint

Rest API address

entity

A parameter transmitted through http body, which is a JSON string or the name of JSON file

header

A variable parameter that passes http header; it is a key type JSON string

Return value:

A table sequence/cursor

Example:

 

A

 

1

=es_open("localhost:9200 ","user":"un1234")

Connect to the ES server

2

=es_post(A1,"/accounts/_search?q=user:kimchy")

Query in the bank index the record where user is kimchy

3

=es_post(A1,"/_all/_search?q=_id:5")

Query the record where _id is 5 across different databases

4

=es_post@c(A1,"/accounts/person/_search")

Query records where index is accounts and type is person via the cursor

5

=A4.fetch()

Return records fetched from the cursor

6

=es_post@f(A1,"/bank/person/_search","D:/entity_post_accounts.txt")

Parameter entity is a file, from which the function queries records where _gender=“F” under /bank/person and sort them

 

Note: Here’s the file entity_post_accounts.txt:
{

   "query" : {

        "match" : { "gender" : "F" }

    },

   "track_scores": true,

    "sort" : [

        { "account_number" : {"order" : "desc"} },

        { "firstname" : "desc" },

        { "lastname" : "desc" }

    ]

}

es_put()[391][392]

Description:

   Execute the put command and return a table sequence.

Syntax:

   es_put(fd, endpoint, entityheader)

Note:

The function executes the put command. Parameter header can be omitted; the REST API address can reach the index, the type or the record.

Options:

@f

Parameter entity can be a file

Parameters:

fd

A REST Client object

endpoint

Rest API address

entity

A parameter transmitted through http body, which is a JSON string or the name of JSON file

header

A variable parameter that passes http header; it is a key type JSON string

Return value:

A table sequence

Example:

 

A

 

1

=es_open("localhost:9200","user":"un1234")

Connect to the ES server

2

=es_put@f(A1, "/shirts", "D: /put_index.txt")

Create an index for records under the shirts index

3

=es_put@f(A1, "/shirts/doc/2", "D:/put_index_record.txt")

Insert a record whose id is 2 under doc type in the newly-created shirts index

 

Note: Here’s the file put_ index.txt:

{

    "mappings": {

        "_doc": {

            "properties": {

                "brand": { "type": "keyword"},

                "color": { "type": "keyword"},

                "model": { "type": "keyword"}

            }

        }

    }

}

 

The file put_shirt_ record.txt:

{

    "brand": "coop",

    "color": "blue",

    "model": "girl"

}

execute()[393][394]

Here’s how to use execute() function.

db.execute()[395][396]

Description:

Execute a SQL statement through a specified database connection.

Syntax:

db.execute(sql {,args …} )

Execute the SQL statement sql in database db. args,… is the parameter of sql, which can also be a sequence consisting of parameter values

db.execute(A, sql {, args,…} )

Execute the SQL statement sql in database db over sequence A. args,… is the parameter of sql. Executions of SQL statements will be committed in BATCHSQL mode, which reduces the frequency of database access. Here args shouldn’t be a a sequence type parameter.

db.execute(cs, sql {, args,…} )

Execute the SQL statement sql in database db over cursor cs. args,… is the parameter of sql. Executions of SQL statements will be committed in BATCHSQL mode, which reduces the frequency of database access. Here args shouldn’t be a a sequence type parameter.

Note:

The function executes a SQL statement sql through the specified database connection. It is generally used to execute the SQL statements that change the records in a database (such as update and insert).

Parameters:

db

Database connection object

sql

A SQL statement in the form of select * from table, for example.

args

An argument value passed into the specified SQL command sql. It can be a constant or an expression. The comma is used to separate multiple arguments.

A

A sequence. the SQL statement is executed on each member of A. Generally args is computed against each member of A and the value is passed to the SQL statement for execution.

cs

A cursor

Options:

@k

After the execution is completed, the transaction won't be committed. by default the transaction will be committed.

@s

No preparation will be done for transaction processing.

Example:

 

A

 

1

=demo.execute("insert into DEPARTMENT (DEPT, MANAGER)values(?,?)","TecSupport",5)

Insert a record into the table

2

=demo.execute("delete from DEPARTMENT where DEPT='TecSupport'")

Delete the records whose DEPT values are ''TecSupport''

3

=demo.execute("update DEPARTMENT set MANAGER = ? where DEPT='Sales'","7")

Modify the MANAGER value of the record whose DEPT value is 'Sales' into 7

4

=[["'TecSupport ",5],[" AppSupport",9]].new(~(1):Dept,~(2): Manager)

5

=demo.execute(A4,"insert into DEPARTMENT (DEPT, MANAGER) values (?,?)", #1,#2)

#1 and #2 stand for the first and second columns respectively in A4

6

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

7

=file("D://data_dept.txt").cursor@t()

Below is data_dept.txt:

8

=demo.execute(A7,"insert into DEPARTMENT (DEPT, MANAGER)values (?,?)", #1,#2)

A7 is a cursor

9

=demo.execute("insert into DEPARTMENT(DEPT, MANAGER) values(?)",["TecSupport",9])

a args is a sequence of parameter values. It is automatically converted into  =demo.execute("insert into DEPARTMENT(DEPT, MANAGER) values(?,?)","TecSupport",9) before execution. Same result as A1’s.

Related functions:

db.query()

db.proc()

exists()[397][398]

Here’s how to use exists() function.

f.exists()[399][400]

Description:

Check if a file exists.

Syntax:

f.exists()

Note:

The function checks if file f exists; return true if it exists, and false if it doesn’t exist.

Parameter:

f

A file

Return value:

   Boolean

Example:

       

A

 

1

=file("D://p1.dfx").exists()

Return true if the file exists

Related functions:

f. date()

f. size()

movefile()

exp()[401][402]

Description:

Compute e to the nth power.

Syntax:

exp(n)

Note:

The function computes en.

Parameters:

n

The exponent

Return value:

Numeric

Example:

       

A

 

1

=exp(4.3)

73.69979369959579

Related functions:

power(x,n)

export()[403][404]

Here’s how to use export() function.

A.export()[405][406]

Description:

Convert a sequence into a string.

Syntax:  

A.export(x:F,…;s)

Note:

The function separates each selected fields x of records in table sequence/record sequence/sequence A with the user-defined separator and returns the result as a string. The name of the resulting field in the string is F. If x isn’t specified, then export all fields. Return a one-field string without a field name if A is a sequence. A serial byte value is stored as an integer.

 If parameters x:F are absent and if A is a sequence of record, then these records should be of same structure.

Parameters:  

A

A table sequence/record sequence/sequence to be exported.

x

Fields to be exported. If omitted, then export all fields of A.

F

Name of the resulting field in the string. If omitted, then use the original field name.

s

User-defined field separator. The default is tab.

Options:  

@t

The column names will be written to the string as the first record.

@c

Use comma as the separator when the parameter s is absent, but the user-defined separator s should take priority when there are both s and @c option.

@j

Export as json string, with s being ignored.

@w

Use Windows-style \r\n line break; by default the line break is specified by the operating system.

@x

Export as XML string, with s being the starting point which can’t be omitted; the slash / is used to separate multiple levels of data.

<xml>

<table>

                          <row>

                                                <F>v</F>

                                                …

                                        </row>

                                …

        </table>

</xml>

@q

Enclose the exported text field values and headers with quotation marks

@o

Use quotation marks as the escape character; need to work with @q. Without it the escape character is the Java-style backslash (\)

Return value:

String.

Example:

 

A

 

1

=demo.query("select EID,NAME from EMPLOYEE")

 

2

=A1.export()

Parameters x, F, and s are omitted.

3

=A1.export(;"|")

Specify the separator as "|".

4

=A1.export@t(EID:id,NAME:name;",")

Specify to-be-exported fields and the separator; make column names the first record and write it at the beginning of the exported string

5

=A1.export@x(NAME;"employee/name")

Convert the table sequence into an XML string, where employee and name are respectively the first level and second level nodes

6

=A1.export@j()

Convert the table sequence into a JSON string and return it

7

[1,23,34,45]

A sequence

8

=A7.export()

9

=A1.export@c()

With @c option, use default separator comma

10

=A1.export@w()

Use Windows-style \r\n line break.

11

=["12\r34","aa\nbb"]

 

12

=A11.export()

13

=A11.export@q()

With @q option, the exported string is enclosed by double quotations

14

=A11.export@qo()

With @o option, use quotations as the escape character

Note:

Format of the string: Separate the records by space, and the fields by the user-defined separator. The default separator is tab.

Related functions:

f.import()

f.export()

f.export(A,x:F,…;s)[407][408]

Description:

Write a sequence/table sequence/record sequence into a file.

Syntax:

f.export( A, x:F,…;s)

Note:

 The function writes sequence/table sequence/record sequence A into file f in the form of text; it will auto-create an f, which is in the text format by default, if the file doesn’t exist (but the path can’t be auto-created). If A contains a serial byte field, the seirial byte values will be written as in the form of integers.

If A is a table sequence or a record sequence, write all fields into the file if parameter x is absent. If the values of a to-be-exported field are referenced records, just write their primary key values into f. The unexportable fields in A can’t be written into f. A one-field file without field name will be generated if A is a sequence and parameter x is absent.

Parameters:

f

A file

A

The record sequence/sequence to be exported

x

The field to be exported. If omitted, all the fields of A that can be textualized will be exported. The sign # is used to represent a field with a sequence number

F

Resulting field name. If omitted, then use the original field name

s

The user-defined separator used in the text file, and the default separator is tab

Options:

@t

Export the first record to the file as the title

@a

Append. By default, overwrite the original file. The option and @t are mutual exclusive. The appended records and the original records should be of the same structure, otherwise error will be reported

@b

Convert into binary file to speed up the processing; does not support parameter s.

@c

Use comma as the separator when parameter s is absent, but the user-defined separator s should take priority when the parameter is present

@z

Force the execution of @b and write the sequence to the binary file f in segment by segment. The sequence won’t be segmented by default. In this option, parameter s, when present, is a grouping expression by which A is ordered; perform data segmentation only when s is changed. This option is often used to export a large amount of data to a binary file in segments with parallel processing and it can make sure that each segment will be wholly exported

@w

Use Windows-style \r\n line break; by default the line break is specified by the operating system

@q

Enclose the exported text field values and headers with quotation marks

@o

Use quotation marks as the escape character; need to work with @q. Without it the escape character is the Java-style slash (\)

Example:

Write a record sequence into a txt file.

 

A

 

 

1

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

 

 

2

=file("D:\\Department.txt").export(A1)

 

3

=file("D:\\Department.txt").export@t(A1)

 

4

=file("D:\\Department2.txt").export(A1;"|")

 

5

=file("D:\\Department2.txt").export(A1;)

 

6

=file("D:\\Department2.txt").export@a(A1)

Still the above example, append the contents from A1 to the contents of the file

 

7

=file("D:\\Department3.txt").export@b(A1)

Export the file content in binary format

 

8

=file("D:\\Department4.txt").export@t(A1,DEPT:Dept1;"|")

If not omitting x, then only export the specified field

 

9

[a,s,d,f]

 

 

10

=file("D:\\myfile.txt").export(A9)

myfile.txt is a one-field file without a field name

 

11

=file("D:\\Department6.txt").export@c(A1)

 

12

=demo.query("select * from EMPLOYEE order by GENDER")

Sort by GENDER

 

13

=file("D:\\EMPLOYEE.btx").export@z(A12,EID,NAME,SURNAME,GENDER,SALARY;GENDER)

Group the file by GENDER and export it to EMPLOYEE.btx

 

14

=file("D:\\EMPLOYEE.txt").export@w(A1)

Use Windows-style \r\n line break

15

=demo.query("select * from DEPARTMENT").keys(MANAGER)

 

16

=A12.switch(DEPT,A15:DEPT)

17

=file("D:\\EMPLOYEE1.txt").export@t(A16)

Values of DEPT field in A16 are referenced records; in this case the primary key of the table sequence need to be exported

18

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

19

=file("D:\\Department7.txt").export(A18,#1)

#1 represents the first column, so only that column of data is exported

20

=file("D:\\Dep1.txt").export@q(A18,#1)

21

=["12\r34","aa\nbb"]

22

=file("D:\\T1.txt").export@q(A21)

23

=file("D:\\T2.txt").export@qo(A21)

Note:

Format of text file: Separate records by carriage return, and fields by the user-defined separator. The default separator is tab. Here records of table sequence/record sequence/sequence A must be of the same data structure.

Related functions:

f.import()

f.export(cs,x:F,…;s)[409][410]

Description:

Retrieve data from a cursor and write it to a text file.

Syntax:

f.export(cs,x:F,…;s)

Note:

The function writes data of cursor cs to the file object f as text. If the file does not exist, create it automatically (Note that the directory path cannot be created automatically).

Option:

@t

Export the first record to the file as the title.

@a

Append. If omitted, then overwrite the original file. The option and @t are mutual exclusive. f and cs must be of the same structure, otherwise error will be reported.

@b

Convert into binary file to speed up the processing. It ignores @t and does not support the parameter s.

@c

Use comma as the separator when the parameter s is absent, but the user-defined separator s should take priority when there are both s and @c option.

@z

Force the execution of @b and write the sequence to the binary file f in segment by segment. The sequence won’t be segmented without this option. With this option, the parameter s is the grouping expression ruling that sequence A is ordered by s, if the parameter exists, and perform the segmentation only when s changes. The binary file is used to export a large sequenece in segments with parallel processing, which will make sure records in each segment won’t be split. 

@w

Use Windows-style \r\n line break; by default the line break is specified by the operating system.

@q

Enclose the exported text field values and headers with quotation marks

@o

Use quotation marks as the escape character; need to work with @q. Without it the escape character is the Java-style slash (\)

Parameters:

f

File object.

cs

Cursor whose data to be exported.

x

Fields to be exported. If omitted, then export all fields in the record sequence A that can be textualized. The sign # is used to represent a field with a sequence number.

F

Resulting field name. If omitted, then use the original field name.

s

User-defined separator; the default is tab.

Example:

Write the cursor data to the text file.

 

A

 

 

1

=demo.cursor("select * from DEPARTMENT")

 

 

2

=file("D:\\Department1.txt").export(A1)

Tab separator.

 

3

=demo.cursor("select * from DEPARTMENT")

 

 

4

=file("D:\\Department2.txt").export(A3;"/")

Specify the separator “/”.

 

5

=demo.cursor("select * from DEPARTMENT")

 

 

6

=file("D:\\Department3.txt").export@t(A5)

Write data to the file with the first record being the title.

 

7

=demo.cursor("select * from DEPARTMENT")

 

 

8

=file("D:\\Department4.txt").export@t(A7,DEPT:Dept1,DEPT:Dept2;"|")

If x is not omitted, then export the specified fields.

 

9

=demo.cursor("select * from DEPARTMENT")

 

 

10

=file("D:\\Department5.txt").export@t(A9,DEPT,MANAGER;"/")

If F is omitted, then use the original field names.

 

11

=demo.cursor("select * from DEPARTMENT")

 

 

12

=file("D:\\Department5.txt").export@a(A11 DEPT,MANAGER;"/")

Still the above examlple, append the contents of A12 to the contents of Department5.txt.

 

13

=demo.cursor("select * from DEPARTMENT")

 

 

14

=file("D:\\Department6.txt").export@b(A13)

Export data as the binary file to get a higher speed.

 

15

=demo.cursor("select * from DEPARTMENT")

 

 

16

=file("D:\\Departmen7.txt").export@c(A15)

Use comma as the separator

 

17

=demo.cursor("select * from EMPLOYEE order by GENDER")

Sort by GENDER.

 

18

=file("D:\\EMPLOYEE1.btx").export@z(A17,EID,NAME,SURNAME,GENDER,SALARY;GENDER)

Export a segmented binary file grouped by GENDER to EMPLOYEE.btx

 

19

=demo.cursor("select * from EMPLOYEE order by GENDER")

 

20

=file("D:\\EMPLOYEE2.txt").export@w(A19)

Use Windows-style \r\n line break.

21

=demo.cursor("select * from DEPARTMENT")

 

22

=file("D:\\Department8.txt").export(A21,#1)

#1 represents the first column, so only that column in the cursor is exported

23

=file("D:\\Dep1.txt").export@q(A21)

Both exported field values and headers in the text file are quoted

24

=["12\r34","aa\nbb"].cursor()

Above is the content of the cursor

25

=file("D:\\Dep2.txt").export@q(A24)

26

=file("D:\\Dep3.txt").export@qo(A24)

Use double quotations as the escape character

Related functions: 

f.export()

 

f@o(…)[411][412]   

Description:

Syntax of complex functions.

Syntax:

f@o(…)  With different function options, a function can implement different functions. The basic format of function options is f@o(…), in which "o" is the option of function f.

Parameters:

f

Function name.

@o

Function option. Different options support different functions, and a same option has similar meaning in different functions.

(...)

The input parameters of a function. The separator of parameters can be colon ":", comma ",", and semicolon ";" and their priorities decrease from left to right just as the order of introducing them.

Faccrint()[413][414]

Description:

The function equals the Excel ACCRINT function.

Syntax:

Faccrint(first_interest,settlement,issue;rate,par)

Note:

The function returns the accrued interest for a security that pays periodic interest. Specify the day count basis method US (NASD) 30/360.

Parameters:

first_interest

The security's first interest date

settlement

The security's settlement date, i.e. the date after the issue date by which a buyer must pay for the security

issue

The issue date of the security

rate

The security's annual coupon rate

par

The security's par value. If omitted, it takes the default value of zero for 100

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Faccrint@2(date("2000-10-1"),date("2000-6-1"),date("2000-1-8"):0.1,2000)

79.44444444444444

Faccrint@1(date("2000-10-1"),date("2000-6-1"),date("2000-1-8"):0.1,2000)

108.2089552238806

Faccrintm()[415][416]

Description:

The function equals the Excel ACCRINTM function.

Syntax:

Faccrintm(maturity,issue;rate,par)

Note:

The function returns the accrued interest for a security that pays interest at maturity, with the day count basis method US (NASD) 30/360.

Parameters:

maturity

The security's maturity date

issue

The security'’s issue date

rate

The security's annual coupon rate

par

The security's par value. If omitted, it takes the default value of zero for 100 yuan

Options

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Faccrintm@1 (date("2001-6-15"),date("2001-4-1"):0.1,1000)

20.54794520547945

fact()[417][418]

Description:

Compute the factorial of the parameter.

Syntax:

fact(nExp)

Note:

The function computes the factorial of nExp.

Parameters:

nExp

Data for which you want to compute the factorial

Return value:

Long integer (64 bit)

Example:

fact(10)

3628800

false[419][420]

Description:

False value – a logical constant.

Syntax:

false

Note:

It can be used directly in the constant cell or expression.

Example:

 

A

B

 

1

=null

 

Assign null to A1

2

=A1==null

 

Judge if A1 is null

3

if A2==false

>a=4

If A2 is false, assign 4 to a

4

else

>a=3

Otherwise assign 3 to a

Related functions:

true

null

Fcoupcd()[421][422]

Description:

The function equals the Excel COUPNCD or COUPNND function.

Syntax:

Fcoupcd(settlement,maturity)

It is equivalent to Excel COUPNCD function and returns the next coupon date after the settlement date for a security. Annually. The day count basis method is US (NASD) 30/360.

Fcoupcd@p(settlement,maturity)

It is equivalent to Excel COUPNND function and returns the previous coupon date before the settlement date for a security. Annually. The day count basis method is US (NASD) 30/360.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fcoupcd@21(date("2007-1-25"),date("2008-11-15"))

2007-05-15

Fcoupcd@p2(date("2008-3-15"),date("2008-11-3"))

2007-11-03

Fcoups()[423][424]

Description:

The function equals the Excel COUPNUN, COUPDAYS, COUPDAYBS or COUPDAYSNC function

Syntax:

Fcoups(settlement,maturity)

It is equivalent to Excel COUPNUM function and  returns the number of coupons payable between a security’s settlement date and maturity date, rounded up to the nearest whole coupon. Annually. The day count basis method is US (NASD) 30/360.

Fcoups@d(settlement,maturity)

It is equivalent to Excel COUPDAYS function and returns the number of days in a coupon period that contains the settlement date. Annually. The day count basis method is US (NASD) 30/360.

Fcoups@b(settlement,maturity)

It is equivalent to Excel COUPDAYBS function and returns the number of days from the beginning of a coupon's period to the settlement date. Annually. The day count basis method is US (NASD) 30/360.

Fcoups@n(settlement,maturity)

It is equivalent to Excel COUPDAYSNC function and returns the number of days from the settlement date to the next coupon date. Annually. The day count basis method is US (NASD) 30/360.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fcoups@2(date("2008-3-15"),date("2008-11-3"))

2

Fcoups@d2(date("2008-3-15"),date("2008-11-3"))

180.0

Fcoups@b1(date("2008-3-15"),date("2008-11-3"))

133.0

Fcoups@n(date("2008-3-15"),date("2008-11-3"))

228.0

Fdb()[425][426]

Description:

The function equals the Excel DB function.

Syntax:

Fdb(cost,salvage,life,period,month)

Note:

The function calculates the depreciation of an asset for a specified period, using the fixed-declining balance method.

Parameters:

cost

The initial cost of the asset

salvage

The value of the asset at the end of the depreciation (asset residual value)

life

The number of periods over which the asset is to be depreciated (expected useful life of the asset)

period

The period number for which you want to calculate the depreciation (it must has the same unit with life)

month

The number of the months used in the calculation of the first year of depreciation. If omitted, it takes the value of 12 by default.

Example:

Fdb(500000,100000,3,1,6)

103799.11308935669

Fddb()[427][428]

Description:

The function equals the Excel DDB function.

Syntax:

Fddb(cost,salvage,life,period,factor)

Note:

The function calculates the depreciation of an asset for a specified period, using the double-declining balance method, or some other user-defined method. Parameters should all be positive numbers.

Parameters:

cost

The initial cost of the asset

salvage

The value of the asset at the end of the depreciation (asset residual value)

life

The number of periods over which the asset is to be depreciated (expected useful life of the asset)

period

The period number for which you want to calculate the depreciation (It must has the same unit with life)

factor

The rate of balance declining. If omitted, it takes on the default value of 2 (specifying the double-declining balance method)

Example:

Fddb(100000,10000,3650,1)

54.794520547945204

Fdisc()[429][430]

Description:

The function equals the Excel DISC function.

Syntax:

Fdisc (settlement,maturity;pr,redemption)

Note:

The function calculates the discount rate for a security with the day count basis method US (NASD) 30/360.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

pr

The security's price

redemption

The security's redemption value

Options

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fdisc@0(date("2001-2-15"),date("2001-6-10"),97.975,100)

0.06339130434782626

Fduration()[431][432]

Description:

The function equals the Excel DURATION function.

Syntax:

Fduration (settlement,maturity;coupon,yld)

Note:

The function returns the modified duration of a security that pays periodic interest with an assumed par value of 100. The duration is the weighted average of the present value of the cash flows and is used to measure the sensitivity of the price of the security to the interest rates. Annually. The day count basis method is US (NASD) 30/360.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

coupon

The security's annual coupon rate

yld

The security's annual yield

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fduration@21(date("2008-1-1"),date("2016-1-1"),0.08,0.09)

5.993774955545178

fetch()[433][434]

Here’s how to use fetch() function.

cs.fetch()[435][436]

Description:

Fetch one or more records from a cursor/distributed cursor.

Syntax:

cs.fetch(n;x)

Note:

Using a cursor, the function fetches n records, or fetches records continuously till the value of expression x (Here x doesn’t return a boolean value) changes or becomes true (Here x returns a boolean value), and then returns them as a sequence/record sequence/table sequence or returns null if the cursor has already been fetched out. It is often used to retrieve a large amount of data in batches. When both n and x are omitted, the function returns all records in a cursor and then closes the cursor. Only one of the parameters n and x is valid.

Parameters:

cs

A cursor/distributed cursor

n

An integer

x

Grouping expression, according to which cs is sorted. With x, n will be ignored

Options:

@0

Won’t actually fetched out the selected data from the cursor. The option enables an action functionally equivalent to copying the data; it doesn’t support parameter x.

@x

Close the cursor after data is fetched.

@o

Return a table sequence

Return value:

         A sequence/record sequence/table sequence

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

Return a cursor of retrieved data sorted by SALARY.

2

=A1.fetch@0(3)

Select top 3 highest-paid employees.

3

=A1.derive(interval@y(BIRTHDAY,HIREDATE):EntryAge, age(HIREDATE):WorkAge)

IMG_256

With @0 option used in A2, A3 fetches data from a complete cursor

4

=A1.fetch()

 

5

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

 

6

=A1.fetch(;SALARY)

Stop data retrieval when SALARY change to select a group of highest- and equally-paid employees..

7

=A1.fetch()

Return the remaining records in the cursor.

8

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

 

9

=A5.fetch@x(3)

Close the cursor after data is fetched.

10

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

 

11

=A7.fetch(3;SALARY==13000)

Stop data retrieval when the value of the expression is true

 

 

A

 

1

[192.168.0.110:8281,192.168.18.143:8281]

Nodes

2

=file@0("emp.ctx", A1)

emp.ctx is a distributed file across the nodes; node 192.168.0.110 holds a part where EID is from 1 to 250 and node 192.168.18.143 holds another part where EID is from 251 to 500

3

=A2.create()

Open a distributed composite table

4

=A3.cursor()

Return a distributed cursor

5

=A4.fetch()

Fetch records form the distributed cursor

Related functions:

db.cursor()

cs.skip()

ch.fetch()[437][438]

Description:

Fetch and store the existing data in a channel.

Syntax:

ch.fetch()

Note:

The function fetches and stores the existing data in channel ch. It is a set function.

Parameters:

ch

Channel

Return value:

Channel

Example:

 

A

 

1

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

 

2

=channel()

Create a channel

3

=A2.select(ORDERID>100)

Attach ch.select() operation to the channel

4

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

5

=A1.push(A2)

Push data in A1’s sequence into the channel

6

=A2.result()

Get the result of performing the operation from the channel

mcs.fetch()[439][440]

Description:

Get records from a multicursor.

Syntax:

mcs.fetch()

Note:

The function gets all records from a multicursor, which is similar to record fetching from an ordinary cursor. The order of the resulting records could be different from their orginal order.

Parameters:

mcs

Multicursor

Return value:

Record sequence

Example:

 

A

 

1

=file("D:/txt_files/orders.txt").cursor@m()

Return a multicursor

2

=A1.fetch()

Fetch records from a multicursor

3

=file("D://tb1.txt").import()

tb1.txt contains 10w rows

4

=A3.cursor()

Generate an ordinary cursor

5

=A4.fetch(15000)

Fetch the first 15000 rows

6

=A3.cursor@m(10)

Generate a multicursor

7

=A6.fetch(15000)

Fetch the first 15000 rows

Here the fetched records are different from those in A5. With a multicursor, data is fetched from each cursor and then unioned; while with an ordinary cursor, data is sequentially fetched

field()[441][442]

Here’s how to use field() function.

r.field(F)[443][444]

Description:

Get the value of a specified field in a record.

Syntax:

r.field(F)

Note:

The function gets value of the Fth field in record r, or value of string parameter F. Count backward if F<0. Return null if F exceeds the boundary number of the fields or it does not exist.

Parameters:

r

A record

F

Sequence number of a field, or the string parameter in which a variable can be used to reference the field name.

Return value:

The field value

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE")(1).field(2)

Return the second field value of the first record in table sequence demo.query ("select * from EMPLOYEE")

2

=demo.query("select * from EMPLOYEE")(1).field(-2)

Return the second-to-last field value in the first record of the table sequence demo.query ("select * from EMPLOYEE")

3

=demo.query("select * from EMPLOYEE")(1).field(arg1)

SALARY is the value of variable arg1

4

=demo.query("select * from EMPLOYEE")(1).field(“SALARY”)

 

 

Related functions:

A.field(F)

A.field(F,x)

r.field(F,x)

r.field(F,x)[445][446]

Description:

Modify a value of the specified field of a record.

Syntax:

r. field(F,x)

Note:

The function modifies the value of the Fth field of record r, or the value of string parameter F, into x. Count backward if F<0. Do not execute if F exceeds the boundary number of the fields or it does not exist.

Parameters:

r

Record

F

Sequence number of a field, or the string parameter in which a variable can be used to reference the field name.

x

Expression whose computing result is the value of the Fth field, or the value of the string parameter F.

Return value:

None

Example:

 

A

 

1

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

2

=A1(1).field(2,"Admin1")

Change the value of the 2nd field of the record 1 to Admin1

3

=A1(1).field(-1,10000)

Modify the value of record 1’s last field into 10,000

4

>arg1="SURNAME"

 

5

=A1(1).field(arg1,"Lily")

Modify the value of record 1’s SURNAME field into Lily

Related functions:

A.field(F)

A.field(F,x)

r.field(F)

A.field(F)[447][448]

Description:

Get the values of a specified field of a sequence.

Syntax:

A.field(F)

Note:

The function loops through parameter A to get the value of the Fth field from each record, or the value of every string parameter F, and returns a sequence consisting of these values. Count backward if F<0. Return null if F exceeds the boundary number of the fields or it does not exist.

Parameters:

A

A sequence

F

The sequence number of a field, or the string parameter in which a variable can be used to reference the field name.

Return value:

A sequence

Example:

 

A

 

1

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

 

2

=A1.field(2)

Return a sequence composed of values of the second field.

3

=A1.field(-2)

Return a sequence comprising values of the second-to-last field

4

=A1.field("NAME")

Return a sequence composed of values of NAME field

5

>arg1="NAME"

 

6

=A1.field(arg1)

Same as A4

Related functions:

r.field(F)

r.field(F,x)

A.field(F,x)

A.field(F,x)[449][450]

Description:

Modify the value of a specified field in a sequence.

Syntax:

A. field(F,x)

Note:

The function assigns members of sequence x sequentialy to values of Fth field in sequence A, or values of string parameter F. Count backward if F<0. Do not execute if F exceeds the boundary number of the fields or it does not exist.

Parameters:

A

A sequence

F

Sequence number of a field, or the string parameter in which a variable can be used to reference the field name.

x

A sequence whose length is equal to the number of values in Fth field, or a single value, which can be considered as a sequence in which members have the same value and their number is equal to the number of values in Fth field.

Return value:

None

Example:  

 

A

 

1

=demo.query("select top 3 * from EMPLOYEE")

 

2

=A1.field(9,8000)

Modify the value of the ninth field; parameter x is a single value, and it will be regarded as the sequence [8000,8000,8000]

Here’s A1’s result:

3

=A1.field("SALARY",7000)

Modify all values of SALARY field into 7000

4

>arg1="SALARY"

 

5

=A1.field(arg1,7000)

Same as A3

6

=A1.field(9,[8000,6500,9000])

Here parameter x is a sequence, and this is A1’s result:

Related functions:

r.field(F)

A.field(F)

r.field(F,x)

file()[451][452]

Here’s how to use file() function.

file(fn:cs)[453][454]

Description:

Open a file with the specified name.

Syntax:

file( fn{:cs})

Note:

The function opens a file named fn.

Parameters:

fn

Name of the file to load. Both the absolute path and the relative path are acceptable. If using the relative path, then it is relative to the main path, which is the one configured on the option menu of esProc, and which by default is the current directory (the directory holding the dfx file )

cs

Character set, which supports jvm's built-in character set and which by default is the default value set by OS

Options:

@s

Search the file names on the non-absolute paths in a specified order: Class path -> Search path-> Main path. The search path is the one configured on the option menu of esProc, and the default main path is the current directory. With this option, the function returns the name of a read-only file.

@t

Generate a temporary file under the directory of fn file. Without the fn file, create the temporary file under a tempory directory (a temporary directory is relative to the main directory set in Tool -> Options -> Environment) in Tool -> Options -> Environment or in a relative path.

@a

Make the write action wait when sharing violation happens

Return value:

A file object.

Example:

file("D:/Area.txt":"UTF-8")

Load the Area.txt file from the directory "D:\"; character set is UTF-8.

file("Area.txt")

Load the Area.txt file under the main path.

file@s("data/ Area.txt")

Search the class path first; if not found, then search throughout the list of search paths; lastly, search the main path if not found in the search paths.

file@t("data/Area.txt")

Create a temporary file under the directory data/

file([fni,…]:cs)[455][456]

Description:

Open a specified filegroup.

Syntax:

file( [fni,…]:cs)

Note:

The function opens a filegroup with the specified name fni….

Parameters:

fni

 

A to-be-loaded filegroup, which can be specified by an absolute path or a relative path; multiple filegroups are allowed. A relative path is relative to the main directory configured in the Options window; the default main directory is the currently open one (the one holding the corresponding dfx file)

cs

Charaset, which is a default one your JVM is using; use one defined by the OS if the parameter is absent

Return value:

File object

Example:

=file(["D:/tmp2.txt","tmp.txt"]:"UTF-8")

Load the filegroup of tmp2.txt and tmp.txt under D:\ directory; the charaset is UTF-8

=file(["tmp2.txt","tmp.txt"]:"UTF-8")

Load the filegroup of tmp2.txt and tmp.txt under the main directory; the charaset is UTF-8

file(fn,h)[457][458]

Description:

Generate a cluster file from a remote composite table file.

Syntax:

file(fn,h)

Note:

The function accesses a remote composite table file fn through a node/node sequence h and generates a cluster file according to fn. Return a remote file when no option is used and parameter h is the node sequence; in this case, it is equivalent to the file(fn:z,h) function.

Parameters:

fn

A composite table file

h

A node or a node sequence

Options:

@z

Get the fn file from partition 1 on h(1), partition 2 on h(2), and so on according to the node sequence to generate a distributed file

@w

Allow the absence of parameter fn; used to generate a writable distributed file

@n

Get the fn file directly by name, instead of searching partitions; the option generates a duplicate file, but generates a distributed file if @z option is also present

@0

Get the fn file from partition 0 to generate a duplicated file; generate a distributed file if @z option is also present

@t

Can retrieve data from one set of nodes to generate a temporary file; doesn’t support a file group

Return value:

A cluster file

Example:

 

A

 

1

=file@0("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Read the composite table file emp1.ctx from partition 0 on the node "192.168.0.116:8281","192.168.0.129:8281" to generate a duplicate cluster file

2

=file@z("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Read the composite table file emp1.ctx from partition 1 on node "192.168.0.116:8281" and partition 2 on node "192.168.0.129:8281" to generate a distributed cluster file

3

=file@n("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Read the composite table file emp1.ctx from the main directories of nodes "192.168.0.116:8281" and "192.168.0.129:8281" to generate a duplicate cluster file

4

=file@n("D:/file/emp2.ctx", ["192.168.0.116:8281","192.168.0.129:8281"])

Retrieve composite table file D:/file/emp2.ctx from nodes

"192.168.0.116:8281" and "192.168.0.129:8281" to generate a duplicate cluster file

5

=file@zw(“emp2.ctx”,[“192.168.0.131:8281”])

Create a writable distributed composite table file emp2.ctx in partition 1 on the node "192.168.0.131"

6

=file@t("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Retrieve composite table file emp1.ctx from nodes "192.168.0.116:8281" and "192.168.0.129:8281" to geneate a temporary file

file(fn:z,h)[459][460]

Description:

Open a remote file with a specified name.

Syntax:  

file(fn:z,h)

Note:  

When parameter h is the sequence of the nodes’ main processes, the function finds file fn, which is read-only, in partition z on a certain node in h. The search will first performed on the local machine, and then on the idle remote machines if fn can’t be found locally. If h is a single value, find fn on h; the remote fn can be written. Find the file under the main directory on the node if parameter z is absent.

Parameters:  

 

fn

Name of the file to be loaded. Both the absolute path and the relative path are acceptable. With a relative path, it is relative to the main path. The main path on the IDE is the one configured on the option menu of esProc, and by default it is the current directory. The main path on a server is the value of mainPath in the configuration file raqsoftConfig.xml; this value shouldn’t be null

Z

h

Partition name

A sequence of nodes

 

Options:

@t

Perform read and write operations in the temporary directoy on the target node, with z ignored.

Return value:  

File object.

Example:

file("D:\\Scores.txt","192.168.0.20:9282")

Load the file “Scores.txt” from the D:\ of the local machine; character set is UTF-8

file("Scores.txt","192.168.0.20:9282")

Firstly, load the Scores.txt file under the main path of the local machine

file("Scores1.txt":0, “192.168.0.20:9282”)

 

 

 

            

If Scores1.txt is not found locally, then load the file in partition 0 on server "192.168.0.20:9282"

 

filename()[461][462]

Description:

Split up the full path and get the file name and extension.

Syntax:

filename(fn)

Note:

The function splits the file name and extension from the full path fn.

Parameter:

fn

The full path with the file name

Options:

@e

Only split the extension part from the full path

@n

Split out the file name without the extension

@d

Split out the directory under which the file is located, inclusive of address string

@p

Add the main path before the file name of the non-absolute path. Return the main path directly if fn is ""

Example:

 

A

 

1

=filename("D://file/test.dfx")

Output “test.dfx

2

=filename@e("D://file/test.dfx")

Output “dfx

3

=filename@n("D://file/test.dfx")

Output “test

4

=filename@d("D://file/test.dfx")

Output “D://file

5

=filename@p("p2.txt")

Output

“D:\Program Files\raqsoft\esProc\demo\p2.txt”

6

=filename@p("")

Output

“D:\Program Files\raqsoft\esProc\demo”

Related functions:

file()

fill()[463][464]

Description:

Create a new string by concatenating strings together.

Syntax:

fill(s,n)

Note:

Get a new string by concatenating n strings together

Parameters:

s

Source strings for making up a new string

n

Number of source strings that constitute the new string

Return value:

String

Example:

fill("1 ",10)

"1 1 1 1 1 1 1 1 1 1 "

fill("a b",10)

"a ba ba ba ba ba ba ba ba ba b"

find()[465][466]

Here’s how to use find() function.

A.find()[467][468]

Description:

Find a record according to its primary key value.

Syntax:

A.find(k

Note:

 The function finds records from a record sequence/table sequence whose primary key values are k. Use the index table if there is one.

Parameters:

A

A record sequence/table sequence

k

Primary key, which will be written as a sequence if it is a multi-field primary key.

Options:

@b

Enable the binary search. Here, A must be ordered by the primary key; otherwise, the result will be wrong. The index table will be ignored.

@k

Return members of A matching the sequence of key values specified by parameter k

Return value:

Records

Example:

 

A

 

1

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

2

=A1.keys(NAME,DEPT)

 

3

=A1.find(["Alexis","Sales"])

A sequence is used since the key contains two fields

4

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

This table sequence is ordered by the EID field

5

=A4.keys(EID)

 

6

=A4.find@b(3)

 

@b is used to enable the binary search in order to speed up the computation

7

=A4.find@k(2,15,69,220)

With @k option, the function returns members matching the specified key values

Related functions:

A.pfind()

T.find(k,…)[469][470]

Description:

Find the record(s) according to the specified primary key value(s) from a memory table.

Syntax:

T.find(k,…)

Note:

The function finds records where the primary key value is k from memory table T.Use binary search if there isn’t an index.

 

Parameters:

T

A memory table

k

The primary key; write multiple keys as a sequence

Options:

@k

Find multiple records according to multiple primay keys and return them as a record sequence; write multiple primary keys in the format of [[k1,k2],[...],...]

Return value:

A record/record sequence

Example:

 

A

 

1

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

Return a cursor

2

=A1.memory()

Return a memory table

3

=A2.keys(EID,NAME)

Set EID and NAME as the keys of the memory table

4

=A2.find([8,"Megan"])

The two primary keys are written as a sequence

5

=A2.keys(EID,GENDER)

Set EID and GENDER as the keys of the memory table

6

=A2.find@k([[8,"F"],[2,"F"]])

Use @k option to find multiple records

7

=A2.keys(EID)

Set EID as the key of the memory table

8

=A2.find(3)

Find the record where EID is 3

T.find(k;x:C,..)[471][472]

Description:

Find the record(s) according to the specified primary key value(s) from a base table.

Syntax:

T.find(k;x:C,..)

Note:

The function finds the record(s) where key value(s) is k and returns a record/record sequence containing one field C. The key value k can be represented by the first dimension value which can uniquely identify a record.

Parameters:

T

Base table

k

The primary key; write multiple keys as a sequence

x

Column name; retrieve all field if omitted

C

Column alias; can be omitted

Options:

@k

Find multiple records according to multiple primay keys and return them as a record sequence; write multiple primary keys in the format of [[k1,k2],[...],...]

Return value:

A record/record sequence

Example:

 

A

 

1

=file("E:/find1.ctx")

Return a cursor

2

=A1.create()

Open a composite table’s base table whose dimensions are EID and NAME

3

=A2.find([8,"Megan"])

Since parameter x is absent, the function returns all columns

4

=A2.find([8,"Megan"];EID,SALARY)

Return specified columns

5

=A2.find@k([[4,"Emily"], [8,"Megan"]];EID,SALARY)

Find multiple records with @k option

 

Fintrate()[473][474]

Description:

The function equals the Excel INTRATE function.

Syntax:

Fintrate (settlement,maturity;investment,redemption)

Note:

The function returns the interest rate for a security that pays interest at maturity, with the day count basis method as US (NASD) 30/360.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

investment

The initial amount invested into the security

redemption

The security's redemption value

Options

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fintrate@0(date("2001-2-15"),date("2001-5-15");1000000,1014420)

0.058328089887640454

Firr()[475][476]

Description

The function equals the Excel IRR function.

Syntax

Firr(values,guess)

Note

The function calculates the internal rate of return for a series of cash flows represented by numeric values. The internal rate of return is the rate that makes the net present value from a particular investment equal to zero, that is, the current value of the returns received from the investment happens to be equal to the the investment cost.

Parameters

values

A sequence containing the values of a series of cash flows used to calculate the internal rate of return. It must contain at least one periodic payment (negative value) and at least one periodic income (positive value).

guess

An estimated value for IRR function’s calculation. If omitted, it will take on the default value of 0.1

Example

Firr([-70000,12000,15000,18000,21000])

-0.02124484827331908

Firr([-70000,12000,15000,18000,21000,26000])

0.08663094803666999

Firr([-70000,12000,15000,18000,21000,26000],-0.1)

0.08663094803655035

float()[477][478]

Description:

Convert a string or a number into a 64-bit double-precision floating-point number.

Syntax:

float(stringExp)

float(numberExp)

Note:

stringExp should be a string that consists of a number which has 64 bits or less than. For a value of more than 64 bits, the result of float(stringExp) is imprecise.

numberExp should be a numeric value which has 64 bits or less. For a value of more than 64 bits, the result of float(numberExp) is imprecise.

Parameters:

stringExp

The string expression you want to convert as a double-precision floating-point number.

numberExp

The number you want to convert as a double-precision floating-point number.

Return value:

A 64-bit double-precision floating-point number

Example:

float("1234567")

1234567.0

float(1234567)

1234567.0

Related functions:

decimal()

int()

long()

number()

string()

floor()[479][480]

Description:

Truncate data at the specified position and reject all the remaining part if any.

Syntax:

floor(numberExp, {nExp})

Note:

The function truncates data numberExp at the specified position nExp and rejects all the remaining part if any.

Parameters:

numberExp

Data to be truncated

nExp

An integer to specify the position from which data is to be truncated; taken as 0 when it is omitted

>0: Move the decimal point to the right for nExp places

<0: Move the decimal point to the left for nExp places

=0: Indicate the current decimal place.

Return value:

Numeric type

Example:

floor(3451231.234,0)

3451231.0

floor(3451231.234,-1)

3451230.0

floor(3451231.234,-2)

3451200.0

floor(3451231.234,1)

3451231.2

floor(3451231.234,2)

3451231.23

Related functions:

ceil()

round()

Fmirr()[481][482]

Description:

The function equals the Excel MIRR function.

Syntax:

Fmirr(values,finance_rate,reinvest_rate)

Note:

The function returns the modified internal rate of return for a series of periodic cash flows, taking into consideration the cost of the investment and the interest on the reinvestment of cash.

Parameters:

values

A sequence containing the values of payment (negative value) and income (positive value) at each of the regular periods . At least one negative value and at least one positive value must be contained.

finance_rate

The interest rate paid on the money invested.

reinvest_rate

The interest rate paid on the reinvested cash which is the net income from the regular periods.

Example:

Fmirr([-120000,39000,30000,21000,37000,46000],0.1,0.12)

0.1260941303659051

fname()[483][484]

Here’s how to use fname() function.

T.fname(i)[485][486]

Description:

Get the names of fields of the table sequence according to the serial numbers of these fields.

Syntax:

T. fname(i)

Note:

The function gets the name of the field whose serial number is i from table sequence T. Return all field names in T If no parameter is present.

Parameters:

T

Table sequence

i

Serial number of a field.

Return value:

A string or a sequence

Example:

 

A

 

1

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

 

2

=A1.fname(2)

“NAME”, the name of the 2nd field is NAME.

3

=A1.fname()

Return a sequence comprising all field names in A1.

 

Related functions:

r.fname()

r.fname(i)[487][488]

Description:

Get the field names from records according to the serial numbers of these fields.

Syntax:

r. fname(i)

Note:

The function gets the name of the field whose serial number is i from record r. If no parameter is present, then return all field names in r.

Parameters:

r

Record

i

Serial number of a field

Return value:

Character strings or sequences

Example:

 

A

 

1

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

 

2

=A1(1).fname(2)

“NAME”, the name of the 2nd field in the first record is NAME..

3

=A1(1).fname()

Return a sequence comprising all field names of the 1st record in A1

 

Related functions:

T.fname()

fno()[489][490]

Here’s how to use fno() function.

T.fno(F)[491][492]

Description:

Get the serial number of a field in a table sequence.

Syntax:

T.fno(F)

Note:

The function gets the serial number of field F in T. If there is no parameter, the number of fields in T will be returned; if the specified field cannot be found, a null value will be returned.

Parameters:

T

Table sequence

F

Field name

Return value:

The serial number of field F in T

Example:

 

A

 

1

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

 

2

=A1.fno(EID)

1, which indicates that the serial number of field "EID" is 1

3

=A1.fno()

9, which indicates that there are 9 fields in the table sequence

Related functions:

r.fno()

r.fno(F)[493][494]

Description:

Get the serial number of a field of a record in a table sequence.

Syntax:

r.fno(F)

Note:

The function gets the serial number of field F of record r in the table sequence; if there is no parameter, return the number of fields in the table sequence in which r locates. If the field cannot be found, a null value will be returned.

Parameters:

r

A record

F

Field name

Return value:

The serial number of a field

Example:

 

A

 

1

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

 

2

=A1(2).fno(EID)

1, which indicates that the serial number of the field "EID" is 1

3

=A1(2).fno()

9, which indicates that there are 9 fields in the table "Employee"

Related functions:

T.fno()

Fnper()[495][496]

Description:

The function equals the Excel NPER function.

Syntax:

Fnper(rate,pmt,pv,fv)

Note:

The function returns the number of periods required to pay off a loan according to a specified periodic payment.

Parameters:

rate

The interest rate per period; it is a fixed value.

pmt

The amount paid per period, which keeps unchanged during the whole period of paying off the loan. To omit it, pv must exist.

pv

The present value of the loan, known as the principal.That is the money that already exist when the payment for an investment (or a loan) begins, or the total amount of present values of a series of future payments.

fv

The future value of the loan, or the cash balance you hope to achieve after the final payment. If omitted, its value will be assumed as zero (for example the future value of a loan can be zero).

Options

@t

Indicating the payment type, it corresponds to Excel type parameter. If using the option, choose type 1; if not, choose type 0.

Example:

Fnper(0.06/12,-1200,150000)

196.65585756847307

Fnpv()[497][498]

Description:

The function equals the Excel NPV function.

Syntax:

Fnpv(rate,values)

Equivalent to Excel NPV function

Fnpv(rate,values,dates)

Equivalent to Excel XNPV function

Note:

The function returns the net present value of an investment, based on the discount rate and a series of future payments (negative value) and income (positive value). The net present value is the difference between the present value of future cash inflows and outflows from an investment and the amount of investment.

Parameters:

rate

The discount rate over one period (which is equal to inflation rate and the rate of competitive investment); it is a fixed value.

values

A sequence of values representing payments and incomes that must occur at regular time interval and at the end of each period.

dates

A sequence of dates corresponding to the array of cash payments. The first date of payment denotes the beginning of the payments for the investment.

Example:

Fnpv(0.11,[-10000,3000,5000,6000])

1034.2010420979072

Fnpv(0.11,[-10000,3000,5000,6000],[date("2008-01-01"),date("2008-05-23"),date("2009-03-10"),date("2009-5-15")])

2497.061973416109

for[499][500]

Here’s how to use for statement.

for a,b,s[501][502]

Description:

Execute a loop according to the specified scope and step.

Syntax:

for  a,b,s

Note:

The statement executes the code block in loops from a to b with a step of s.

Parameters:

a

An integer

b

An integer

s

An integer to indicate the step. Its value is 1 by default.

Example:

 

A

B

 

1

 

 

Save the cumulative total -18 - in A1.

2

for 1,11,5

 

 

3

 

>A1=A1+A2

Add up integers within the scope from 1 to 11 with a step of 5, i.e. every 4 integers.

 

 

for cs,n;x[503][504]

Description:

Loop through a cursor.

Syntax:

for cs,n;x

Note:

The statement retrieves n records from the cursor and returns or retrieves records till x… has changed. Close the cursor once the retrieval is completed. This function is often used to fetch a large volume of records by group. Return all the remaining records and close the cursor when omitting n and x.

Parameters:

cs

Cursor

n

Number of records

x

Grouping expression, and cs is sorted by x. With x, n can be ignored.

Example:

 

A

B

 

1

=demo.cursor("select * from EMPLOYEE order by SALARY desc")

=[]

 

2

for A1,10;SALARY

 

 

3

 

>B1.insert(0,A2)

Loop through the cursor, selecting records with the same SALARY value and inserting them into B1.

for x[505][506]

Description:

Start a loop.

Syntax:

for  x

Note:

The statement starts a loop executing the code block.

Parameter:

x

A sequence, an integer, or a logic expression. Loop through the code block against x or to(x), or if x is true. If x is empty, then the loop will be endless.

Example:

x is an integer:

 

A

B

 

1

 

 

Save the cumulative total 55 in A1

2

for 10

 

 

3

 

>A1=A1+A2

Add up the integers from 1 to 10

 

x is empty:

 

A

B

C

 

1

=0

 

 

5050

2

for

 

 

Loop will be endless if x is empty. When the loop count reaches 100, then break the loop

3

 

>A1=A1+#A2

 

 

4

 

if #A2==100

break

 

x is a boolean expression:

 

A

B

 

1

=15

 

 

2

for A1>10

 

If A1 >10, then start a loop through the code block; otherwise, quit the loop

3

 

>B1=B1+#A2

4

 

>A1=A1-1

 

 

x is a sequence:

 

A

B

 

1

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

0

Get the oldest age among all Texas employees in B1 after the loop is over

2

=A1.select(STATE=="Texas")

 

 

3

for A2

=age(A3.BIRTHDAY)

A3 performs loop over each Texas employee while computing their age

4

 

>B1=max(B1,B3)

The oldest age is stored in B1

fork[507][508]

Here’s how to use fork statment.

fork Ai,…[509][510]

Description:

Use multithreads to execute the code block in a cellset.

Syntax:

fork  Ai,

Note:

Ai is a sequence parameter, whose length determines the number of parallel threads. The statement makes multiple duplicates of the current cellset and its context to execute them respectively using multiple threads. A sequence parameter will be separated to have its members respectively used as the value of current cell for the execution of each thread; and a single-value parameter will be duplicated to be distributed to each thread. The result of return statement in the code block will be used in the form of a sequence as the cell value of the main program to call the subroutine.

Parameters:

Ai

A sequence

Example:

1)      Single parameter

 

A

B

1

fork [[1,20,6,14,5],[32,8]]

//return the result of executing result statement of multithreads

2

 

=connect("demo")

3

 

=B2.query("select * from EMPLOYEE where EID in (?) ",A1)

4

 

=B2.close()

5

 

return B3

 

2)      Multiple parameters

 

A

B

1

fork [[1,20,6,14,5],[32,8]],"F"

//return the results of executing result statement of multithreads

2

 

=connect("demo")

3

 

=B2.query("select * from EMPLOYEE where EID in (?) and GENDER=?",A1(1),A1(2))

4

 

=B2.close()

5

 

return B3

Related functions:

callx()

call()

           

fork cs[511][512]

Description:

Perform parallel computation over a multicursor.

Syntax:

fork cs

Note:

The function performs parallel computation over a multicursor. Within a parallel computing code block, the referenced cell represents the current thread of cursor.

Parameters:

cs

A multicursor

Example:

 

A

B

 

1

=file("employee.txt")

=A1.cursor@mt()

Create a multicursor based on employee.txt and return it

2

fork B1

 

Perform parallel computation over the multicursor

3

 

=A2.select().fetch()

Get records from each thread of cursor by loop

fork ....;h,s  reduce[513][514]

Description:

Execute a code block with multiple threads on multiple nodes.

Syntax:

fork  ….;h,s  reduce

Note:

…. is a parameter sequence, whose length determines the number of parallel threads. The statement makes multiple duplicates of the current cellset and its context to execute them respectively using multiple threads running on multiple nodes listed in sequence h. A sequence parameter will be separated to have its members respectively used as the value of current cell for the execution of each thread on the nodes; and a single-value parameter will be duplicated to be distributed to each thread. The result of return statement in the code block will be used in the form of a sequence as the cell value of the main program to call the subroutine. Executing a code block with multiple threads on multiple nodes is functionally equivalent to callx() function without deploying a dfx file on each node. You can’t reference cells and variables other than the parameters of the fork statement in the code block. A referenced cellset variable (which includes cell names) will also be distributed to the cellset on each node.

Parameters:

 

….

A parameter sequence, whose members will be distributed among servers; the distribution will stop when the number of subtasks on every server reaches its maximum and will resume as soon as there is an available server. The subtasks on a server will be reassigned if it fails.

 

 

h

The server sequence in which each server is represented by a string in the form of "address:port number", like "192. 168. 0. 86: 4001".

 

s

A sequence consisting of integer sequences; can be omitted

reduce

The reduce action; ~~ represents the current result of performing reduce and ~ represents the result returned by the current task; can be omitted

Example:

1)     Single parameter

 

A

B

1

fork [[1,20,6,14,5],[32,8],23];["192.168.1.100:8989","192.168.1.100:8282","192.168.1.100:8283"]

// return results of executing result statement of multithreads on multinodes

2

 

=connect("demo")

3

 

=B2.query("select * from EMPLOYEE where EID in (?) ",A1)

4

 

=B2.close()

5

 

return B3

 

 

A

B

1

[192.168.0.116:8281,192.168.0.129:8281]

 

2

[English,Math,PE]

 

3

[[1],[2,3]]

 

4

fork  A2;A1,A3

 

5

 

=connect("demo")

6

 

=B5.query("select * from SCORES  where SUBJECT=?",A4)

7

reduce

~~|~

 

2)     Multiple parameters

 

A

B

1

fork [[1,20,6,14,5],[32,8],[3,4],23,12,89,56,90,231,333,111,231],"F";["192

.168.1.100:8989","192.168.1.100:8282","192.168.1.100:8283"]

// return results of executing result statement of multithreads on multinodes

2

 

=connect("demo")

3

 

=B2.query("select * from EMPLOYEE where EID in (?) and GENDER=?",A1(1),A1(2))

4

 

=B2.close()

5

 

return B3

Related functions:

  callx()

  fork Ai,...

fork … fork …[515][516]

Description:

Execute multiple code blocks in parallel.

Syntax:

fork

fork

Note:

The function executes multiple code blocks in parallel and assigns the result of executing each code block to the corresponding fork cell.

Example:

 

A

B

1

fork [[1,20,6,14,5],[32,8]]

//fork

2

 

=connect("demo")

3

 

=B2.query("select * from EMPLOYEE where EID in (?) ",A1)

4

fork [[1,20,6,14,5],[32,8]],"F"

//fork

5

 

=connect("demo")

6

 

=B5.query("select * from EMPLOYEE where EID in (?) and GENDER=?",A4(1),A4(2))

format()[517][518]

Description:

Generate a formatted string in Java.

Syntax:

format (s,…)

Note:

The function converts data of any type into a formatted string in Java; parameter is the parameter of string s.

Parameters:

s

A string

…    

The format parameter of the specified string

Example:

format("my name is %s","wind")

my name is wind

format("this is %f",9552.21)      

this is 9552.210000

format("this is %d",-2)

this is -2

Return value:

A string

Format specifiers in Java:

 

Format Specifier

Conversion Applied

 

%s

String

 

%c

Character

 

%b

Boolean

 

%d

Decimal integer

 

%x

Integer hexadecimal

 

%o

Octal integer

 

%f

Decimal floating-point

 

%a

Floating-point hexadecimal

 

%e

Scientific notation

 

%g

Causes Formatter to use either %f or %e, whichever is shorter

 

%h

Hash code

 

%%

Inserts a percent sign

 

%n

Inserts a newline character

 

%tx

Datetime (x is a suffix to describe the portion and precise format of the time or date desired)

 

Fpmt()[519][520]

Description:

The function equals the Excel PMT function.

Syntax:

Fpmt(rate,nper,pv,fv)

Note:

The function calculates each period’s amount required to pay off an investment loan, based on a constant interest rate and the constant periodic payments.

Parameters:

rate

The interest rate per period; it is a fixed value

nper

The number of periods over which the investment (or loan) requires or is to be paid

pv

The present value of the loan /investment, known as the principal. That is the money that already exist when the payment for an investment (or a loan) begins, or the total amount of present values of a series of future payments

fv

The future value of the loan/investment, or the cash balance you hope to achieve after the final payment. If omitted, its value will be assumed as zero (for example the future value of a loan can be zero)

per

The number of period in which the principal appears. Its value must between 1 and nper

Options:

@t

Indicating the payment type, it corresponds to Excel type parameter. If using the option, choose type 1; if not, choose type 0.

@i(rate,nper:per,pv,fv)

This option makes the function equivalent to Excel IPMT function and calculates the interest payment for a given period, with constant periodic payment and a constant interest rate

@p(rate,nper:per,pv,fv)

This option makes the function equivalent to Excel PPMT function and calculates the principal amount during a specific period of an investment or loan that is paid in constant periodic payments, with a constant interest rate

Example:

Fpmt@t(0.07/12, 10, 200000)

-20647.264618755307

Fpmt@i(0.1/12,36:1, 8000)

-66.66666666666666

Fpmt@p(0.07/12,12*10:1,120000)

-693.3017506234848

Fprice()[521][522]

Description:

The function equals the Excel PRICE, PRICEDISC or PRICEMAT function.

Syntax:

Fprice(settlement,maturity;rate,yld,redemption)

Equivalent to Excel PRICE function. It calculates the price per ¥100 par value of a security that pays periodic interest. Annually. Specify the day count basis method US (NASD) 30/360.

Fprice@d(settlement,maturity;discount,0,redemption)

Equivalent to Excel PRICEDISC function. It calculates the price per ¥100 par value of a discounted security. Specify the day count basis method US (NASD) 30/360.

Fprice@m(settlement,maturity,issue;rate,yld)

Equivalent to Excel PRICEMAT function. It calculates the price per ¥100 par value of a security that pays interest at maturity. Specify the day count basis method US (NASD) 30/360.

Note:

The function returns the price of a security that pays periodic interest, or of a discounted security, or of a security that pays periodic interest

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

rate

The security's annual coupon rate

yld

The security's annual yield

redemption

The security's redemption value

discount

The security's discount rate

issue

The security’s issue date

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fprice@m(date("2001-2-15"),date("2002-4-13"),date("2000-11-11");0.061,0.061)

99.89464887553818

Fprice@d1(date("2001-2-15"),date("2002-4-13"),0.4,0,0.061)

0.03278958904109588

Frate()[523][524]

Description:

The function equals the Excel RATE function.

Syntax:

Frate(nper,pmt,pv,fv,guess)

Note:

The function calculates the interest rate required to pay an investment, including both the reimbursement rate of the constant periodic payment and the rate of return of the one-off payment.

Parameters:

nper

The number of periods over which the investment or loan is to be paid

pmt

The payment amount per period, including the principal and the interest

pv

The present value of the loan /investment, known as the principal. That is the money that already exist when the payment for an investment (or a loan) begins, or the total amount of present values of a series of future payments

fv

The future value of the loan/investment, or the cash balance you hope to achieve after the final payment. If omitted, it will take on the default value of zero

guess

An estimated interest rate. If omitted, it will take on the assumed value of 10%. Both guess and nper must use the same unit.

Options:

@t

Indicating the payment type, it corresponds to Excel type parameter. If using the option, choose type 1; if not, choose type 0.

Example:

Frate(12*6, -2200, 100000)

0.013798002390137705

Freceived()[525][526]

Description:

The function equals the Excel RECEIVED function.

Syntax:

Freceived(settlement,maturity;inverstment,discount)

Note:

The function returns the amount received at maturity for a security.

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

investment

The initial amount invested into the security

discount

The security's discount rate

Options

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Freceived@0(date("2001-2-15"),date("2001-5-15"),1000000,0.0575)

1014420.2658626447

Freceived@5(date("2001-2-15"),date("2001-5-15"),1000000,0.0575)

1014219.9190013407

Fsln()[527][528]

Description:

The function equals the Excel SLN function.

Syntax:

Fsln(cost,salvage,life)

Note:

The function returns the straight-line depreciation of an asset for each period. The depreciation for each period is the same.

Parameters:

cost

The initial cost of the asset

salvage

The value of the asset at the end of the depreciation (also known as asset residual value)

life

The number of periods over which the asset is to be depreciated (sometimes called expected useful life of the asset)

Example:

Fsln(300000, 20000,8)

35000.0

Fsyd()[529][530]

Description:

The function equals the Excel SYD function.

Syntax:

Fsyd(cost,salvage,life,period)

Note:

The function returns depreciation of an asset for a specified period, using the sum-of-years’ digits method.

Parameters:

cost

The initial cost of the asset

salvage

The value of the asset at the end of the depreciation (also known as asset residual value)

life

The number of periods over which the asset is to be depreciated (sometimes called expected useful life of the asset)

period

The period for which the asset’s depreciation is calculated (it must use the same unit as life)

Example:

Fsyd(500000, 5000,10, 1)

90000.0

ftp_cd()[531][532]

Description:

Set the remote working directory/directories on the FTP server.

Syntax:

ftp_cd(client,remotePath)

Note:

External library function. The parameter remotePath can be omitted when there’s only one remote working directory.

Parameters:

client

An FTP client object

remotePath

The path name of a remote working directory; when it is omitted, the remote working directory on the FTP server is by default regarded as the root directory.

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/folder1")

Set /folder1 as the remote working directoy

3

=ftp_put(A1,"test.txt","G:/Test.txt")

 

4

>ftp_close(A1)

 

Related functions:

ftp_dir()

ftp_client()[533][534]

Description:

Create an FTP client.

Syntax:

ftp_client(server:port,user,pwd)

Note:

External library function. By default the FTP server operates in an active mode.

Options:

@d

Start the FTP passive mode

Parameters:

server

An FTP server’s IP address

port

An FTP server’s port number, which is by default 21 and can be omitted

user

The username to access an FTP server

pwd

The password to access an FTP server

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

Create an FTP client

2

=ftp_cd(A1,"/workPath")

 

3

=ftp_put(A1,"test.txt","G:/Test.txt")

 

4

>ftp_close(A1)

 

Related functions:

ftp_close()

ftp_close()[535][536]

Description:

Exit an FTP client program.

Syntax:

ftp_close(client)

Note:

This external library function closes an FTP connection.

Parameters:

client

An FTP client object

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

Create an FTP client

2

=ftp_cd(A1,"/folder1")

 

3

=ftp_put(A1,"Test1.docx","G:/Test.docx")

Upload a file to the FTP server

4

>ftp_close(A1)

Exit the FTP client program

Related functions:

ftp_client()

 

ftp_dir()[537][538]

Description:

List all directories and files under the current directory on an FTP server.

Syntax:

ftp_dir(client,multiFiles)

Note:

This is an external library function. When parameter multiFiles is a relative path, it is relative to the current working directory; when it is preceded by a slash sign (/), it is an absolute path.

For a wildcard character, the question mark (?) signifies a single character, an asterisk (*) signifies any character, and double asterisk (**) signifies any character plus a directory.

Options:

@d

Only list directories; parameter multiFiles is a wildcard-specified server file

@p

List full paths of directories and files; parameter multiFiles is a wildcard-specified server file

@m

Create new directories; parameter multiFiles is a file with fixed name

@r

Delete empty directories; parameter multiFiles is a file with fixed name

Parameters:

client

An FTP server client object

multiFiles

Wildcard-specified server files; can be duplicated

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/ WorkingDirectory ")

 

3

=ftp_dir@m(A1,"folder1")

Create folder1 directory under the current directory WorkingDirectory

4

=ftp_dir@m(A1,"folder2","/folder3")

Create folder2 directory under the current directory and create folder3 directory under the root directory

5

=ftp_dir@r(A1,"folder1")

Delete the empty directory folder1 from the current working directory

6

=ftp_dir@d(A1,"folder*")

List directories preceded by ‘folder’ in the current working directory

7

=ftp_dir@d(A1,"/a*/??/**")

List directories preceded by a, and files and directories having subdirectores whose names are less than or equal to two characters

8

=ftp_dir@p(A1,"folder*")

List directories preceded by ‘folder’ in full path under the current directory

9

>ftp_close(A1)

 

Related functions

   ftp_cd()

ftp_get()[539][540]

Description:

Download a file from the FTP server.

Syntax:

ftp_get(client,remoteFile,localFile)

Note:

External library function. If the parameter localFile is a relative path, it is relative to the path to the current dfx file.

Options:

@f

Overwrite the local namesake file

Parameters:

client

An FTP client object

remoteFile

A remote file

localFile

A local file

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/WorkingDirectory")

 

3

=ftp_get(A1,"Records.docx","G:/Records_Download.docx")

Download a file from the FTP server

4

>ftp_close(A1)

 

Related functions:

ftp_put()

 

ftp_mget()[541][542]

Description:

Download multiple files from a FTP server.

Syntax:

ftp_mget(client,serverFolder,localFolder,multiServerFiles)

Note:

This is an external library function. When parameter serverFolder is a relative path, it is relative to the current working directory; when it is preceded by a slash sign (/), it is an absolute path. The parameter can be absent, but its position must be kept by retaining the comma. If the parameter is an empty string or is absent, the folder path is relative to the current working directory.

When parameter localFolder is a relative path, it is relative to the path configured in esProc Options -> Main directory. The parameter can be absent, but its position must be kept by retaining the comma. If the parameter is an empty string or is absent, the folder path is relative to the path configured in esProc Options -> Main directory.

For a wildcard character, the question mark (?) signifies a single character, an asterisk (*) signifies any character, and double asterisk (**) signifies any character plus a directory.

Options:

@f

Overwrite a namesake file

@t

Skip a namesake file

Parameters:

client

An FTP client object

serverFolder

A server folder

localFolder

A local folder

multiServerFiles

Wildcard-specified server files; can be duplicated

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/ WorkingDirectory ")

 

3

=ftp_mget@f(A1,"folder1","G:/download","*.doc")

Download files suffixed by doc under folder1 directory to G:/download directory while overwriting namesake files

4

=ftp_mget@f(A1,"folder1","G:/download","*.xls","*.xlsx")

Download files suffixed by xls and xlsx under folder1 directory to G:/download directory

5

=ftp_mget@f(A1,"folder1","G:/download","**")

Download all files under folder1 directory to G:/download directory

6

=ftp_mget@t(A1,"folder2","G:/download","*.docx")

Download files suffixed by docx under folder2 directory to G:/download directory while skipping namesake files

7

>ftp_close(A1)

 

Related functions:

ftp_mput()

ftp_put()

ftp_mput()[543][544]

Description:

Upload multiple files onto a FTP server.

Syntax:

ftp_put(client,serverFolder,localFolder,multiLocalFiles)

Note:

This is an external library function. When parameter serverFolder is a relative path, it is relative to the current working directory; when it is preceded by a slash sign (/), it is an absolute path. The parameter can be absent, but its position must be kept by retaining the comma. If the parameter is an empty string or is absent, the folder path is relative to the current working directory.

When parameter localFolder is a relative path, it is relative to the path configured in esProc Options -> Main directory. The parameter can be absent, but its position must be kept by retaining the comma. If the parameter is an empty string or is absent, the folder path is relative to the path configured in esProc Options -> Main directory.

For a wildcard character, the question mark (?) signifies a single character, an asterisk (*) signifies any character, and double asterisk (**) signifies any character plus a directory.

Options:

@f

Overwrite a namesake file

@t

Skip a namesake file

Parameters:

client

An FTP client object

serverFolder

A server folder

localFolder

A local folder

multiLocalFiles

Wildcard-specified server files; can be duplicated

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/ WorkingDirectory ")

 

3

=ftp_mput@f(A1,"folder1","G:/upload","*.doc")

Upload files suffixed by doc under G:/upload directory to folder1 directory while overwriting namesake files

4

=ftp_mput@f(A1,"folder1","G:/upload","*.xls","*.xlsx")

Upload files suffixed by xls and xlsx under G:/upload directory to folder1 directory

5

=ftp_mput@f(A1,"folder1","G:/upload ","**")

Upload all files under G:/upload directory to folder1 directory

6

=ftp_mput@t(A1,"folder2","G:/upload,"*.docx")

Upload files suffixed by docx under G:/upload directory to folder2 directory while skipping namesake files

7

>ftp_close(A1)

 

 

ftp_put()[545][546]

Description:

Upload a file to the FTP server.

Syntax:

ftp_put(client,remoteFile,localFile)

Note:

External library function. If the parameter localFile is a relative path, it is relative to the path to the current dfx file.

Options:

@f

Overwrite the local namesake file

Parameters:

client

An FTP client object

remoteFile

A remote file

localFile

A local file

Example:

 

A

 

1

=ftp_client("192.168.75.1":21,"Administrator","admin")

 

2

=ftp_cd(A1,"/WorkingDirectory")

 

3

=ftp_put(A1,"Records_Upload.docx","G:/Records.docx")

Upload a file to the FTP server

4

>ftp_close(A1)

 

Related functions:

ftp_get()

func()[547][548]

Here’s how to use func() function.

func()[549][550]

Description:

Call a subroutine.

Syntax:

func(c,xi)

Note:

A subroutine can be called in any cell as required once defined in a program cellset. The function calls a subroutine starting from master cell c and, in the meantime, passes in parameter xi and makes it the value of c. Return the return value defined by the subroutine after the call is completed.

Parameters:

c

The master cell of a subroutine; it is usually the cell where the func is located

xi

The parameter used in a subroutine; can be a numerical value, a sequence, or other types of value

Return value:

The return value of the subroutine.

Example:

 

A

B

 

1

func

 

Define a subroutine

Return the sum of the members of the passed parameter – whose value is a sequence

2

 

return A1.sum()

3

=func(A1,[1,2,3])

 

Calling method; the return value is 6

 

func …{return xi}[551][552]

Description:

Define a function block.

Syntax:

func

{return xi}

Note:

The function defines a function block, which may or may not return a result after computation. The function block (subroutine) begins with the starting characters func and covers a cell range where the master cell is the one holding the func. The return statement is used to return the function’s result and terminate the execution of the function block. The subroutine will by default return the value of the last calculation cell if no return statement appears during execution.

Return value:

The result of the function block.

Example:

 

A

B

 

1

func

 

Define a subroutine where the parameter passed in is a sequence and that returns the sum of members of the sequence

2

 

return A1.sum()

Related functions:

 func()

 

Fv()[553][554]

Description:

The function equals the Excel FV function.

Syntax:

Fv(rate,nper,pmt,pv)

Note:

The function calculates the future value of an investment (i.e. the sum of principal amount and interest obtained after the investment ends) with periodic constant payments and a constant interest rate.

Parameters:

rate

The interest rate per period; it is a fixed value

nper

The number of periods over which the investment (or loan) requires or is to be paid

pmt

The amount paid per period, which keeps unchanged during the whole period of paying off the loan. To omit it, pv must exist

pv

The present value of the loan /investment, known as the principal. That is the money that already exist when the payment for an investment (or a loan) begins, or an accumulated sum of present values of a series of future payments

Options:

@t

Indicating the pamyment type, it corresponds to the Excel type parameter. If using the option, choose type 1; if not, choose type 0.

@p(rate,nper,pmt,fv)

This option makes the function equivalent to Excel PV functionand calculates the present value of an investment that is the total amount of a series of future payments. For example the amount of borrower’s borrowed money is the present value of the loan delivered by the lender.

Example:

Fv@t(0.07, 30,-2000,0,1)

202146.08273281078

Fv@p(0.067/12,12*25,500,0)

-72700.0451136414

Fvdb()[555][556]

Description:

The function equals the Excel VDB function.

Syntax:

Fvdb(cost,salvage,life,start_period,end_period,factor)

Note:

The function calculates the depreciation of an asset for a specfied period, using variable declining balance method, or double-declining balance method or another user-defined method.

Parameters:

cost

The initial cost of the asset

salvage

The value of the asset at the end of the depreciation (also known as asset residual value)

life

The number of periods over which the asset is to be depreciated (sometimes called expected useful life of the asset)

start_period

The starting period for which you want to calculate the depreciation. It must use the same unit as life.

end_period

The ending period for which you want to calculate the depreciation. It must use the same unit as life.

factor

The rate of depreciation. If omitted, it takes on the default value of 2, specifying the double-declining balance method

Options:

@s

Do not switch to the straight-line depreciation method when depreciation is greater than the declining balance calculation

Example:

Fvdb(100000, 10000,10, 0,1)

20000.0

Fvdb@s(100000, 10000,120, 6,18,1.5)

12992.03902742642

Fyield()[557][558]

Description:

The function equals the ExcelYIELD, YIELDDISC or YIELDMAT functions.

Syntax:

Fyield(settlement,maturity;rate,pr,redemption)

Equivalent to Excel YIELD function. It calculates the yield rate of a security. Annually. Specify the day count basis method US (NASD) 30/360.

Fyield@d(settlement,maturity;0,pr,redemption)

Equivalent to Excel YIELDDISC function. It calculates the annual yield rate of a discounted security. Specify the day count basis method US (NASD) 30/360.

Fyield@m(settlement,maturity,issue;rate,pr)

Equivalent to Excel YIELDMAT function. It calculates the yield rate of a security that pays interest at maturity. Specify the day count basis method US (NASD) 30/360.

Note:

The function returns the yield rate of a security that pays periodic interest

Parameters:

settlement

The security's settlement date

maturity

The security's maturity date

rate

The security's annual coupon rate

pr

The security's price

redemption

The security's redemption value

issue

The security’s issue date

Options

@2

Semi-annually. It corresponds to the Excel frequency parameter.

@4

Quaterly. It corresponds to the Excel frequency parameter.

@1

Specify the day count basis method Actual/Actual. It corresponds to the Excel basis parameter.

@0

Specify the day count basis method Actual/360. It corresponds to the Excel basis parameter.

@5

Specify the day count basis method Actual/365. It corresponds to the Excel basis parameter.

@e

Specify the day count basis method European 30/360. It corresponds to the Excel basis parameter.

Example:

Fyield@2(date("2008-2-15"),date("2016-11-15");0.0575,95.04287,100)

0.06500000688109805

Fyield@d0(date("2008-2-16"),date("2008-3-1");0,99.795,100)

0.05282257198685834

Fyield@m(date("2008-3-15"),date("2008-11-3"),date("2007-11-8");0.0625,100.0123)

0.060954333691538576

gcd()[559][560]

Description:

Return the greatest common divisor.

Syntax:

gcd(xi,…)

gcd(A)

Note:

The function calculates the greatest common divisor of members of [x1, x2,…].

Parameter:

A

Sequence

xi

A numeric expression, which will be ignored if its value is not a number

Return value:

The greatest common divisor

Example:

gcd(7,1)

1

goto C[561][562]

Description:

Jump to execute cell C.

Syntax:

goto  c

Note:

The function enables jumping to execute cell C.

Example:

 

A

B

C

 

1

=2

 

 

7

2

if A1>5

>A1=A1+4

>A1=A1+5

Within the if code block, when A1>5 is true, execute B2; otherwise jump to execute C2

3

else

goto C2

 

 

group()[563][564]

Here’s how to use group() function.

A.group(xi,…)[565][566]

Description

Perform equi-grouping according one or more fields or expressions.

Syntax

A.group(xi,…)

Note

The function performs equi-grouping on a sequence or a record sequence according to a single or multiple fields/expressions. The result is a sequence consisting of groups.

Options

@o

Group records by comparing adjacent ones, which is equal to the merging operation, and the result set won’t be sorted

@1

Get the first record of each group to form a record sequence and return it (Please note that 1 is a number instead of a letter)

@n

x gets assigned with group numbers which can be used to define the groups. @n and @0 are mutually exclusive

@u

Do not sort the result set by x. It doesn’t work with @o/@n

@i

x is a bool expression. If the result of x is true, then start a new group. This option is equivalent to A.group@o(a+=if(x,1,0)), in which a=0 and there is only one x

@0

Discard the group over which the result of grouping expression x is null. Use it when there’s only one expression x

@s

Perform a concatenation of sequences/records sequences after the grouping. It is equivalent to A.group(xi,…).conj()

@p

Return a sequence of integer sequences, each of which contains the positions of members in each group in sequence A

@h

Used over a grouped table with each group ordered to speed up grouping

Parameters

A

A sequence

xi

Grouping expression. When grouping data by multiple fields or expressions, separate grouping expressions from each other by commas

Return value

A sequence or a record sequence

Example

Ø  Group a sequence

 

A

 

1

[6,9,12,15,16,5,1,7,8]

 

[[6,12,16,8],[ 9,15,5,1,7]] The series is divided into two groups. Divide the number of members in both groups by 2, one of the remainders is 0 and the other is 1

2

=A1.group(~%2)

3

=A1.group(~%2,~%3)

[[6,12],[16],[8],[9,15],[1,7],[5]]

Group the series according to multiple expressions.

4

=[6,9,16,5,1,7,8].group@s(~%2)

Divide the sequence into a group of odd numbers and a group of even numbers, and then concatenate them

5

=A1.group((#-1)\3)

Group sequence A1 every 3 members

Ø  Reuse the grouping result

 

A

 

1

=demo.query("select NAME,BIRTHDAY,GENDER from EMPLOYEE")

 

2

=A1.group(GENDER)

[[Rebecca,Ashley,Rachel,…],[Matthew,Ryan,Jacob,…]], each group is a sequence

3

=A2.new(GENDER:Gender,~.count():Number)

Count members of each group

4

=A2.new(GENDER:Gender,~.avg(age(BIRTHDAY)):Average)

Get different statistical results using  the same grouping result

Ø  Group data by multiple fields

 

A

 

1

=demo.query("select NAME,GENDER,DEPT,BIRTHDAY from EMPLOYEE")

 

2

=A1.group(GENDER,DEPT)

Group records by multiple fields

3

=A1.group@o(GENDER)

Records won’t be sorted; only the adjacent ones will be compared and group them together if they are the same. Same records that are not adjacent may be put into different groups, so there may be overlapped groups and the returned result is a set of sequences.

4

=A1.group@1(GENDER)

Return the first record of each group

5

=A1.group@n(if(GENDER=="F",1,2))

x gets assigned with group numbers which can be used to define the groups directly.

[[Rebecca,Ashley,Rachel,…],[Matthew,Ryan,Jacob,…]]

6

=A1.group@u(GENDER,DEPT)

Do not sort result set by the sorting field

7

=A1.group@i(GENDER=="F")

Start a new group when GENDER=="F"

8

=A1.group@p(GENDER,DEPT)

Return a sequence of integer sequences, each of which contains the positions of records in a group (grouped by GENDER field and DEPT field) in the original table sequence

9

=file("D:\\Salesman.txt").import@t()

10

=A9.group@0(Gender)

Group the table sequence by GENDER field, while discarding groups with null values

11

=file("D:/emp10.txt").import@t()

For data fiel emp10.txt, every 10 records are ordered by DEPT

12

=A11.group@h(DEPT)

As A11 is segmented and ordered by DEPT, @h option is used to speed up grouping

Related functions

A.id()

A.group(x:F,…;y:G,…)

A.group(x:F,...;y:G,…)[567][568]

Description

Group a sequence and then perform aggregate operations.

Syntax

A.group(x:F,...;y:G,…)  

Note

First group the sequence according to a single or multiple fields/expressions and then aggregate each group of data. After the sequence is grouped according to x, a new table sequence with fields being F,... G,… will be created. Values of F field are the value of x field of the first record in each group and G field gets values by computing y with regard to each group.

Options

@o

Group records by comparing adjacent ones, which is equal to the merging operation, and the result set won’t be sorted.

@n

x gets assigned with group numbers which can be used to define the groups. @n and @o are mutually exclusive.

@u

Do not sort the result set by x. It doesn’t work with @o/@n

@i

x is a bool expression. If the result of x is true, then start a new group. There is only one x.

@0

Discard the group over which the result of grouping expression x is null

@h

Used over a grouped table with each group ordered to speed up grouping

Parameters

A

A sequence

x

Grouping expression. If omitting x:F, aggregate the whole set without grouping; in this case ;must not be omitted

F

Field name of the result table sequence

G

Names of summary fields in the result table sequence

y

Aggregate expression in which ~ is used to reference a group

Return value

A sequence

Example

 

A

 

1

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

 

2

=A1.group(STUDENTID:StudentID;~.sum(SCORE):TotalScore)

3

=A1.group@o(STUDENTID:StudentID;~.sum(SCORE):TotalScore)

Only the adjacent ones will be compared and group them together if they are the same. The result set won’t be sorted.

4

=demo.query("select * from STOCKRECORDS where STOCKID<'002242'")

 

5

=A4.group@n(if(STOCKID=="000062",1,2):StockID;~.sum(CLOSING):TotalPrice)

x gets assigned with group numbers

6

=A1.group(;~.sum(SCORE):TotalScore)

x:F is omitted, so compute the total score of all the students

7

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

 

8

=A7.group@u(STATE:State;~.count(STATE):TotalScore)

Do not sort result set by the sorting field

9

=A7.group@i((GENDER=="F"):IsF;~.count():Number)

Start a new group when GENDER=="F"

10

=file("D:\\Salesman.txt").import@t()

11

=A10.group@0(Gender:Gender;~.sum(Age):Total)

Discard the groups where GENDER values are null

12

=file("D:/emp10.txt").import@t()

For data file emp10.txt, every 10 records are ordered by DEPT

13

=A12.group@h(DEPT:dept;~.sum(SALARY):bouns)

As A12 are segmented and ordered by DEPT, @h option is used to speed up grouping

 Related functions

A.id()

A.group(xi,…)

ch.group()[569][570]

Description:

Group records in a channel by comparing each one with its neighbor(s) and return a channel.

Syntax:

ch.group(x)

Note:

The function groups the records in channel ch by expression x, during which each record is compared only with its neighbor(s) and returns a channel containing a series of sequences. This is equivalent to a merge. The resulting set won’t be sorted again. This is an attached computation.

Options:

@i

With this option and with grouping expression x being a bool expression, start a new group if the result of x is true. Be sure there’s only one x in this case.

Parameters:

ch

Channel

x

Grouping expression. Use the comma to separate multiple grouping fields/expressions.

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,NAME,GENDER,DEPT,SALARY from EMPLOYEE")

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A2.group(GENDER,DEPT)

Group records by GENDER field and DEPT field

5

=A2.fetch()

Attach ch.fetch() function that gets the final result to A2’s channel to fetch and store the existing data in the channel

6

=A3.group@i(GENDER=="F")

Start a new group whenever GENDER=="F"

7

=A3.fetch()

Attach ch.fetch() function that gets the final result to A3’s channel

8

=A1.push(A2,A3)

Be ready to push the data in A1’s cursor into A2’s channel and A3’s channel, but the action needs to wait

9

=A1.skip()

Data in A1’s cursor is pushed into the channel and operations are performed as the skip() operation is performed over A1

10

=A2.result()

11

=A3.result()

cs.group()[571][572]

Description:

Group cursor records by comparing only adjacent records and return the original cursor.

Syntax:

cs.group(x,…)

Note:

The function groups cursor cs containing a set of records by expression x, according to which only the adjacent records are compared, and return the original cursor of sequences. Cursor cs should be ordered. The operation is equal to a merge and supports multicursors.

Options:

@i

x is a bool expression. Begin a new group when a record makes it return true. In this case there should be only one x.

@1

Get the first record of every group to form a record sequence and return it; here it is number 1, instead of letter l

@q(x:F,…;x’:F’,…;…)

When the cursor is ordered by the first grouping field, just sort the grouped data by the following field(s); support memory grouping

@s

Sort only without grouping; must work with @q option

Parameters:

cs

A cursor containing a set of records

x

Grouping expression; multiple fields/expressions for grouping will be separated from each other with the comma.

Return value:

The orginal cursor

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE")

 

2

=A1.group(GENDER,DEPT)

Put adjacent records whose GENDER and DEPT values are equal into same group, and return the original cursor

3

=demo.cursor("select * from EMPLOYEE")

 

4

=A3.group@i(GENDER=="F").fetch()

Begin a new group as long as the record satisfies GENDER=="F"

5

=demo.cursor("select * from EMPLOYEE order by GENDER  ")

 

6

=A5.group@1(GENDER).fetch()

Return the first record of each group

7

=demo.cursor("select * from EMPLOYEE order by DEPT ")

Retrieve data of EMPLOYEE table, sort it by DEPT and return data as a cursor

8

=A7.group@q(DEPT;GENDER)

A7’s cursor is already ordered by DEPT, so the data just need to be ordred by group by GENDER

9

=A7.group@qs(DEPT:DEPT;GENDER:GENDER).fetch()

Sorted only without grouping

Related functions:

A.group(xi,…)

A.group(x:F,…;y:G,…)

 

cs.group()[573][574]

Description:

Group a cluster cursor by comparing each record with its next neighbor.

Syntax:

cs.group(x,…)

Note:

The function groups records in ordered cluster cursor cs according to expression x by comparing the value of x only with its next neighbor, and returns the cluster cursor containing a sequence of groups. The operation is equivalent to a merge and supports multicursors.

Parameters:

cs

A cluster cursor

x

Grouping expression; use comma to separate multiple grouping fields or expressions

Return value:

The grouped cluster cursor

Example:

 

A

 

1

=file@n("D:/employees.ctx","192.168.0.111:8281")

Below is employees.ctx ordered by DEPT field:

2

=A1.create()

Create a cluster composite table

3

=A2.cursor()

Return a cluster cursor

4

=A3.group(DEPT)

Group the cluster cursor by DEPT and return the grouped cluster cursor

5

=A4.fetch()

cs.group (x:F,…;y:G,…)[575][576]

Description:

Group records of a given cursor by comparing each with its neighbours, peform aggregation over each group and return the original cursor.

Syntax:

cs.group(x:F,...;y:G,…) 

Note:

The function groups records in cursor cs according to expression x, by which cs is ordered and whose values are only compared with their neighbors, and then performs aggregation. The resulting set won’t be sorted again. After grouping, records in the original cursor will have fields F,... G,…. Values of F field consist of values of x field in the first record of every group, and values of G field are the results of computing expression y over each group. The function supports a multicursor.

Parameters:

cs

Cursor/cluster cursor

x

Grouping expression

F

Field name

G

Aggregation field name

y

Aggregate expression

Return value:

The original cursor/cluster cursor

Example:

 

A

 

1

=demo.cursor("select * from SCORES   where STUDENTID <5  order by  STUDENTID ")

Sort records by SCOREs field

2

=A1.group(STUDENTID:StudentID;sum(SCORE):TotalScore)

Return the original cursor cs

3

=A2.fetch()

 

 

A

 

1

=file@n("D:/employees.ctx","192.168.0.111:8281")

Below is employees.ctx ordered by DEPT field:

2

=A1.create()

Create a cluster composite table

3

=A2.cursor()

Return a cluster cursor

4

=A3.group(DEPT:dept;count(NAME):count)

Group the cluster cursor according to DEPT by comparing each record with its next neighbor, perform aggregation and return the grouped cluster cursor

5

=A4.fetch()

groupi()[577][578]

Here’s how to use groupi() function.

A.groupi(Di,…)[579][580]

Description:

Generate a sequence for use in a data-input sheet.

Syntax:

A.groupi(Di,…)    

Note:

The function generate a sequence for use in a data-input sheet whose dimension is parameter Di. The values of column Di is A.group(D1).(~.group(D2).(…(~.id(Di))).

Options:

@o

Assume that the sequence is ordered, perform a merge by comparing each record with its next neighbor and won’t sort the result set

Parameters:

A

A sequence

Di

A data-input sheet’s dimension

Return value:

A sequence

Example:

 

A

 

1

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

Return a table sequence

2

=A1.groupi(GENDER,STATE,DEPT,NAME)

Group data in columns GENDER,STATE and DEPT and perform distinct over column NAME

3

=demo.query("select * from employee order by GENDER,STATE,DEPT")

Return a table sequence and sort it by GENDER,STATE and DEPT

4

=A3.groupi@o(GENDER,STATE,DEPT,NAME)

Since A3’s table sequence is already ordered, perform a merge by comparing neighboring records; this gets the same result as A2’s but is faster

groupn()[581][582]

Here’s how to use group() function.

cs.groupn(x;C)[583][584]

Description:

Group records in a cursor and push them respectively into a sequence of channels.

Syntax:

cs.groupn(x;C)

Note:

The function groups records in cursor cs and pushes them respectively into a sequence of channels.

Parameters:

cs

Cursor records

x

Grouping expression

C

A sequence of channels

Return value:

The original cursor

Example:

 

A

 

1

=demo.cursor("select NAME,GENDER,DEPT,BIRTHDAY from EMPLOYEE")

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A1.groupn(if(GENDER=="F",1,2);[A2,A3])

Group cursor records, and push one group where GENDER is F into A2’s channel and the other group into A3’s channel

5

=A2.fetch()

Keep data in the channel in place

6

=A3.fetch()

Keep data in the channel in place

7

=A1.fetch()

 

8

=A2.result()

Get result from A2’s channel

9

=A3.result()

Get result from A3’s channel

ch.groupn(x;C)[585][586]

Description:

Group records in channel ch and push them respectively into a sequence of channels.

Syntax:

ch.groupn(x;C)

Note:

The function groups records in channel ch and pushes them respectively into a sequence of channels.

Parameters:

ch

Channel

x

Gouping expression

C

A sequence of channels

Return value:

A channel

Example:

 

A

 

1

=demo.cursor("select NAME,GENDER,DEPT,BIRTHDAY from EMPLOYEE")

 

2

=channel(A1)

Push cursor records into a sequence of channels and return a channel

3

=channel()

Create a channel

4

=channel()

Create a channel

5

=A2.groupn(if(GENDER=="F",1,2);[A3,A4])

Group records of A2’s channel, and push one group where GENDER is F into A3’s channel and the other group into A4’s channel

6

=A3.fetch()

Attach ch.fetch() function that gets the final result set to A3’s channel but keep data in A3’s channel in place

7

=A4.fetch()

Attach ch.fetch() function that gets the final result set to A4’s channel but keep data in A4’s channel in place

8

=A1.fetch()

 

9

=A3.result()

Get result from A3’s channel

10

=A4.result()

Get result from A4’s channel

cs.groupn(x;F)[587][588]

Description:

Group records of a cursor and write the subset groups as a sequence of bin files.

Syntax:

cs.groupn(x;F)

Note:

The function groups records of cursor cs and writes the subset groups as a sequence of bin files.

Parameters:

cs

Cursor records

x

Grouping expression

F

A sequence of bin file objects

Return value:

The original cursor

Example:

 

A

 

1

=demo.cursor("select NAME,GENDER,DEPT,BIRTHDAY from EMPLOYEE")

 

2

=[file("f_dept.btx"),file("m_dept.btx")]

A sequence of bin file objects

3

=A1.groupn(if(GENDER=="F",1,2);A2)

Put records where GENDER is F into the first group and other records into the second group, and then write the subset groups into a sequence of bin files in order

4

=A3.fetch()

 

groups()[589][590]

Here’s how to use groups() function.

A.groups()[591][592]

Description:

Group a table sequence and then get the aggregate result cumulatively.

Syntax:

A.groups(x:F,…;y:G,…)

Note:

The function groups and aggregates table sequence A simultaneously by one or multiple fields/expressions to generate a new table sequence with F,.. G… as the fields. Namely, during the traversal through members of A, they will be placed to the corresponding result set one by one while a result set is aggregated cumulatively. Compared with the method of first grouping and then aggregation, the function has a better performance.

Options:

@o

Group records by comparing adjacent ones, which is equal to the merging operation, and the result set won’t be sorted.

@n

x gets assigned with group numbers which can be used to define the groups. @n and @o are mutually exclusive.

@u

Do not sort the result set by x. It doesn’t work with @o/@n

@i

x is a bool expression. If the result of x is true, then start a new group. There is only one x.

@m

Use parallel algorithm to handle data-intensive or computation-intensive tasks; no definite order for the records in the result set; can’t be used with @oi options.

@0

Discard the group over which the result of grouping expression x is null

@h

Used over a grouped table with each group ordered to speed up grouping

Parameters:

A

A sequence.

x

Grouping expression.

F

Field name of the result table sequence.

y

y is the function with which A is traversed. When y is an aggregate function, it only supports sum/count/max/min/top/avg/iterate/icount/median. When the function work with iterate(x,a;Gi,…) function, the latter’s parameter Gi should be omitted. When y isn’t an aggregate function, perform calculation over only the first record in each group.

G

Summary field name in the result table sequence.

Return value:

Post-grouping table sequence.

Example:

 

A

 

1

=demo.query("select * from SCORES where CLASS = 'Class one'")

2

=A1.groups(STUDENTID:StudentID;sum(SCORE):TotalScore)

group by a single field.

3

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

 

4

=A3.groups(CLASS:Class,STUDENTID:StudentID;sum(SCORE):TotalScore)

group by multiple fields.

5

=A3.groups@m(STUDENTID:StudentID;sum(SCORE):TotalScore)

Use @m option to increase performance of big data handling.

6

=A3.groups@o(STUDENTID:StudentID;sum(SCORE):TotalScore)

Only compare and merge with the neighboring element, and the result set is not sorted.

7

=demo.query("select * from STOCKRECORDS where STOCKID<'002242'")

 

8

=A7.groups@n(if(STOCKID=="000062",1,2):StockID;sum(CLOSING):TotalPrice)

The value of x is the group sequence number.

9

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

 

10

=A9.groups@u(STATE:State;count(STATE):TotalScore)

Do not sort result set by the sorting field.

11

=A9.groups@i(STATE=="California":IsCalifornia;count(STATE):count)

Start a new group when STATE=="California".

12

=A3.groups(CLASS:Class,STUDENTID:StudentID;iterate(~~*2,10): Score1)

Perform iterate operation within each group

13

=file("D:\\Salesman.txt").import@t()

14

=A13.groups@0(Gender:Gender;sum(Age):Total)

Discard groups where Gender values are nulls

15

=file("D:/emp10.txt").import@t()

For data file emp10.txt, every 10 records are ordered by DEPT

16

=A15.groups@h(DEPT:dept;sum(SALARY):bouns)

A15 is grouped and ordered by DEPT, for which @h option is used to speed up grouping

17

=A4.groups(STUDENTID:StudentID;SUBJECT,sum(SCORE):SUMSCORE)

Parameter y isn’t an aggregate function, so the function performs operation over the first record; the result is English

Note:

Compared with A.group(x:F,…;y:G,…), A.groups(x:F,…;y:G,…) computes in a accumulative way and thus gets a better performance.

Related functions:

A.group(xi,…)

A.group(x:F,...;y:G,…)

ch.groups()[593][594]

Description:

Group records in a channel.

Syntax:

ch.groups(x:F,…;y:G…;n)

Note:

The function groups records in channel ch according to grouping expression x, by which the records are ordered, to get a channel having F,...G,… fields. Sort records in the new channel by x. Values of F field consist of values of x field in the first record of every group, and values of G field are the results of computing expression y, which is an aggregate function executed on cs, over each group. It aims to fetch the grouping result set from the channel.

Options:

@n

With the option the value of expression x is a group number, which points to the desired group

@u

Won’t sort the resulting set by expression x; the option and @n are mutually exclusive

Parameters:

ch

Channel

x

Grouping expression, by which an aggregation over the whole grouped set is performed if x:F is omitted. In that case the semicolon should not be omitted

F

Field names of the resulting table sequence

y

An aggregate function which only supports sum/count/max/min/top /avg/iterate; the parameter Gi should be given up if function iterate(x,a;Gi,…) is used

G

The aggregate fields in the resulting table sequence

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE ")

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=channel()

Create a channel

5

=channel()

Create a channel

6

=A1.push(A2,A3,A4,A5)

Be ready to push the data in A1’s cursor into channel A2, A3 and A5, but the action needs to wait.

7

=A2.groups(;sum(SALARY):TotalSalary)

As x:F is omitted, calculate the sum of salaries of all employees

8

=A3.groups(DEPT:dept;sum(SALARY):TotalSalary)

Group and sort records by DEPT field

9

=A4.groups@n(if(GENDER=="F",1,2):SubGroups;sum(SALARY):TotalSalary)

The value of x is group number; put records where GENDER is “F” into the first group and others into the second group, and then aggregate each group

10

=A5.groups@u(STATE:State;count(STATE):count)

Won’t sort the resulting set by grouping field

11

A1.select(month(BIRTHDAY)==2)

 

12

A11.fetch()

Attach a fetch operation to A11’s cursor

13

=A2.result()

14

=A3.result()

15

=A4.result()

16

=A5.result()

cs.groups()[595][596]

Description:

Group records in a cluster cursor, sort them by the grouping field and peform aggregation over each group and add each aggregate to the result set.

Syntax:

cs.groups(x:F,…;y:G…;n)

Note:

The function groups records in a cluster cursor by expression x, sorts result by the grouping field, and calculates the aggregate value on each group. This creates a new table sequence consisting of fields F,...G,… and sorted by the grouping field x.The values of F field are values of x field of the first record in each group and G field gets values by computing y – the aggregate function with which records of cs is aggregated – on each group.

Options:

@c

Perform the group operation over data in every node and compose the result sets into a cluster memory table in the segmentation way of the cursor; suppport a cluster dimension table

@d

Copy the result sets into nodes to compose a cluster duplicate memory table

Parameters:

cs

Records in a cluster cursor

x

Grouping expression; if omitting parameters x:F, aggregate the whole set; in this case, the semicolon (;) must not be omitted

F

Field name in the result table sequence

y

Aggregate function that only supports sum/count/max/min/top /avg/iterate; when the function works with iterate(x,a;Gi,…) function, the latter’s parameter Gi should be omitted

G

Aggregate field name in the result table sequence

n

The specified maximum number of groups; stop executing the function when the number of data groups is bigger than n to prevent memory overflow; the parameter is used in scenarios when it is predicted that data will be divided into a large number of groups that are greater than n.

 

Return value:

A table sequence/cluster memory table

Example:

 

A

 

1

=file@n("D:/emp1.ctx","192.168.0.111:8281")

Below is emp1.ctx:

2

=A1.create()

Create a cluster composite table

3

=A2.cursor()

Return a cluster cursor

4

=A3.groups(Dept:dept;count(Name):count)

Group data by DEPT and perform aggregation

 

 

 

A

 

1

[192.168.0.110:8281,192.168.18.143:8281]

 

2

=file@0("emp.ctx", A1)

emp.ctx is a distributed file on nodes 192.168.0.110 and 192.168.18.143

3

=A2.create()

Open a cluster composite table

4

=A3.cursor()

Create a cluster cursor

5

=A4.groups(GENDER:gender;sum(SALARY):totalSalary)

Group data by GENDER and perform aggregation and return result as a table sequence

6

=A3.cursor()

 

7

=A6.groups@c(GENDER:gender;sum(SALARY):totalSalary).dup()

Retain the way of segmentation of the distributed cursor and return a cluster memory table

8

=A3.cursor()

 

9

=A8.groups@d(GENDER:gender;sum(SALARY):totalSalary).dup()

Copy the result sets onto nodes to compose a cluster duplicate memory table

Related functions:

A.group(xi,…)

A.group(x:F,…;y:G,…)

A.groups()

cs.groupx()

cs.groups()[597][598]

Description:

Group records in a cursor.

Syntax:

cs.groups(x:F,…;y:G…;n)

Note:

The function groups records in a cluster cursor by expression x, sorts result by the grouping field, and calculates the aggregate value on each group. This creates a new table sequence consisting of fields F,...G,… and sorted by the grouping field x.The values of F field are the value of x field of the first record in each group and G field gets values by computing y – the aggregate function with which records of cs is aggregated – on each group. The aggregation over a cluster cursor will first be performed by the main process on the local machine and the result will then be returned to the machine that initiates the invocation; the process is called reduce.

Options:

@n

The value of grouping expression is a group number which can be used to locate the group

@u

Do not sort the result set by the grouping expression; it doesn’t work with @n

@o

Compare each record only with its neighboring record to group, which is equivalent to the merge operation, and won’t sort the result set

 

@i

With this option, the function only has one parameter x that is a bool expression; start a new group if its result is true

 

@h

Used over a grouped table with each group ordered to speed up grouping

 

Parameters:

cs

Records in a cursor/cluster cursor

x

Grouping expression; if omitting parameters x:F, aggregate the whole set; in this case, the semicolon (;) must not be omitted

F

Field name in the result table sequence

y

Aggregate function that only supports sum/count/max/min/top/avg/iterate; when the function works with iterate(x,a;Gi,…) function, the latter’s parameter Gi should be omitted

G

Aggregate field name in the result table sequence

n

The specified maximum number of groups; stop executing the function when the number of data groups is bigger than n to prevent memory overflow; the parameter is used in scenarios when it is predicted that data will be divided into a large number of groups that are greater than n; it doesn’t work with @n option. Support a multicuror when this parameter is absent.

Return value:

Post-grouping table sequence

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=A1.groups(;sum(SCORE):TotalScore)

As parameters x:F absent, calculate the total score of all students

3

=demo.cursor("select * from FAMILY")

 

4

=A3.groups(GENDER:gender;sum(AGE):TotalAge)

Group and order data by specified fields

5

=demo.cursor("select * from STOCKRECORDS where STOCKID<'002242'")

 

6

=A5.groups@n(if(STOCKID=="000062",1,2):SubGroups;sum(CLOSING):ClosingPrice)

The value of grouping expression is group number; put records whose STOCKID is “000062” to the first group and others to the second group; and meanwhile aggregate each group

7

=demo.cursor("select * from EMPLOYEE")

 

8

=A7.groups@u(STATE:State;count(STATE):Total)

The result set won’t be sorted by the grouping field

9

=demo.cursor("select * from EMPLOYEE")

 

10

=A9.groups@o(STATE:State;count(STATE):Total)

Compare each record with its next neighbor and won’t sort the result set

11

=demo.cursor("select * from EMPLOYEE")

 

12

=A11.groups@i(STATE=="California":IsCalifornia;count(STATE):count)

Start a new group if the current record meets the condition STATE=="California"

13

=file("D:/emp10.txt").cursor@t()

For data file emp10.txt, every 10 records are ordered by DEPT

14

=A13.groups@h(DEPT:DEPT;sum(SALARY):bouns)

As A13 is grouped and ordered by DEPT, use @h option to speed up grouping

15

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

 

16

=A15.cursor@m(3)

Return a multicursor

17

=A16.groups(STATE:state;sum(SALARY):salary)

Group the multicursor with groups function

 

groupx()[599][600]

Here’s how to use groupx() function.

ch.groupx()[601][602]

Description:

Group records in a channel and return a channel.

Syntax:

ch.groupx(x:F,…;y:G…)

Note:

The function groups records in channel ch according to expression x, by which the records are ordered, to get a channel having F,...G,… fields. Values of F field consist of values of x field in the first record of every group, and values of G field are the results of computing expression y, which is an aggregate function executed on ch, over each group. It aims to fetch the grouping result set from the channel. 

Options:

@n

With the option the value of expression x is a group number, which points to the desired group

Parameters:

ch

Channel

x

Grouping expression

F

Field name in the resulting table sequence

y

An aggregate function which only supports sum/count/max/min/top /avg/iterate; the parameter Gi should be given up if function iterate(x,a;Gi,…) is used

G

The aggregate fields in the resulting table sequence

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE ")

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A1.push(A2,A3)

Be ready to push the data in A1’s cursor into A2’s channel and A3’s channel, but the action needs to wait

5

=A2.groupx(DEPT:dept;sum(SALARY):TotalSalary)

Group and sort records by DEPT field

6

=A3.groupx@n(if(GENDER=="F",1,2):SubGroups;sum(SALARY):TotalSalary)

The value of expression x is a group number; put records where GENDER is “F” into the first group and others into the second group, and then aggregate each group

7

=A1.select(month(BIRTHDAY)==2)

 

8

=A1.fetch()

Attach a fetch operation to A7’s cursor

9

=A2.result()

Return the result as a cursor

10

=A3.result()

Return the result as a cursor

cs.groupx()[603][604]

Description:

Group the ordered records in a cursor and return result as a cursor.

Syntax:

cs.groupx(x:F,;y:G;n)

 

Note:

The function groups records in a cursor by grouping expression x to create a new cursor consisting of fields F,...G,… sorted by the grouping field x. The values F field are the value of x field of the first record in each group and G field gets values by computing y – the aggregate function with which records of cs is aggregated – on each group.

Options:

@n

Parameter n will be treated as a grouping expression to perform intra-grouping within the memory; x gets assigned with group numbers which can be used to define the groups.

@u

Won’t sort the result set by parameter x; mutually exclusive with @n.

Parameters:

cs

Records in a cursor

x

Grouping expression

F

Result field name

y

Aggregate function which only supports sum/count/max/min/top/ avg/iterate. When the function works with the iterate(x,a;Gi,…) function, the latter’s parameter Gi should be omitted

G

Aggregate field name

n

Number of buffer rows; its value is n times of the default if n is less than 1

Return value:

Cursor

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS='Class one'")

 

2

=A1.groupx(STUDENTID:ID;sum(SCORE):Scores).fetch()

3

=demo .cursor("select * from FAMILY")

 

4

=A3.groupx@n(if(GENDER=="Male",1,2):ID;sum(AGE):TotalAge).fetch()

The value of grouping expression is a group number. Put records whose GENDER is "Male" to the first group, and others to the second group. Meanwhile, aggregate every group of records

5

=demo.cursor("select * from EMPLOYEE")

 

6

=A5.groupx@u(STATE:State;count(STATE):TotalScore).fetch()

The result set isn’t sorted

Related functions:

A.group(xi,…)

A.group(x:F,…;y:G,…)

A.groups()

cs.groups()

cs.groupx()[605][606]

Description:

Group records in a cluster cursor and return a synchronously segmented cursor.

Syntax:

cs.groupx(x:F,…;y:G…;n)

 

Note:

The function groups records in cluster cursor cs by grouping expression x to create a new cluster cursor consisting of fields F,...G,… sorted by the grouping field x. The values F field are the value of x field of the first record in each group and G field gets values by computing y – the aggregate function with which records of cs is aggregated – on each group.

Options:

@c

 Won’t merge result sets returned by the nodes but return a cluster cursor segmented in the same way

Parameters:

cs

A cluster cursor

x

Grouping expression

F

Resulting field name

y

Aggregate function that only supports sum/count/max/min/top/avg/iterate; when the function works with iterate(x,a;Gi,…) function, the latter’s parameter Gi should be omitted

G

Aggregate field name

n

Number of buffer rows

Return value:

A cluster cursor

Example:

 

 

A

 

1

[192.168.31.72:8281, 192.168.31.72:8291]

 

2

=file@0z("orderpart.ctx", A1)

Open a cluster distributed file

3

=A2.create()

Open a cluster composite table

4

=A3.cursor()

Return a cluster cursor

5

=A4.groupx(EID:ID;count(~):IdCount)

Group A7 and perform count by EID, and return a cluster cursor

6

=A5.fetch()

 

7

=A3.cursor()

 

8

=A7.groupx(if(EID==4,1,2):ID;count(~):IdCount)

Put records where EID is 4 into the first group and others into the second group, and then count the EID values

9

=A8.fetch()

 

 

 

A

 

1

[192.168.0.110:8281,192.168.18.143:8281]

 

2

=file@0("emp.ctx", A1)

emp.ctx is a distributed file on nodes 192.168.0.110 and 192.168.18.143

3

=A2.create()

Open a cluster composite table

4

=A3.cursor()

Create a cluster cursor

5

=A4.groupx@c(GENDER:gender;sum(SALARY):totalSalary)

Perform group and aggregate operations over A4’s cluster cursor by GENDER without merging result sets returned by nodes and return a cluster cursor having the same segmentation way as A4’s

6

=A5.fetch()

Fetch data from the cluster cursor

hash()[607][608]

Description:

Return a hash value.

Syntax:

hash(xi,…;n)

Note:

The function calculates the hash value(s) over data items xi,and returns a positive integer less than parameter n.

Parameters:

xi

Data of any type

n

An integer greater than 1

Return value:

A positive integer

Example:

=hash(0.2;38)

7

=hash(2,52,94;100)

28

=hash("abc";10477)

2068

hbase_close()[609][610]

Description:

Close a HBase connection.

Syntax:

hbase_close(con)

Note:

This external library function closes HBase connections.

Parameters:

con

Database connection string

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

2

=hbase_close(A1)

Close the HBase connection

Related functions:

   hbase_open()

hbase_cmp()[611][612]

Description:

Compare data with the HBase-supplied comparator.

Syntax:

hbase_cmp(str[,r][,b])       Compare the current value with the threshold

Note:

This external library function compares data with the HBase-supplied comparator.

Options:

@p

Match the current value with the prefix

@n

Check if the current value is null but won’t perform matching

@r

Use a regular expression to match table data

@s

Use the threshold and table data, both of which are string type, to match up a string

@l

Convert a string type or a date/time/datatime type parameter to a Long type one

@b

Perform bit-level comparison using AND, OR and XOR operations

Parameters:

str

A string

r

 

 

 

Only use this parameter with @r option; its value can only be one of the following letters:

i=case insensitive  (Case-insensitive)

m=multiline,     (^ and $ can match up a line break within a string)

d=dotall,        (The dot symbol can match up a line break)

u=unicode case,  (Case-insensitive in matching up Unicode characters )

q=canon_eq     (Consider same characters in different character encodings as equal)

x=unix_lines,    (Consider \n as a line break only)

l=literal,        (Text mode)

c=comments    (Comment mode)

The value must be in quotation marks.

b

Only use this parameter with @b option; its value can only be one of the following: AND, OR, XOR; the value must be in quotation marks.

Return value:

Comparator handle

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

2

=hbase_cmp("13")

 

3

=hbase_filter("ValueFilter","eq",A2)

 

4

=hbase_scan(A1,"emp";filter:A4)

5

=hbase_cmp@p("136")

 

6

=hbase_scan(A1,"emp";filter:hbase_filter("ValueFilter","eq",A5))

7

=hbase_cmp@r("J","i")

 

 

 

8

=hbase_scan(A1,"emp";filter:hbase_filter("ValueFilter","eq",A7))

9

=hbase_cmp@s("sp")

 

10

=hbase_scan(A1,"emp";filter:hbase_filter("SingleColumnValueFilter","company","name","=",A9))

Related functions:

  hbase_open()

hbase_filter()

hbase_scan()

hbase_filter()[613][614]

Description:

Filter data with the HBase-supplied filter.

Syntax:

hbase_filter(filterName,filterArg)  Different filterName values represent different numbers and types of specific parameters, as shown in the following:

hbase_filter(ColumnCountGetFilter,n)

Get the first n values from each row

hbase_filter(ColumnPaginationFilter,limit,columnOffset)

For each row, get field values, whose number is limit, starting from the (columnOffset+1)th column

hbase_filter(ColumnPrefixFilter,str)

For each row, get field values whose corresponding column names have a prefix which can match up str

hbase_filter(ColumnRangeFilter,minColumn,boolean,maxColumn,boolean)

For each row, get values whose corresponding column names fall in a certain range; the parameter boolean indicates an open interval – when the value is false, or a closed interval – when the value is true

hbase_filter(DependentColumnFilter,family,qualifier)

Specify a column and perform filtering to get columns whose timestamp is different

hbase_filter(FamilyFilter,ifequal,my-family)

Specify a column family, whose name is my-family, to perform the filtering; the value of ifequal can be “=”, “=”, etc.

hbase_filter(FirstKeyOnlyFilter)

Get the first value from each row

hbase_filter(FirstKeyValueMatchingQualifiersFilter,column)

Get the first value from each row that satisfies the specified column qualifier

hbase_filter(FuzzyRowFilter,fuzzyKeysData)

Perform matching over fuzzy row key. Take a list parameter (List>) to do this. The list has a pair of byte arrays, in which the first one is the row key format, and the second one’s value is 0 or 1. 0 means a byte at same position in row key must match; 1 means a byte at same position in row key can be different.

hbase_filter(InclusiveStopFilter,stopRowKey)

Stop data scanning if a specified row is reached

hbase_(KeyOnlyFilter)

Will only return the key components, like rowkey, column family name, column name and timestamp

hbase_filter(MultipleColumnPrefixFilter,prefixes1,prefixes2,...prefixesN)

Allow to specify multiple column prefixes

hbase_filter(PageFilter,n)

Pigination filter for displaying n rows

hbase_filter(PrefixFilter,str)

Specify a prefix for rowkey

hbase_filter(QualifierFilter,cmp,cmpColumn)

To filter based on column qualifier; cmp is a comparison operator like equal (or=) and not equal (or !=); cmpColumn is column qualifier filtered out through comparator.

hbase_filter(RowFilter,cmp,cmpRow)

To filter based on row key; cmp is a comparison operator like equal (or=) and not equal (or !=); cmpColumn is row key filtered out through comparator.

hbase_filter(ValueFilter,cmp,cmpValue)

To filter based on vlaue ; cmp is a comparison operator like equal (or=) and not equal (or !=); cmpColumn is a value filtered out through comparator.

hbase_filter(SingleColumnValueExcludeFilter,family,columnName,ifequal,cmpValue)/ hbase_filter(SingleColumnValueFilter,family,columnName,ifequal,cmpValue

Filter rows based on specified column value; family is the column family name, ifequal is comparison operator, and cmpValue is the result filtered out through comparator. columnName column will be excluded with SingleColumnValueExcludeFilter, while included with SingleColumnValueFilter.

hbase_filter(RandomRowFilter,n)

Filter rows randomly and return a random result set with a certain probability. To perform same RandomRowFilter on same data set for multiple times, different result sets will be returned. Paramameter n is float type; all rows will be filtered away if n<=0, and all will be kept if n>=1.

hbase_filter(SkipFilter,hbase_filter(ValueFilter,ifequal,cmpValue))

A wrapper filter that filters an entire row if any of the cell is ineligible; work with ValueFilter.

hbase_filter(WhileMatchFilter,hbase_filter())

A wrapper filter that stops scanning as soon as the filtering condition is met.

hbase_filter(TimestampsFilter,timeStamp,boolean)

Return only values whose timestamps match up the specified timestamp.

Note:

This external library function filters data with the HBase-supplied filter.

Parameters:

filterName

HBase filter name

filterArg

Filter parameter

Return value:

Filter handle

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

2

=hbase_scan(A1,"emp")

All data of the emp table

3

=hbase_filter("ColumnCountGetFilter",3)

4

=hbase_scan(A1,"emp";filter:A3)

rowkey is a row name, and doesn’t belong to data columns

5

=hbase_filter("ColumnPaginationFilter",2, 2)

 

6

=hbase_scan(A1,"emp";filter:A5)

7

=hbase_filter("ColumnPrefixFilter","na")

8

=hbase_scan(A1,"emp";filter:A7)

9

=hbase_filter("ColumnRangeFilter","age", true, "name",false)

10

=hbase_scan(A1,"emp";filter:A9)

11

=hbase_filter("DependentColumnFilter","family","age")

12

=hbase_scan(A1,"emp";filter:A11)

13

=hbase_filter("FamilyFilter","=",hbase_cmp@s("family"))

 

14

=hbase_scan(A1,"emp";filter:A13)

15

=hbase_filter("KeyOnlyFilter")

 

16

=hbase_scan(A1,"emp";filter:A15)

17

=hbase_filter("FirstKeyOnlyFilter")

18

=hbase_scan(A1,"emp";filter:A17)

19

=hbase_filter("FuzzyRowFilter","row1",[1,1,0,0])

 

20

=hbase_scan(A1,"emp";filter:A19)

21

=hbase_filter("InclusiveStopFilter","row3")

 

22

=hbase_scan(A1,"emp";filter:A21)

23

=hbase_filter("MultipleColumnPrefixFilter","na","tel","position")

 

24

=hbase_scan(A1,"emp";filter:A23)

25

=hbase_filter("PrefixFilter","ro")

 

26

=hbase_scan(A1,"emp";filter:A25)

27

=hbase_filter("QualifierFilter","eq", hbase_cmp@s("name"))

 

28

=hbase_scan(A1,"emp";filter:A27)

29

=hbase_filter("RowFilter","eq", hbase_cmp("row1"))

 

30

=hbase_scan(A1,"emp";filter:A29)

31

=hbase_filter("ValueFilter","=", hbase_cmp("C++"))

 

32

=hbase_scan(A1,"emp";filter:A31)

33

=hbase_filter("SingleColumnValueFilter","family","tel" ,"eq",hbase_cmp@s("13"))

 

34

=hbase_scan(A1,"emp";filter:A33)

35

=hbase_filter("SingleColumnValueExcludeFilter","family","tel" ,"eq",hbase_cmp@s("13"))

 

36

=hbase_scan(A1,"emp";filter:A35)

37

=hbase_filter("SkipFilter",hbase_filter("ValueFilter","=", hbase_cmp@s("aaa")))

 

38

=hbase_scan(A1,"emp";filter:A37)

39

=hbase_filter("FirstKeyValueMatchingQualifiersFilter","name")

 

 

 

 

 

 

 

 

40

 

 

 

 

 

 

 

=hbase_scan(A1,"emp";filter:A39)

41

=hbase_filter("TimestampsFilter",1488855959195,1488855959219,1488855959145,false)

 

42

=hbase_scan(A1,"emp";filter:A41)

43

=hbase_filter("RandomRowFilter",0.5)

Filer rows at random

Related functions:

hbase_cmp()

hbase_scan()

hbase_filterlist()[615][616]

Description:

Filter data with multiple filters.

Syntax:

hbase_filterlist(filterHandle1,filterHandle2,...filterHandleN) 

Note:

This external library function can accommodate another hbase_filterlist() function within it. By default the filtering conditions in all filters must be met at the same time.

Options:

@o

Every filter is independent in filtering data.

Parameters:

filterHandle

Filter handle

Return value:

Filter handle

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

2

=hbase_filter("ColumnPaginationFilter",2, 0)

 

 

 

 

 

3

 

 

 

 

=hbase_scan(A1,"emp";filter:A2)

4

=hbase_filter("ColumnPrefixFilter","na")

 

 

 

 

 

5

 

 

 

 

=hbase_scan(A1,"emp";filter:A4)

6

=hbase_filterlist(A2,A4)

 

7

=hbase_filterlist@o(A2,A4)

 

 

 

 

 

8

 

 

 

 

=hbase_scan(A1,"emp";filter:A6)

 

 

 

9

 

 

 

=hbase_scan(A1,"emp";filter:A7)

Related functions:

   hbase_filter()

   hbase_scan()

hbase_get()[617][618]

Description:

Query data in HBase database and return a single row.

Syntax:

hbase_get(client,tableName,rowName,family:column:type:alias,family2:column2:type:alias2,...;filter:f,timeRange:[t1,t2],timeStamp:t)

Note:

This external library function queries a HBbase database to return a sing-row table sequence.

Parameters:

client

Database connection information

tableName

Table name

rowName

Row name

family

Column family name

column

Colum name

type

Data type; can be omitted

alias

Another name of a column; can be omitted

filter:f

filter:’ is a fixed format, and parameter f means filter handle; can be omitted

timeRange:[t1,t2]

timeRange:’ is a fixed format, and parameters t1 and t2 specify a range of timestamp; can be omitted

timeStamp:t

timeStamp:’ is a fixed format, and parameter t is timestamp; can be omitted

Return value:

Table sequence

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

2

 

 

=hbase_scan(A1,"emp")

Query all table data

3

=hbase_get(A1,"emp","row3","company:name"::cname,"company:position":string:cpos,"family:tel":string)

Find a row whose rowkey is row3, and rename column names

Related functions:

   hbase_open()

   hbase_scan()

hbase_open()[619][620]

Description:

Create a HBase connection.

Syntax:

hbase_open(hdfsUrl, zkUrl1,zkUrl2,...zkUrlN)

Note:

This external library function connect to a HBase database. The format of parameter hdfsUrl is :hdfs://ip, and the format of parameter zkUrl is :zkServerIp. Can connect to multiple nodes.

Parameters:

hdfsUrl

HDFS connection information

zkUrl

Zookeeper connection information

Return value:

Cursor

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

Connet to a HBase database

2

=hbase_open("hdfs://192.168.0.76", "192.168.0.76, master, 192.168.1.66")

 

hbase_scan()[621][622]

Description:

Query a HBase database and return result as a cursor or a table sequence.

Syntax:

hbase_scan(client,tableName,rowName,family:column:type:alias,family2:column2:type:alias2,...;rowPrefix:x,filter:f,startRow:startrow,stopRow:stoprow,timeRange:[t1,t2],timeStamp:t)

Note:

This external library function gets data from an HBase database and by default returns a table sequence. Return a cursor when there’s @c option.

Options:

@c

Return a cursor

Parameters:

client

Database connection information

tableName

Table name

rowName

Row name

family

Column family name

column

Column name

Type

Data type; can be omitted

alias

Another name of a column; can be omitted

rowPrefix:x

rowPrefix:’ is a fixed format; parameter x is the prefix of rowKey

filter:f

Filter handle

startRow:startrow

startRow:’ is a fixed format; parameter startrow represents the starting row, which will be included in data retrieval

stopRow:stoprow

stopRow:’ is a fixed format; parameter stoprow represents the ending row, which will be excluded in data retrieval

timeRange:[t1,t2]

timeRange:[,]’ is a fixed format; parameter t1 is the starting timestamp whose value will be retrieved, and parameter t2 is the ending timestamp whose value won’t be retrieved

timeStamp:t

Timestamp

Return value:

A table sequence/cursor

Example:

 

A

 

1

=hbase_open("hdfs://192.168.0.8", "192.168.0.8")

 

 

 

 

2

 

 

 

=hbase_scan(A1,"emp")

Query all table data

3

 

=hbase_scan@c(A1,"emp")

Return a cursor

 

 

 

4

 

 

 

=A3.fetch()

5

=hbase_filter("SingleColumnValueFilter","family","tel","=",hbase_cmp@s("13"))

 

 

 

6

 

 

=hbase_scan(A1,"emp";filter:A5)

Return data filtered out by A5

 

 

7

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3,stopRow:row7)

Get data from row3 to row7, which is excluded, from A5’s filtered data

8

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,rowPrefix:row1)

 

Get a row whose prefix is row1 from A5’s filtered data

9

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3,stopRow:row7,timeStamp:1488855958071)

 

10

=hbase_scan(A1,"emp","company:name":string:cname,"company:position":string:cpos,"family:tel":string;filter:A5,startRow:row3,stopRow:row7,timeRange:[1488855958071,1488855958255])

 

Related functions:

hbase_open()

hbase_cmp()

hdfs_client()[623][624]

Description:

Connect to the HDFS file system and return an HDFS client object.

Syntax:

hdfs_client( xmlfile, …;url )

Note:

This external library function connects to the Hadoop server and returns an HDFS client object.

Parameters:

xmlfile

A Hadoop configuration file, like hdfs-site.xml, core-site.xml, mapred-site.xml and yarn-site.xml. Mulitple parameter files are separated by the comma; the parameter can be omitted. Users can do the configuration according to their needs. Support absolute paths only.

url

The URL format is scheme://authority/path. Scheme is the protocol name, which can be an ordinary file or an HDFS file; use an HDFS file name when accessing the HDFS file system and use an ordinary file name when accessing the local file system; authority is the host name; path is a string of the file (or directory) path.

Return value:

An HDFS client object

Example:

 

A

 

1

=hdfs_client("D:/core-site.xml","D:/hdfs-site.xml";"hdfs://192.168.0.76:9000")

Connect to the HDFS; the Hadoop configuration files are saved in the root directory of D drive on the local machine; can do the configuration based on the actual needs

2

=hdfs_client(;"hdfs://192.168.0.8:9000")

Connect to the HDFS with the parameter xmlfile omitted

hdfs_close()[625][626]

Description:

Close the HDFS connection.

Syntax:

hdfs_close(HdfsClient)

Note:

This external library function closes a connection to the HDFS file system.

Parameters:

HdfsClient

An HDFS connection

Example:

 

A

 

1

=hdfs_client(;"hdfs://192.168.0.8:9000")

Connect to the HDFS file system

2

=hdfs_close(A1)

Close the HDFS connection

hdfs_dir()[627][628]

Description:

Get the list of all files in a specified path.

Syntax:

hdfs_dir(hdfsfile, path)

Note:

This external library function lists names of all files in a specified path in an HDFS file system.

Parameters:

hdfsfile

An HDFS file object

path

A relative path within the path containing the HDFS file

Options:

@d

List names of all directories in the specified path

@p

List the full paths of all directories and files in the specified path

@m

Create a directory; return true if the directory is created, otherwise return false

@r

Delete a directory; return true if the operation is successful, otherwise return false

Return value:

A sequence or a boolean value

Example:

 

A

 

1

=hdfs_client(;"hdfs://192.168.0.8:9000")

Connect to the HDFS file system

2

=hdfs_dir@p(A1,"/user")

List the full paths of all directories and files under the /user directory

3

=hdfs_dir@d(A1,"/user")

List names of all directories under the /user directory

 

4

=hdfs_dir(A1,"/user")

List all file names under the /dr1 directory

5

=hdfs_dir@m(A1,"/user/h1")

Create a directory named h1 under the /user directory

 

6

=hdfs_dir@r(A1,"/user/h1")

Delete the /user/h1 directory

 

7

=hdfs_close(A1)

Close the HDFS connection

hdfs_file()[629][630]

Description:

Open a specified directory and return an HDFS file flow.

Syntax:

hdfs_file(HdfsClient,file:cs )

Note:

The function returns an HDFS file flow. The file extension determines the compression method; support writing data in a stream style into a non-segmental file, but there is no such a restriction on reading data in.

Parameters:

HdfsClient

An HDFS Client object

file

The name of the to-be-loaded Hadoop file

cs

The charset embedded in JVM; by default it is the default value for a virtual machine

Return value:

A file object

Example:

 

A

 

1

=hdfs_client(;"hdfs://192.168.0.8:9000")

Connect to the HDFS file system

2

=hdfs_file(A1,"/user/stu.txt":"GBK")

Read the HDFS file and return a file object

3

=A2.read@n()

Read the content of the file object as a string and return it

4

=A2.import@t()

Read the content of the file object as the records to form a table sequence and return it

 

5

=A2.cursor().fetch ()

Create a cursor based on a file object and fetch records from the cursor

6

=hdfs_close(A1)

Close the HDFS connection

 

hive_client()[631][632]

Description:

Create a Hive database connection.

Syntax:

hive_client(hdfsUrl,thriftUrl,dbname,hdfsUserName)

Note:

This external library function connects to a Hive database. The format of the parameter hdfsUrl is hdfs://ip:port, which represents the HDFS file’s IP and port number. The format of the parameter thriftUrl is thrift://ip:port, which represents the Thrift file’s IP and port number. The parameter dbname is database name. hdfsUserName is the user name for an HDFS file.

Parameters:

hdfsUrl

HDFS file connection information

thriftUrl

Thrift file connection information

dbname

A database name

hdfsUserName

HDFS file user name

Return value:

Cursor.

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","hive","asus")

Connect to the hive database

Related functions:

hive_close()

hive_cursor()

hive_query()

hive_close()[633][634]

Description:

Close a Hive database connection.

Syntax:

hive_close()

Note:

This external library function closes connection to a Hive database.

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","hive","asus")

 

2

=hive_close()

Close connection to the hive database

Related functions:

hive_client()

hive_cursor()

hive_query()

hive_cursor()[635][636]

Description:

Query a Hive database and return the result as a cursor.

Syntax:

hive_cursor(con,sql)

Note:

This external library function performs a SQL query and returns the result as a cursor. The parameter con is database connection.

Parameters:

con

Database connection string.

sql

A SQL query statement, like select * from table.

Return value:

Cursor

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","hive","asus")

Connect to the hive database

2

=hive_cursor(A1, "select  *  from  table")

Return a cursor

3

=hive_close()

 

Related functions:

hive_close()

hive_client()

hive_query()

hive_execute()[637][638]

Description:

Execute Hive’s SQL-like queries.

Syntax:

hive_execute(con,sql)

Note:

This external library function supports executing Hive’s SQL-like statements, including create table, drop table, load data, insert into, insert owerwrite, and create view. The statement Load data local inpath supports only operations on local files, rather than those on a Hive server; the statement Load data inpath supports operations on HDFS files, over which the user needs to have the corresponding privilege.

Parameters:

con

Database connection string

sql

A SQL query statement, which supports Hive’s SQL-like queries such as create table, drop table, load data, insert into, insert owerwrite, and create view

Return value:

A boolean value

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000/","thrift://192.168.0.8:9083","hive","asus")

Connect to the hive database

2

=hive_execute(A1, "create table stu2( id string, name string,age string)")

Create a table

3

=hive_execute(A1, "drop table stu")

Drop a table

4

=hive_execute(A1, "alter table stu2 add columns (ncol string)")

Add a column to the table

5

=hive_execute(A1, "insert into stu2 values ('2','dfff','21','lll')")

Insert data into the table

6

=hive_execute(A1,"load data local inpath 'D:\\haha.txt' overwrite into table ha")

Upload a local txt file to overwrite a Hive table

Related functions:

hive_client()

hive_query()[639][640]

Description:

Query a Hive database and return the result as a sequence.

Syntax:

hive_query(con,sql)

Note:

This external library function executes a certain SQL query on a Hive database, and returns the query result as a table sequence. The parameter con represents database connection.

Parameters:

con

Database connection string.

sql

A SQL query statement, like select * from table.

Return value:

Table sequence

Example:

 

A

 

1

=hive_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","hive","asus")

Connect to the hive database

2

=hive_query(A1, "select  *  from  table")

Query data in table

3

=hive_close()

 

Related functions:

hive_close()

hive_cursor()

hive_client()

hosts()[641][642]

Description:

Search the main processes to get nodes containing specified data zones.

Syntax:

hosts(h,n)

Note:

The function gets the nodes containing data zones from 1 to n from the sequence of main processes h and returns them by data zone numbers. When parameter n is 0, return all available nodes in h.

It performs the searching by node computing ability in descending order. For example, after finding the node containing data zone 1, the function assumes that the number of subtasks running on it is less than the preferred task number and re-assests the computing abilities of the other nodes to find the node holding data zone 2.

Parameters:

h

The sequence of main processes

n

Data zone number

Options:

@i

Find data zones numbered from 1 to n from the main processes and return them as a sequence. Use default hosts method to find if one or more data zones cannot be found; return null if the second searching fails.

@0

Find available nodes specified by parameter n without referencing the data zones; use this option at the second searching when it works with @i option.

Return value:

A sequence

Example:

hosts("192.168.0.116:8281",2)

hosts(["192.168.0.116:8281","192.168.0.116:8282"],0)

Parameter n is 0 and the function returns the available nodes

hosts(["192.168.0.116:8281","192.168.0.116:8282","192.168.0.129:8281"],3)

hour()[643][644]

Description:

Get the hour from a specified datetime.

Syntax:

hour(datetimeExp)

Note:

Get the hour from the specified time datetimeExp.

Parameters:

datetimeExp

Date or standard datetime format string

Return value:

Integer

Example:

hour("1983-12-15")

0

hour("1983-12-15 10:30:25")

10

hour(datetime("2006-01-15 13:20:30"))

13

Related functions:

year()

month()

day()       

minute()

second()

millisecond()

 

 

htmlparse()[645][646]

Description:

Get text data under a specified tag in an html file.

Syntax:

s.htmlparse(tag:i:j,…)  

Note:

The function gets the jth text file under the ith tag from html file s. Get all data in the html file when there aren’t parameters.

Parameters:

s

Content of an html file

tag

A tag in an html file; if the tag’s value is “table”, get all data under it

i

An integer

j

An integer

Return value:

A sequence

Example:

 

A

 

1

=file("D:/test.html").read()

Read the content of an html file

2

=A1.htmlparse("a":11:0)

Get the 1st text file under the 12th <a> from A1’s html file

3

=A1.htmlparse("a":11:0, "span":8:0)

Get text files under two tags from A1’s html file

4

=A1.htmlparse("table":7)

Get all content under the 8th <table>

httpfile()[647][648]

Description:

Package the returned result of URL as the file flow and return it.

Syntax:  

httpfile(url:cs,post:cs;header)

Note:

The function packages the returned result of URL string of HTTP service into a file flow and returns it, which can only be retrieved with segmentation forbidden.

Parameters:  

url

HTTP service in the URL string format.

 

The parameter port is the port number configured in Http Server. The dfx path is the one relative to the main directory configured in Tool -> Options -> Environment.

Two scenarios about the syntax of writing a URL for performing an HTTP service:

I. esProc style

  Here are the syntax of writing a URL when using esProc’s HTTP service:

    http:// IP:port /dfx1.dfx()

    http:// IP:port /dfx1.dfx(arg1,arg2,...)

http://IP: port/dfx1.dfx(...)dfx2.dfx

http://[IP6]:port /dfx1.dfx()

1. There’s only one dfx file. If the dfx file has parameters, write them in order in the parentheses after the file; use comma to separate the multiple parameters. If the dfx file hasn’t parameters, the parentheses are empty; in this case the format of the file’s return value is what a user expects.

2. There are two dfx files. When the return value format a user wants is different from the format of the return value in dfx1 file, dfx2 file is used to change the format of the return value in dfx1 into a desired one. The syntax for dfx1 is the same as the that for the dfx file in the first scenario, but here the file supports only the single result set. dfx2 file is a program with only one parameter, which is the return value of dfx1 file.

   dfx2 file converts the format of the return value in dfx1 file into a desired one and return it as a result. For example, in the table sequence returned by dfx1 file, fields are by default separated by “|”; you can change dfx1’s return value in dfx2 to use the blank space as the separator.

If the second result set, which must contain strings, is returned, it is treated as the header.

3.     For IPv6, bracket the IP address with [].

II. SAP style

http://IP:port /sapPath/dfx    No parameters

http://IP:port /sapPath/dfx/arg1/arg2,...     Use the slash sign (/) to separate the parameters

   sapPath is relative to the dfx file’s main director; it can be a multilevel directory structure or an empty string. sapPath should be configured in [installation directory]/config/httpServer.xml. A sapPath can contain multiple paths which sparated by comma. dfx represents a dfx file’s name, which doesn’t have an extension. arg contains both the name and value; the name consists of all letters and the value always begins with a number.

Note:To access database data from the dfx file, configure the value of autoConnect property as true in raqsoftconfig.xml’s DB node; you can’t connect to the database if skipping this configuration.

cs

Character set, which supports JVM's built-in character set, and which by default is the default value of virtual machine.

post

 

header

A parameter submitted with POST method with a syntax like p1=v1&p2=v2…. Can be omitted.

The header property can have multiple items, like headerName1:value1,headerName2:value2,... (the format is "property":"value",…); or can be omitted. The execution of .property() function over a returned file object will return the header property.

Return value:

File flow

Example:

 

A

 

1

=httpfile("http:// localhost:9090/p1.dfx()":"GBK").import@t()

Here’s the p1.dfx file:

Load p1.dfx file from the http server, with the charset as GBK

2

=httpfile("http://localhost:9090/p2.dfx(3)":"GBK").import@t()

Here’s the p2.dfx file where StuId is the parameter

3 is the value of parameter in p2.dfx file

3

=httpfile("http://localhost:9090/p3.dfx(3Class%20two)":"GBK").import@t()

Here’s the p3.dfx file where StuId and Class are the parameters

The two parameters are separated by a comma

4

=httpfile("http://localhost:9090/http2.dfx(30)").import@t()

Here’s the http2.dfx where id is the parameters

5

=httpfile("http://127.0.0.1:9090/http2.dfx(30)http3.dfx").import@t()

Here’s the http3.dfx

Process the return value of http2.dfx in http3.dfx

6

=httpfile("http:// 192.168.0.131:6080/myweb/servlet/testServlet?table=employee&type=json")

testServlet returns a string of employee data in the JSON format

7

=httpfile("http://localhost:6080/myweb/servlet/testServlet":"GBK","table=employee&type=json":"GBK")

 

8

=httpfile("http://127.0.0.1:8182/scada/v1/uaes/datapoint/history/rawvalue/rtdb/access","{\"nodeIds\":[\"ns=102;s=AI_002_0600.PV\"], \"startTime\":\"2018/6/28 13:10:00\", \"endTime\":\"2018/6/28 13:11:0\", \"returnBounds\":\"false\", \"maxSizePerNode\":\"10\"}"; "Content-Type":"application/json")

 

9

=httpfile("http://192.168.74.1:8508/sap/arg/arg22").read()

Sap style; configure the style in [installation directory]/config/httpServer.xml; here sapPath is "/sap"; it can contain multiple values that separated by comma, like sapPath="/sap,/sap/en". The dfx file name doesn’t have an extension and the name and value of a parameter are written continuously

10

=httpfile("http://192.168.74.1:8508/arg/arg22").read()

There’s no need to configure sap if the file is under the main directory; and the port number can be directly followed by /dfx

11

httpfile("http://[fe80::2918:abe0:3017:8401%15]:8503/emp.dfx()":"GBK").import@t()

Load emp.dfx file through http service via IPv6 connectivity using GBK charset

icursor()[649][650]

Here’s how to use icursor() functions.

T.icursor()[651][652]

Description:

Use index to filter an entity table according to the filtering condition.

Syntax:

T.icursor(C,…;w,I)

Note:

The function filters entity table T according to filtering condition w using index I and returns an ordinary cursor; automatically get the index if parameter I is absent.

Parameters:

T

An entity table

C

To-be-retrieved columns in the entity table; get all columns when the parameter is absent

w

Filtering condition, in which the filtering field for T must be the same as the indexing field

I

Index name; can be omitted

Options:

@s

Make sure the result set is ordered by the index and large result sets are supported; the option supports an entity table generated from a file group

@u

Handle multiple conditions joined up with && from left to right while the default is handling them in an optimal order

Return value:

A single-thread cursor

Example:

 

A

 

1

=file("D:\\emp1.ctx")

 

2

=A1.create(#EID,NAME;EID)

Create a composite table where EID field is the key by which records are segmented

3

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

 

4

=A2.append(A3)

 

5

=A2.attach(table1,DEPT,GENDER)

Add an attached table to the base table

6

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

 

7

=A5.append(A6)

Append cursor records to the attached table

8

=A7.index(test_index,GENDER=="F";DEPT;)

Create an index named test_index

9

=A7.icursor(;DEPT=="HR",test_index)

Use index test_index to get all columns where DEPT is HR from entity table table1 and return the result as a cursor

10

=A9.fetch()

Fetch data from the cursor

 

T.icursor()[653][654]

Description:

Use index to filter a cluster table according to the filtering condition.

Syntax:

T.icursor(C,…;w,I)

Note:

The function filters cluster table T according to filtering condition w using index I; automatically get the index if parameter I is absent.

Parameters:

T

A cluster table

C

To-be-retrieved columns in the cluster table; get all columns when the parameter is absent

w

Filtering condition, in which the filtering field for T must be the same as the indexing field

I

Index name; can be omitted

Options:

   @s    Make the result set ordered by the index and support a big result set

Return value:

A cluster cursor

Example:

 

A

 

1

=file@z("emp1.ctx","192.168.0.101:8281")

Open a cluster file

2

=A1.create()

Create a cluster table

3

=A2.attach(table1)

Retrieve cluster table table1

4

=A3.index(test_index2,GENDER=="F";DEPT;)

Create index file test_index2

5

=A3.icursor(;DEPT=="HR",test_index2)

Use index test_index2 to get all columns in A3’s cluster table where DEPT is HR and return the result as a cluster cursor

6

=A5.fetch()

7

=A2.index(test_index1,EID<16;NAME;)

Create index file test_index1

8

=A2.icursor(EID,SURNAME;NAME=="Smith",test_index1)

Use index test_index1 to get EID column and SURNAME column in A2’s cluster table where NAME is SMITH and return the result as a cluster cursor

9

=A8.fetch()

 

icount()[655][656]

Here’s how to use icount() function.

A.icount()[657][658]

Description:

Count the number of distinct members in a sequence.

Syntax:

A.icount()

 

Note:

The function calculates the number of distinct members in a sequence A.

Parameters:

A

A sequence of n members

Options:

   @o   Remove duplicates by comparing neighboring members

Return value:

A numerical value

Example:

 

A

 

1

=["a","c","d","e","f","a","a"]

 

2

=A1.icount()

5

3

=A1.icount@o()

6

 

id()[659][660]

Here’s how to use id() function.

A.id()[661][662]

Description:

Get distinct values from a sequence.

Syntax:

A.id(xi,…;n)

Note:

The function gets top n distinct values of the expressions xi,…. If the number of distinct values in an expression x is less than n, return all distinct values as a sequence; the result set consists of one ordinary sequence when there is only one expression x.

Parameters:

xi

An expression; use ~ to represent x if the latter is omitted

n

 The number of to-be-retrieved distinct values counting from the beginning; return all values if it is absent

Options:

@o

Without sorting, remove the neighboring duplicate members only

@u

Do not sort the result set by x; it doesn’t work with @o

@h

Used over a grouped table with each group ordered to speed up grouping

Return value:

The new sequence composed of the distinct values of x

Example:

 

A

 

1

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

 

2

=A1.id(DEPT)

Sort members in ascending order

3

=A1.id@o(DEPT)

No sorting

4

=A1.id([DEPT,GENDER])

 Get the distinct values after sorting by DEPT & GENDER

5

=["a","b","c","a"].id()

Omitting x indicates it is the sequence members themselves that will be computed to get the distinct values. Return ["a","b","c"] as with this case

6

=A1.id@u([DEPT,GENDER])

Do not sort the result set by x

7

=A1.id(DEPT,GENDER)

Return all distinct values as parameter n is absent

 

8

=A1.id(DEPT,GENDER;4)

Return the first 4 distinct values; return all GENDER values as the field has less than 4 distinct values

9

=file("D:/emp10.txt").import@t()

For data file emp10.txt, every 10 records are ordered by DEPT

10

=A9.id@h(DEPT)

As A19 is grouped and ordered by DEPT, @h option is used to speed up grouping

Related functions:

A.    group(xi,…)

ch.id()[663][664]

Description:

Generate a channel consisting of values of one or more fields.

Syntax:

ch.id(xi,…;n)

Note:

The function generates a channel containing a sequence of sequences, each of which is made up of values of xi field in channel ch. Get at most n values for each xi field; return a channel containing one sequence when there is only one xi field. It is for getting the result set from the channel.

Parameters:

ch

Channel

xi

Expression; use comma to separate multiple expressions

n

Integer; can’t be omitted

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE")

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A2.id(#1,DEPT;10)

 

5

=A3.id(DEPT;5)

 

6

=A1.push(A2,A3)

Push data in A1’s cursor into A2’s channel and A3’s channel

7

=A1.fetch()

 

8

=A2.result()

9

=A3.result()

 

cs.id()[665][666]

Description:

Generate a sequence consisting of values of fields in a given cursor.

Syntax:

cs.id(xi,…;n)

Note:

The function generates a sequence of sequences, each of which is made up of values of xi field in cursor cs. Get at most n values for each xi field; return a sequence when there is only one xi field.

Parameters:

cs

Cursor

xi

Expression; use comma to separate multiple expressions

n

Integer; return all values when omitted

Return value:

Sequence

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE" )

 

2

=A1.id(#1,DEPT;5)

3

=demo.cursor("select * from EMPLOYEE" )

 

4

=A3.id(DEPT;5)

 

if[667][668]

Here’s how to use if statment.

if x[669][670]

Description:

The introduction of if statement.

Syntax:

if x

Note:

The statement executes the if code block if x is true and skip if code block if x is false.

Parameters:

x

A boolean expression. If the value is true, then execute if code block. Otherwise, skip it.

Example:

 

A

B

 

1

=6

 

16

2

if A1>5

 

if code block

3

 

>A1=A1+10

Related functions:

if x …{ else { if x}… }

if x … else

if x else

if x …{ else { if x}… }[671][672]

Description:

The introduction of if statement.

Syntax:

if  x 

…                    The if code block

{else {if x}}

…                     The else or else if code block. When else or else if is not found, then else or else if code block does not exist.

Note:

If the conditional expression x is evaluated as true, then execute the if code block, otherwise, skip the if code block and execute the code block of else or else if.

Parameters:

x

A boolean expression. If the result is true, then execute if code block, otherwise, execute the else or else if code block, if any. If no else or else if code block is available, then the if statement terminates.

Example:

 

A

B

C

 

1

=13

=2

 

C1 returns 7

2

if(A1>10)

 

 

 

3

 

if(B1==1)

>C1=2+3

 

4

 

else if(B1==2)

>C1=3+4

 

5

 

else if(B1==3)

>C1=4+5

 

6

else if(A1>5)

 

 

 

7

 

>C1=5+6

 

 

Related functions:

if x … else

if x else

if x

if x…else …[673][674]

Description:

The introduction of if statement.

Syntax:

if  x …  else …  

Note:

if and else are in the same line. If x is true, then execute the code between if and else; if x is false, execute the code after else till the end of this line. The else… part can be omitted.

Parameters:

x

A boolean expression

Example:

 

A

B

C

D

 

1

=2

 

 

 

A1 returns 7

2

if A1>5

>A1=A1+4

else

>A1=A1+5

 

Related functions:

if x …{ else { if x}… }

if x else

if x

 

if x else[675][676]

Description:

The introduction of if statement.

Syntax:

if  x

    …

else 

…           

Note:

if and else must be in the same column. Execute if code block if x is true and execute else code block if x is false. The else part can be omitted.

Parameters:

x

A boolean expression. If evaluated to be true, then execute if code block, otherwise, execute else code block.

Example:

 

A

B

 

1

=3

 

 

2

if A1>5

 

if code block

3

 

>A1=A1+10

4

else

 

else code block

5

 

>A1=A1+15

Related functions:

if x …{ else { if x}… }

if x … else

if x

if()[677][678]

Description:

Calculate boolean expressions from left to right. if the result is true, return true value; otherwise return default value or false value.

Syntax:

if(a)

If a is true, then return true. Otherwise, return false

if(a,b,c)

If a is non-null and non-false, then return b; otherwise return c, which is null by default.

if(x1:y1,…,xk:yk;y)

Equivalent to if(x1,y1,if(x2,y2,…,if(xk,yk,y)))

Note:

This function calculates from left to right, and returns different values based on the different results of computing the boolean expressions. Return the corresponding result for the first expression whose value is trure and ignore other boolean expressions. If none of the boolean expression has true value, but there is a default value expression, then return the default value; if there is no such a default value expression, return null.

Parameters:

a

Boolean expression

b

Value expression. If the result of a is true, then return the result of b

c

Value expresssion. If the result of a is false, then return the result of c

xk

Boolean expression

yk

Value expression. If the result of xk is true, then return its result.

y

Default value expression. If all the results of boolean expressions are false, then return the result of this expression.

Return value:

The data type is dynamic, and is determined by the result of value expression. If the corresponding value expression is absent, then return null.

Example:

 

A

 

1

=if(2>1,"Truth","Fallacy")

Truth

2

=85

 

3

=if(A2>90:"Excellent",A2>80:"Good",A2>60:"Passed","Failed")

Good

4

>A2=300

 

5

=if(A2>100:,A2>90:"Excellent",A2>80:"Good",A2>60:"Passed","Failed")

null

6

=if(A2>100)

true

Related functions:

case()

between()

ifa()[679][680]

Description:

Find whether an object is a sequence.

Syntax:

ifa(x)

Note:

The function finds whether the parameter x is a sequence.

Parameters:

x

The object to be judged

Return value:

A boolean value

Example:

 

A

 

1

=ifa([1,2,3])

True

2

=ifa(123)

False

Related functions:

ift()

ifr()

ifv()

ifdate()[681][682]

Description:

Find whether the type of parameter is date or datetime.

Syntax:

ifdate(exp)

Note:

The function finds whether the type of parameter exp is date or datetime.

Parameters:

exp

Expression of any data type

Return value:

Boolean value

Example:

ifdate("2006-10-10")

false

ifdate(date("2006-10-10"))

true

ifdate(date("2006-10-10 10:20:30"))

true

ifdate("20061010")

false

ifdate("10:20:30")

false

Related functions:

iftime()

ifn()[683][684]

Here’s how to use ifn() function.

A.ifn()[685][686]

Description:

Get the first non-null member of a sequence.

Syntax:

A.ifn()

Equivalent to ifn(x1,…,xn)

Note:

The function gets the first non-null member of sequence A.

Parameter:

A

A sequence with the length of n

Return value:

The first non-null member of the sequence.

Example:

 

A

 

1

=[1,2,4].ifn()

1

2

=[null,2,3,4].ifn()

2

3

=[null,2,null,4].ifn()

2

4

=ifn(null,1,2,4)

1

Related functions:

    A.ifn(x)

A.ifn(x)[687][688]

Description:

Compute x with each member of the sequence and return the first non-null member of the new sequence.

Syntax:

A.ifn(x)

Equivalent to A.(x).ifn()

Note:

The function loops through members of sequence A to compute expression x and return the first non-null member of the new sequence.

Parameters:

A

A sequence

x

Generally an expression of a single field name, or a legal expression composed of multiple field names

Return value:

The first non-null member of the new sequence

Example:

 

A

 

1

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

 

2

=A1.ifn(SALARY)

Return the first non-null value of SALARY

3

=A1.(SALARY+100).ifn()

Add 100 to the salary of each employee and return the salary of the first employee

Related functions:

    A.ifn()

ifnumber()[689][690]

Description:

Find whether the parameter is of numeric data type.

Syntax:

ifnumber( Exp )

Note:

The function finds whether the parameter Exp is of numeric data type.

Parameters:

Exp

Expression of any data type

Return value:

Boolean value

Example:

ifnumber("abc")

false

ifnumber("1234")

false

ifnumber(1234)

true

ifnumber("1234sss")

false

Related functions:

      ifstring()

ifr()[691][692]

Description:

Find whether an object is a record.

Syntax:

ifr(x)

Note:

The function finds whether the parameter x is a record.

Parameter:

x

Any data object, for example a constant, an expression, a record, a record sequence, a sequence or a table sequence.

Return value:

true/false

Example:

 

A

 

1

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

 

2

=ifr(A1(1))

true

3

=ifr(A1)

false

4

=ifr(A1(1).BIRTHDAY)

false

Related functions:

ift()

ifa()

ifv()

ifstring()[693][694]

Description:

Find whether the parameter is of string data type.

Syntax:

ifstring(Exp)

Note:

The function finds whether the parameter Exp is of string type.

Parameter:

Exp

Expression of any data type

Return value:

Boolean value

Example:

ifstring("abc")

true

ifstring(1234)

false

ifstring("1980-01-01")

true

ifstring(date("1980-01-01"))

false

Related functions:

ifnumber()

ift()[695][696]

Description:

Find whether an object is a table sequence.

Syntax:

ift(x)

Note:

The function finds whether the parameter x is a table sequence.

Parameter:

x

Any object, for example a constant, an expression, a record, a record sequence, a sequence or a table sequence.

Return value:

true/false

Example:

 

A

 

1

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

 

2

=ift(A1(1))

false

3

=ift(A1)

true

4

=ift([1,2,3])

false

Related functions:

ifr()

ifa()

ifv()

iftime()[697][698]

Description:

Find whether the parameter is of time data type.

Syntax:

iftime(exp)

Note:

The function finds whether the parameter exp is of time type.

Parameter:

exp

Expression of any data type

Return value:

Boolean value

Example:

iftime("10:20:30")

false

iftime(time("10:20:30"))

true

iftime("2006-10-10")

false

iftime("2006-10-10 10:20:30")

false

iftime("20061010")

false

Related functions:

ifdate()

ifv()[699][700]

Description:

Check whether a variable exists.

Syntax:

ifv(v)

Note:

This function is mainly used to find if any variable is added to the current execution environment by the external program when the external program calls the program cellset. Generally, there is no need to check the defined variable in the cellset script. They are there for sure if you've defined them.

Parameters:

v

Parameter name

Return value:

Boolean value

Example:

 

A

 

1

>arg1=1

 

2

=ifv(arg1)

true

Related functions:

ift()

ifa()

ifr()

ifx_close()[701][702]

Description:

Close Informix database connection.

Syntax:

ifx_close(ifxconn)

Note:

The function closes connection to Informix database.

Parameter:

ifxconn

Ifxconn object

Example:

 

A

 

1

="d:/frag.txt"

A fragmentation information file

 

 2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli://192.168.0.3:9088/tpch:informixserver=tpch&user=informix&pwd=informix";A1)

Connect to Informix database and get the fragmentation information via a file handle

3

=ifx_close(A2)

Close Informix database connection

ifx_conn()[703][704]

Description:

Create Informix database connection.

Syntax:

ifx_conn(url; fragfile)

ifx_conn(driver,url; fragfile)

Note:

The function connects to the external Informix database. The format of the parameter url is the same as that of the JDBC URL.

Parameter:

driver

Name of JDBC driver for connecting to Informix database; the format is com.informix.jdbc.IfxDriver

url

The URL to connect to Informix server

fragfile

Fragmentation information file that records the fields and every field’s max and min values in each fragmented file

Return value:

Ifxconn object

Example:

 

A

 

1

="d:/frag.txt"

A fragmentation information file

 

 2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli://192.168.0.3:9088/tpch:informixserver=tpch&user=informix&pwd=informix";A1)

Connect to Informix database and get the fragmentation information as a file handle

 

3

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli://192.168.0.3:9088/tpch:informixserver=tpch&user=informix&pwd=informix";"d:/frag.txt")

Connect to Informix database and get the fragmentation information as a file

ifx_cursor()[705][706]

Description:

List the fragmentation information of a specified table with cursors.

Syntax:

ifx_cursor(ifxconn, sql; k1:k2)

Query data in fragmented files from k1 to k2 using a SQL statement

ifx_cursor(ifxconn, table:where, f:alias,...; k1:k2)

List the fragmentation information of table table with cursors and search fragmented file k1 and fragmented file k2 according to the where condition. Parameter f is the table’s column name and parameter alias is the column’s another name. Parameter where can be omitted; parameter k2 will be omitted if parameter k1 is absent; search only framted file k1 when k2 is absent

ifx_cursor(ifxconn, sql; ifxCursor:f2)

Query data over the fragmented file specified by the parameter ifxCursor quries with a SQL statement; parameter f2 is the fragmented field, which, if absent, is the fragmented field of the fragmented file ifxCursor

ifx_ cursor(ifxconn, table:where, f:alias,...; ifxCursor:f2)

Query table table according to where condition over the fragmented file specified by parameter ifxCursor; parameter f is the table’s column name and parameter alias is its another name; f2 is the fragmented field, which, if absent, is the fragmented field of the fragmented file ifxCursor

Parameters:

ifxconn

Ifxconn object

sql

A SQL statement

table

A table being fragmented

where

Query condition; can be omitted

f

A column name of a fragmented file

alias

Another name of column f

k1

A fragmented file; can be omitted

k2

A fragmented file; can be omitted

ifxCursor

The fragmented file recorded with cursor

f2

A fragmented field; can be omitted

Options:

@o

Allow unordered data

@f

Require data to be ordered

@m

Enable the use of multiple channels

Return value:

Cursor

Example:

 

A

 

1

=ifx_conn("jdbc:informix-sqli:192.168.0.3:9088/tpch:;DB_LOCALE=en_us.819;CLIENT_LOCALE=en_us.57372;NEWCODESET=GBK,8859-1,819;informixserver=tpch&user=informix&pwd=informix";"frag.txt")

Connect to Informix database

2

=ifx_takefrag(A1)

 

 

3

=ifx_cursor(A1,"select L_ORDERKEY,L_RETURNFLAG,L_LINESTATUS,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX from lineitem";2:3)

Query data in the 2nd and the 3rd fragmented files through a SQL statement

4

=A3.fetch(10000)

5

=ifx_cursor@o(A1,"lineitem":"L_LINESTATUS='F'","L_TAX":"tax",L_LINESTATUS;2:3)

Query the 2nd and the 3rd fragmented files of table lineitem according to condition L_LINESTATUS='F'; with @o option used, get column L_TAX, whose alias is tax, and column L_linestatus in an unordered way

6

=A5.fetch(10000)

7

=ifx_cursor@o(A1,"select skip 0 first 30000 L_ORDERKEY,L_RETURNFLAG,L_LINESTATUS,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX from lineitem";A3:"l_orderkey")

Query the same fragmented file as that in A3 through a SQL statement, with the fragmented field as l_orderkey, which can be omitted because it is the same as that of A3’s fragmented file

8

=A7.fetch(10000)

 

9

=ifx_cursor@o(A1,"lineitem":"L_LINESTATUS='F'","L_TAX":"tax",L_LINESTATUS; A5:"l_orderkey")

With @o option used, get column L_TAX, whose alias is tax, from one of the fragmented file of table lineitem, which is the same as A5’s fragmented file, and column L_LINESTATUS, according to condition L_LINESTATUS='F' in an unordered way; the fragmented field is l_orderkey, which can be omitted because it is the same as that of A5’s fragmented file

10

=A9.fetch(10000)

 

ifx_listfrag()[707][708]

Description:

List the fragmentation information of a specified table with table sequences.

Syntax:

ifx_listfrag(ifxconn, table)

Note:

The function lists the fragmentation information of a specified table with table sequences on the condition that the fragmentation information is already written into the ifxconn object. List the fragmentation information all fragmented table being fragmented if parameter table is absent.

Parameters:

ifxconn

The ifxconn object which holds the fragmentation information

table

A table being fragmented

Return value:

A table sequence

Example:

 

A

 

1

="d:/frag1.txt"

Create and save a fragmentation information file

2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli:192.168.0.7:8000/tpch:informixserver=tramsserver&user=informix&pwd=informix";A1)

Connect to Informix database

3

=ifx_takefrag(A2)

Extract the fragmentation information of all specified tables

4

=ifx_listfrag(A2)

List the fragmentation information of all specified tables

5

= ifx_listfrag(A2,"orders")

List fragmentation information of the orders table

ifx_savefrag()[709][710]

Description:

Save the fragmentation information file stored in the memory as a new file.

Syntax:

ifx_savefrag(ifxconn, file)

Note:

The function saves the fragmentation information stored in the memory as a new file. The new file can be the same as the file fragfile created via ifx_conn(), or one saved in another name.

Parameters:

ifxconn

An ifxconn object

file

A fragmentation information file, which can be the same file as fragfile or not.

Return value:

Table sequence

Example:

 

A

 

1

="d:/frag1.txt"

Create and save a fragmentation information file

2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli:192.168.0.7:8000/tpch:informixserver=tramsserver&user=informix&pwd=informix";A1)

Connect to Informix database

3

=ifx_takefrag(A2)

Extract the fragmentation information of all specified tables

4

=ifx_savefrag(A2,A1)

Save the fragmentation information stored in the memory as the file frag1.txt

5

=ifx_savefrag(A2,"d:/frag2.txt")

Save the fragmentation information stored in the memory as another file frag2.txt

ifx_setfrag()[711][712]

Description:

Set the fragmentation information of a specified table.

Syntax:

ifx_setfrag (ifxconn, table, fieldName, min1, min2,....)

Note:

The function sets the fragmentation information of the specified table. If the parameters after parameter fieldname are absent, then delete the specified table’s fragmentation information stored in the IfxConn object. The the number of the values of parameter min is the number of fragmented files the specified table has.

Parameters:

ifxconn

An ifxconn object

table

A table being fragmented

fieldName

Fragmented field

min

The minimum value in a fragmented file; can be omitted and can have multiple values

Return value:

Table sequence/null

Example:

 

A

 

1

="d:/frag1.txt"

Create and save a fragmentation information file

2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli:192.168.0.7:8000/tpch:informixserver=tramsserver&user=informix&pwd=informix";A1)

Connect to Informix database

3

=ifx_takefrag(A2,"orders")

Extract fragmentation information of the orders table

4

=ifx_setfrag(A2,"orders","o_orderkey",1,400000000)

Set fragmentation information of the orders table

5

=ifx_setfrag(A2,"orders","o_orderkey")

Delete the fragmentation information

ifx_takefrag()[713][714]

Description:

Extract fragmentation information from the database.

Syntax:

ifx_takefrag(ifxconn, table1,table2,...)

Note:

The function extracts the fragmentation information of the specified table(s) from the database and writes it into the Ifxconn object. As there isn’t the fragmentation information in fragfile file, the txt file is empty; get the fragmentation file of all tables being fragmented if parameter table is absent.

Parameters:

ifxconn

An Ifxconn object

table

The table being fragmented; can be omitted and can have multiple number of it

Example:

 

A

 

1

="d:/frag1.txt"

Create and save a fragmentation information file

2

=ifx_conn("com.informix.jdbc.IfxDriver","jdbc:informix-sqli:192.168.0.7:8000/tpch:informixserver=tramsserver&user=informix&pwd=informix";A1)

Connect to Informix database

3

=ifx_takefrag(A2)

Extract fragmentation information of all specified tables

4

=ifx_takefrag(A2,"lineitem")

Extract fragmentation information of table lineitem

import()[715][716]

Here’s how to use import() function.

S.import()[717][718]

Description:

Retrieve contents from strings as records and return them as a table sequence.

Syntax:

S.import(Fi:type;fmt,…;s)

 

Note:  

The function retrieves specified or all fields from string S and returns them as a table sequence.

Parameters:

S

The string. Its format: separate the records by line break, and the fields by user-defined separator; the default separator is tab.

Fi

Fields to be retrieved; by default all fields will be retrieved.

type

Field types include bool, int, long, float, decimal, number, string, date, time and datetime; data type of the first row will be used by default. It is the length of a serial byte when it is an integer.

fmt

Date\time format

s

User-defined separator; the default is tab.

Options:  

@t

Take the first row in f as the field name. If not using this option, then use _1, and _2,… as the field name.

@c

Use comma as the separator when the parameter s is absent, but the user-defined separator s should take priority when there are both s and @c option.

@j

Import records from json strings and resolve them into a table sequence, with s being ignored. Of [{F:v,…},…], v is the value of F; it will be quoted when being the string constant, and represented reclusively when it is a sequence or a table sequence.

@x

Retrieve data from strings of XML format as multi-level records or a table sequence (similar to retrieving data from json strings).

The identifier within <> is the field name; identifiers with the same name indicate that a table sequence will be generated; ignore the non-identifier properties within <>.

<xml>

<table>

                                <row>

                                        <F>v</F>

                                        …

                                </row>

                                …

 </table>

</xml>

s is the level separator; slash / is used to separate the level of data to be retrieved and its superior level; when omitted data will be retrieved from the root level.

@s

Won’t split strings and data will be imported as a table sequence consisting of strings of single field values; ignor the parameters

@i

Return the result set as a sequence if it only contains one field

@q

First remove quotation marks surrounding strings, including the headers, and then handle the escaping

@o

Use quotation marks as the escape character

@k

Retain the whitespaces on both sides of the data item; without it a trim operation will be automatically performed

@e

Generate null if parameter Fi isn’t included in the imported strings; by default there will be an error report

@d

Delete a record if it contains unmatching data types or data formats and start examining data by type

@n

Ignore a row whose number of columns don’t match the first row

@v

In corporation with @d or @n, if a mismatch appears, throw an exception, terminate the execution and output the content of the problem record

Return value:  

Table sequence

Example:  

 

A

 

1

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

 

2

=A1.(~.array().concat@c())

Convert to the sequence of strings.

 

3

=A2(1).import(;",")

Select all fields from a specified string in the sequence. Specify comma as the separator, and return a table sequence as the result

4

=demo.query("select EID,NAME,SURNAME from EMPLOYEE")

 

5

=A4.export()

6

=A4.export@t(EID:id,NAME:name,SURNAME:surname;"|")

7

=A5.import()

No parameters are given. The default separator will be tab, and _1 and _2,… will be used as field names

8

=A6.import@t(id:int,name;"|")

Select fields id and name, separated by “|”

9

="{name:'China',province:[{name:'Heilongjiang',cities:

{city:['Harbin','Daqing']}},{name:'Guangdong',

cities:{city:['Guangzhou','Shenzhen','Zhuhai']}},{name:'Taiwan',cities:

{city:['Taipei','Kaohsiung']}},{name:'Xinjiang',

cities:{city:['Urumqi']}}]}".import@j()

Parse JSON strings to get a table sequence - [{F:v,},], where v is the value of F field; write v recursively if it is a sequence or table sequence

10

=A4.export@j()

11

=A10.import@j()

12

=A4.export@x(;"employee/name")

13

=A12.import@x(EID;"employee/name")

Retrieve EID field of the name level.

14

=A2(1).import@c()

With @c option, use default separator commma

15

=A5.import@s()

 

With @s option, won’t split strings and records are imported as a single-field table sequence

16

=A5.import@si()

 

A single-field result set will be returned as a sequence

17

=["12\r34","aa\nbb"].export@q()

18

=A17.import()

19

=A17.import@q()

 

With @q option, double quotations will be removed before generating the final table sequence

20

=["12\r34","aa\nbb"].export@qo()

21

=A20.import@qo()

 

With @o option, use double quotations as escape character

22

=" abc ".import@k()

Retain the whitespaces on boths sides

23

=A6.import@te(id:int,name,dept;"|")

Generate null since dept doesn’t exist in the imported strings

24

id|name|surname

a|Rebecca|Moore

2|Ashley|Wilson

3|Rachel|Johnson

4|Emily|Smith

5|Ashley|Smith

6|Matthew|Johnson

7|Alexis|Smith

8|Megan|Wilson

 

25

=A24.import@td(id:int,name;"|")

Delete the record as it contains unmatching data types

26

=A24.import@tv(id:int,name;"|")

Check data type matching, and, if error reports, throw an exception, terminate the execution and output the content of the problem record; the error message is: Error in cell A26

 

27

id|name|surname

1|Rebecca|Moore

2|Ashley

3|Rachel|Johnson

4|Emily

 

28

=A27.import@tdn(id:int,name,surname;"|")

Ignore row 2 and row 3 because the number of columns don’t match that of the table sequence

Related functions:

f.export()

f.import()

A.export()

f.import()[719][720]

Description:

Read contents from a file and return them as a table sequence.

Syntax:

f.import()

 

f.import(Fi:type:fmt,…;k:n,s)

Retrieve the kth segment of the n segments from the text file. Fi represents the retrieved field; all fields will be retrieved by default. s is the user-defined separator; the default is tab. When retrieving a file segment by segment, it intelligently identifies the ending points to ensure the retrieved records in each segment are complete and all retrieved records are continuous and unique

Note:

The function retrieves file f and returns a table sequence where each record consists of a line of f.

Parameters:

f

A file

Fi

Fields to be retrieved. All fields will be retrieved by default. The sign # is used to represent a field with a sequence number.

type

Field types include bool, int, long, float, decimal, string, date, time and datetime. Data type of the first row will be used by default. It is the length of a serial byte when it is an integer.

fmt

Date\time format

s

User-defined separator. The default separator is tab. When the parameter is omitted, the comma preceding it can be omitted, too.

k

The segment number.

n

The number of segments. Retrieve the whole file when both k and n are omitted.

Options:

@t

Use the first row of f as the field name. If this option is not used, _1, _2,… will be used as field names; keep the original field names if Fi is #i

@b

Retrieve data from the exported binary file, with the support for parameter Fi, k and n, and with no support available for parameters type and s. Options @t, @s, @i, @q and @m will be ignored. The segmental retrieval could result in empty segment in cases when a file has only a very small number of records or it is unable to be segmented.

@e

Make the function return null when Fi doesn’t exist in the file; raise an error when the option is absent.

@s

Do not split the to-be-retrieved field when it is imported as a cursor whose content is a table sequence consisting of strings of a single field; in this case the parameters will be ignored.

@i

If the result set has only one column, return it as a sequence

@q

Remove the quotation marks, if any, of the field strings, including the field names, in the first place, and handle the escape sequences.

@m

Use multithreads to increase data retrieval speed, but this will leave an indefinite order for members of the result set. This option will be ignored when parameters k and n exist and it is often used to retrieve data from big files. More than one parallel thread should be specified in license file and configuration information.

@c

Use comma as the seperator when the parameter s is absent, but the user-defined separator s should take priority when there are both s and @c option.

@o

Use quotation marks as the escape character

@k

Retain the whitespaces on both sides of the data item; without it a trim operation will be automatically performed

@d

Delete a record if it contains unmatching data types or data formats and start examining data by type

@n

Ignore and discard rows whose number of columns don’t match the first row

@v

Verify data type matching, and, if error reports, throw an exception, terminate the execution and output the content of the problem record

Return value:

The new table sequence whose records are contents of the file object f.

Example:

 

A

 

1

=file("D:\\score.txt").import()

2

=file("D:\\score.txt").import@t()

3

=file("D:\\score.txt").import(;1:2)

With Fi and s omitted, get the data of the first of the multiple segments

4

=file("D:\\Department2.txt").import(;"|")

With Fi, k and n omitted, the whole file is imported

5

=file("D:\\Department2.txt").import(;1:3,"|")

Omit the fields to be imported

6

=file("D:\\ EMPLOYEE.txt").import@c(GENDER;1:2)

Retrieve the first segment of GENDER field of comma-seperated EMPLOYEE1.txt

7

=file("D:\\Department5.txt").import@t(DEPT, MANAGER:int; 1:3,"/")

The contents of Department5.txt are separated with slash and retrieved by the specified fields DEPT and MANAGER

 

8

=file("D:\\ score.txt").import@e(EID;1:3)

Return null because there’s no EID field in score.txt

9

=file("D:\\Department.txt").import@ts()

10

=file("D:\\EMPLOYEE.btx").import@b(;1:2)

Retrieve the first segment of the bin file (a segmented binary file) EMPLOYEE.btx, which is exported from f.export(A,x:F,…).

11

=file("D:\\orders.txt").import@mt(;",")

Increase the speed of retrieving data from the big file. The record order in the result is not the same as that in the file.

12

=file("D:\\StuName.txt").import@i()

StuName.txt has only one column, so return it as a sequence

13

=file("D:\\test.txt").import@t()

 

14

=file("D:\\test.txt").import@tq()

 

15

=file("D:\\Sale1.txt").import()

Get all records from Sale1.txt

16

=file("D:\\ Sale1.txt").import(#1,#3)

Get the first column and the third column from Sale1.txt

17

=file("D:/Dep3.txt").import@qo()

Here is the Dep3.txt file:

Return the result:

18

=file("D:/Dep1.txt").import@k()

Retain the whitespaces on both sides of the data item

19

=file("D:/Department1.txt").import@t(id:int,name;,"|")

20

=file("D:/Department1.txt").import@td(id:int,name;,"|")

Delete the record as it contains unmatching data types

21

=file("D:/Department1.txt").import@tv(id:int,name;,"|")

Check data type matching, and, if error reports, throw an exception, terminate the execution and output the content of the problem record

22

=file("Dep2.txt").import@tdn(id:int,name,surname;,"|")

Here’s the file Dep2.txt:

Ignore and discard row 6 and row 8 because the number of columns don’t match that of the first row

23

=file("D://EMP1.txt").import@s(;1:2)

Don’t split field values to import as a single-field table; ignore the parameters

24

=file("D://EMP2.txt").import(#1:date:"yyyy/MM/dd")

EMP2txt:

Parse data in yyyy/MM/dd format as a date type field

Note:

Text file format: Separate records by carriage return, and fields by the user-defined separator. The default separator is the tab.

Related functions:

f.export()

 

T.import()[721][722]

Description:

Read in records from an entity table and return them as a sequence, record sequence or table sequence.

Syntax:

T.import(...)

Remark:

The function, which is equivalent to T.cursor(...).fetch(), retrieves records from entity table T and returns them as a sequence, record sequence or table sequence.

Parameters:

T

An entity table

Return value:

A sequence/record sequence/table sequence

Example:

 

A

 

1

for 100

 

2

=to(10000).new(#:k1,rand():c1).sort@o(k1)

Generate a set of random data

3

=to(10000).new(#:k1,rand(10000):c2,rand()*1000:c3).sort@o(k1)

 

4

=A2.cursor()

 

5

=A3.cursor()

 

6

=file("D:\\tb1.ctx")

Create composite table’s base table

7

=A6.create(#k1,c1;k1)

 

8

=A7.append(A4)

 

9

=A7.attach(table4,c2,c3)

 

10

=A9.append(A5)

 

11

=A9.cursor(;c2<1000;2:3)

Divide records in A9’s attached table where c2 is less than 1000 into 3 segments and return columns in the 2nd segment as a cursor

12

=A11.fetch()

Fetch data from A11’s cursor

13

=A9.import(;c2<1000;2:3)

Same result as A12

 

index()[723][724]

Here’s how to use index() function.

T.index()[725][726]

Description:

Create an index table for the key of a table sequence.

Syntax:

T.index(n)

Note:

The function creates an index table, whose length is n, for the key of table sequence T. The index table will be cleared if n=0, or when the table sequence’s key is reset; the index table’s length will be automatically identified if n isn’t supplied. An index table can help speed up the key-based data query process. To create an index table, we assume that there is only one key for the records, otherwise error will be reported.

Options:

@s

Create a multilevel tree-structure index and ignore parameter n if the TSeq’s key is for data ordering

Parameters:

T

A table sequence with a key

n

Index length

Return value:

Table sequence

Example:

       

A

 

1

=demo.query("select EID,NAME,SALARY from EMPLOYEE where EID<4")

 

2

=A1.keys(EID)

Set EID as A1’s key

3

=A1.index(10)

Create an index table for the table squence’s key; the length is 10

Related functions:

r.key()

T.index(n)[727][728]

Description:

Create an index for the key of a memory table.

Syntax:

T.index(n)

Note:

The function creates an index whose length is n for the key of memory table T. Parameter n can be omitted if the key contains serial byte values. The index facilitates data searching when we need to perform multiple searching according to the primary key. The function assumes there is only one primary key in records.

Parameters:

T

A memory table with only one primary key

n

The length of index

Return value:

A memory table

Example:

 

A

 

1

=file("D:\\emp3.ctx")

 

2

=A1.create(#EID,NAME;EID)

Create a composite table’s base table

3

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

 

4

=A2.append(A3)

 

5

=A2.attach(table3,#GENDER)

Add an attached table to the base table

6

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

Return a cursor

7

=A5.append(A6)

Append cursor records to the attached table

8

=A5.memory()

Generate a memory table from A5’s attached table

9

=A8.keys(EID)

Set EID field as the memory table’s key

10

=A8.index(10)

Create an index whose length is 10

 

T.index(I:h,w;C,…;F,…)[729][730]

Description:

Create an index file for an entity table.

Syntax:

T.index(I:h,w;C,…;F,…)

Note:

The function creates index I for records meeting filtering condition w in entity table T according to keys C,…, which should not the field(s) inheriting from the parent table. The parameter w can be omitted; create a hash index with the average length as h if parameter h is present. The key(s) C,… and index name I are indispensable for creating the index. The index name should be unique, and an index file with the unique name will be automatically generated when the index creation is successfully executed. The function deletes the corresponding index when there is only one parameter I; delete all indexes of T if all parameters are absent. A hash index can be only used for performing equivalence query and supports the contain syntax.

Parameter F is the field name in the entity table. When it is present, record the field into the index file. We can only get the indexed fields C and F field when using the index to retrieve records. The greatest aspect of such an index is that we can quickly find values of F field through values of C. If parameter F is absent, the index will record the location information of all the fields in the entity table.

Parameters:

T

An entity table

I

Index name

w

Filtering condition; retrieve the whose set if the parameter is absent

C

The field for which an index is created

h

Index length

F

Field name in an entity table; can be omitted

Options:

@2

Auto-load and maintain the second-level index when only parameter I is present

@3

Auto-load and maintain the third-level index when only parameter I is present

@0

Close the index to release resources when only parameter I is present

@w

Create a full-table index based on a certain column and support like(“*X*”) style search

Return value:

Boolean value

Example:

 

A

 

1

=file("D:\\emp1.ctx")

 

2

=A1.create(#EID,NAME;EID)

Create a composite table where EID field is the key by which records are segmented

3

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

 

4

=A2.append(A3)

Append cursor records to the base table

5

=A2.attach(table1,DEPT,GENDER)

Add attached table table1 to the base table

6

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

 

7

=A5.append(A6)

Append cursor records to entity table table1

8

=A7.index(test_index,GENDER=="F";DEPT;)

Create an index test_index1 by DEPT field

9

=A5.index(test_index3,["F"].contain(GENDER);DEPT;)

Use the contain syntax to create index test_index3 by DEPT field

10

=A5.index(idx1:10;DEPT;)

Create index idx1 with the length of 10 by DEPT field

11

=A5.index(test_index3)

Delete index test_index3

12

=A5.index()

Delete all indexes

13

=A5.index(test_index,GENDER=="F";DEPT;GENDER)

Via the index, get records with only the indexed field DEPT and GENDER field

14

=A7.index@w(test_index,GENDER=="F";DEPT;)

Create a full-table index based on DEPT

15

=A14.icursor (;like(DEPT,"*ale*"),test_index).fetch()

Use like(“*X*”) style search

inf()[731][732]

Here’s how to use inf() function.

inf()[733][734]

Description:

Return positive infinity value.

Syntax:

inf()

Note:

The function returns the positive infinity value.

Return value:

Positive infinity value

Example:

inf()

Infinity

Related functions:

-inf()

-inf()[735][736]

Description:

Return negative infinity value.

Syntax: 

-inf()

Note:

The function returns the negative infinity value.

Return value:

Negative infinity value

Example:

-inf()

-Infinity

Related functions:

inf()

insert()[737][738]

Here’s how to use insert() function.

A.insert()[739][740]

Description:

Insert members into a sequence.

Syntax:

A.insert(k,X)

Insert the members of sequence X before position k in A, and return A.

A.insert(k,x)

Insert member x before position k in A, and return A.

Note:

The function inserts member x or members of sequence X before position k in sequence A. When parameter k is omitted, we assume the sequence A is ordered and insert member X(or x); if member X(or x) have already existed in A, the function won’t perform the insertion. Automatically update the index, if any, and check distinctness.

Parameters:

k

The position before which one or more members are inserted, when k==0, the member(s) will be appended in the end.

A

A sequence

X

A sequence composed of the members to be inserted

x

A member

Options:

@n

Return the inserted record or a record sequence of the inserted records.

Return value:

The sequence into which you have inserted new members

Example:

 

A

 

1

=["a","c","d","e","f"]

 

2

=A1.insert(0,"g")

[a,c,d,e,f,g], the member is appended in the end and A1 changes

3

=A1.insert(2,["g","j"])

[a,g,j,c,d,e,f,g], insert the new members before the second member.

4

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

 

5

=A4.insert@n(2,ID+10:ID,"Lily":NAME,"M":GENDER,15:AGE)

Return the inserted record

6

=A1.insert(,"b")

[a,b,g,j,c,d,e,f,g]; assume A1 is ordered and insert a new member b

7

=A1.insert(,"a")

[a,b,g,j,c,d,e,f,g]; member a exists in A1, so the same member won’t be inserted

Related functions:

A.delete()

A.modify()

T.insert()

T.insert()[741][742]

Description:

Insert one or more records into a table sequence.

Syntax:

T.insert(k)

Insert an empty record before the position k in the T. If k is 0, then append it in the end and return the new T

T.insert(k,xi:Fi,…)

Insert a record into T before the position k where the value of Fi is xi and return the new T. When parameter k is omitted, we assume the table sequence T is already ordered by the key and insert records; if the key value has already existed, the function won’t perform the insertion.

T.insert(k:A,xi:Fi,…)

Insert multiple records into T before the position k where the value of Fi is xi and return the new T . The number of the records to be inserted is determined by the length of sequence A.

Note:

The function inserts one or more records into the table sequence T, and automatically updates the index, if any, and checks distinctness.

Parameters:

k

The position before which the member, or the record, is inserted. When k==0, append it in the end.

xi

The Fi field value before which the new record is to be inserted

Fi

The name of field where xi resides; without Fi, it will be the corresponding ith field.

T

A table sequence

A

A sequence or an integer; if A is an integer, then it is equal to to(A)

Options:

@n

Return the inserted record or a record sequence of the inserted records

@r(k:A)

Insert sequence A into table squence T from the kth record according to the order of the fields

@f(k:A)

Insert sequence A into table squence T from the kth record; only the common fields are inserted.

Return value:

The table sequence T into which you have inserted new records

Example:

 

A

 

1

=create(id,name,age)

2

=A1.insert(0,1,"Jack",29)

3

=A1.insert(1,2,"Lucy",30)

4

=A1.insert(0)

5

=A1.insert(0:3)

6

=A1.insert@n(1:1,10,"Lily",30)

 Return the inserted record

7

=create(ID,Name,Age)

 

8

=A7.insert(0:A1,id:ID,name:Name,age:Age)

 

9

=A1.delete(A1.select(id<2))

 

10

=A7.insert@r(5:A9)

Insert A9 into A7 from the fifth record

11

=create(ID,Name,AGE)

 

12

=A11.insert@f(3:A7)

Insert only the ID and Name fields of A7 to A11 from the third record

13

=A1.keys(id)

Set id as A1’s primary key, then A1’s data is as follows:

14

=A1.insert(,5,"Mary",28)

Parameter k is omitted; assume A1 is already ordered by id and insert the records

15

=A1.insert(,2,"CC",32)

Same result as A14; since the record where the key value is 2 already exists, the function cancels the insertion

16

=file("D:\\test.txt").import@t()

test.txt defines only the column headers

17

=A16.insert(0,1,"2008-8-4")

Insert a record

Related functions:

T.modify()

T.delete()

A.insert()

int()[743][744]

Description:

This is a data type conversion function. It is used to obtain the integer part of a given numeric value expression or a numeric string, and convert its data type to 32-bit integer.

Syntax:

int(valueExp)

Note:

The returned result of valueExp must be a numeric string or a number.

Parameters:

valueExp

An expression, the result of which must be a numeric string or a number.

Return value:

A 32-bit integer

Example:

int("33")

33

int("33.999d")

33

int(1.5*1.5)

2

int(25.67)

25

Related functions:

float()

decimal()

long()

number()

string()

interval()[745][746]

Description:

Compute the interval between two datetime values

Syntax:

interval (datetimeExp1,datetimeExp2)

datetimeExp1- datetimeExp2                

interval (datetimeExp2,datetimeExp1)

Note:

The function computes the interval between two datetime values datetimeExp1 and datetimeExp2

Parameters:

datetimeExp1

The date expression whose value is a datetime or a string of standard datetime format

datetimeExp2

The date expression whose value is a datetime or a string of standard datetime format

Options:

@y

Compute the years between two datetime values

@q

Compute the quarters between two datetime values

@m

Compute the months between two datetime values

@s

Compute the seconds between two datetime values

@ms

Compute the milliseconds between two datetime values

@r

Compute the interval between two datetime values and return a real number

 

By default it computes the days between two datetime values

@w

Compute the weeks between two datetime values

@7

Compute the number of Sundays between two datetime values according to a left-open interval

@1

Compute the number of Mondays between two datetime values according to a left-open interval

Return value:

Integer

Example:

 

interval(datetime("19800227","yyyyMMdd"),datetime("1983-02-27 00:00:45"))

1096

 

interval@y(datetime("19800227","yyyyMMdd"),datetime("1983-02-27 00:00:45"))

3

 

interval@q(datetime("19800227","yyyyMMdd"),datetime("1983-02-27 00:00:45"))

12

 

interval@m(datetime("19800227","yyyyMMdd"),datetime("1983-02-27 00:00:45"))

36

 

interval@s(datetime("19800227","yyyyMMdd"),datetime("1980-02-27 00:00:45"))

45

 

interval@s ("1972-11-08 10:20:30","1972-11-08 10:30:50")

620

 

interval@ms(datetime("19800227","yyyyMMdd"),datetime("1980-02-27 00:00:45"))

45,000

 

interval@ms("1972-11-08 10:20:30","1972-11-08 10:30:50")

620,000

 

interval@r(datetime("19800227","yyyyMMdd"),datetime("1980-02-27 00:00:45"))

5.208333333333333E-4

 

interval@r("1972-11-08 10:20:30","1973-11-08 10:30:50")

365.00717592592594

 

datetime("19850227","yyyyMMdd")-datetime("1983-02-27 00:00:45")

731

interval@w("1972-10-08 10:20:30","1972-11-08 10:30:50")

 

interval@7("1972-10-08 10:20:30","1972-11-08 10:30:50")

 

interval@1("1972-10-08 10:20:30","1972-11-08 10:30:50")

 

inv()[747][748]

Here’s how to use inv() function.

A.inv(p)[749][750]

Description:

Adjust the order of members of a sequence.

Syntax:

A.inv(p)

Note:

The function adjusts the order of members of A according to the integer sequence p, whose members are ranks of members of sequence A, and return the new A.

Parameters:

p

An integer sequence, whose members are ranks of members of A. So the number of its members is the same as that of members of A, and it is a unique n-integer sequence (n=A.len()).

A

A sequence or a record sequence.

Return value:

The adjusted sequence

Example:

 

A

 

1

[b,c,a,d]

 

2

=A1.inv([2,3,1,4])

[a,b,c,d]

Note:

p must be a unique n-integer sequence, i.e. n must be equal to A.len()

If p has duplicate members or the number of its members is not equal to that of members of A, return null.

If the maximum member value of p exceeds the maximum sequence number of A, return null

The members of tied ranks will be ignored

Related functions:

p.inv(k)

p.inv(k)[751][752]

Description:

Compute the sequence numbers of an integer’s members in another integer sequence.

Syntax:

p.inv(k)

Note:

The function returns the sequence numbers of the mumbers from 1 to k in integer sequence p. Return 0 for the numbers that do not exist in p.

Parameters:

p

An integer sequence

k

An integer, which is p.len() by default

Return value:

An integer sequence composed of the sequence numbers of the integers from 1 to k in integer sequence p

Example:

 

A

 

1

=[1,3,5,7]

 

2

=A1.inv(4)

Among the four numbers 1, 2, 3 and 4, the sequence numbers of 1 and 3 in sequence A1 are 1 and 2. 2 and 4 do not exist in sequence A1, so their sequence numbers are 0. [1,0,2,0] is returned finally.

Related functions:

A.inv(p)

invoke()[753][754]

Description:

Invoke the static function of class in the package.

Syntax:

invoke(p.c.f,ai,…)

Note:

The function, in which ai is the parameter, calls the static function f of class c in the package p, which can be omitted.

Parameters:

p

Package path

c

Class name

f

Static method name

ai

Parameter

The following lists data types of the parameters passed for the invoke() function and their corresponding parameter data types in Java classes:

Bool

java.lang.Boolean

Int

java.lang.Integer

Long

java.lang.Long

Float

java.lang.Double

Decimal

java.math.BigDecimal

Date

java.sql.Date

Time

java.sql.Time

Datetime

java.sql.Timerstamp

String

java.lang.String

Blob

byte []

Example:

(I)      package api;

public class Calc01 {

public static Double distance1(Number loc) {

double len = Math.abs(loc.doubleValue());

len = Math.round(len*1000)/1000d;

return Double.valueOf(len);

}

}

 

A

1

-12.34567

2

=invoke(api.Calc01.distance1,A1)

3

=invoke(api.Calc01.distance1, -512)

The static method distance1 calculates the distance between a given point and the origin, with the result rounded to 3 decimal places. A method invoked in an esProc cellset file should be both static and public.

(II) Create a customized class LineReaders for implementing the ILineInput interface so that users can retrieve a various types of data files using the file cursor. The file path can be defined as a parameter to be passed to the customized class. Then the file contents can be retrieved through stream in a row-wise fashion or by skipping certain individual rows; and the cursor can thus be closed in a certain way.

Below is a sample program:

package api;

 

import java.io.BufferedReader;

import java.io.EOFException;

import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;

import java.io.InputStreamReader;

import java.text.DateFormat;

import java.text.ParseException;

import java.text.SimpleDateFormat;

 

import com.raqsoft.dm.ILineInput;

 

import com.raqsoft.dm.UserUtils;

import com.raqsoft.dm.cursor.ICursor;

 

public class LineReaders implements ILineInput {

private String pathName;

private boolean hasTitle;

private BufferedReader bfr;

 

final String COL_SEP = "\t";

final String encoding = "UTF-8";

 

String lineTxt = null;

       

final DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

String[] rowData;

Object[] datas = new Object[3];

 

public LineReaders(String pathName,boolean hasTitle) {

this.pathName = pathName;

this.hasTitle=hasTitle;

}

 

public static LineReaders newInstance(String pathName,boolean hasTitle) {

return new LineReaders(pathName,hasTitle);

}

 

private BufferedReader getBufferedReader() throws IOException {

if (bfr == null) {

File file = new File(pathName);

if (file.isFile() && file.exists()) { // Check if the file exists

InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);// Take the type of character encoding into consideration

bfr = new BufferedReader(read);

}

}

return bfr;

}

//Read an individual row

public Object[] readLine() throws IOException {           

               

BufferedReader bfr = getBufferedReader();

try {

if (!hasTitle) {

datas[0] = "ID";

datas[1] = "BirthDate";

datas[2] = "Name";

}

while ((lineTxt = bfr.readLine()) != null) {

rowData = lineTxt.split(COL_SEP);

if (rowData != null && rowData.length == 3) {

if (hasTitle) {

datas[0] = rowData[0];

datas[1] = rowData[1];

datas[2] = rowData[2];

hasTitle = false;

return datas;

}

datas[0] = Integer.parseInt(rowData[0]);

datas[1] = df.parse(rowData[1]);

datas[2] = rowData[2];

return datas;

}

}

return null;

} catch (EOFException e) {

return null;

} catch (ParseException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return datas;

}

// Convert the ILineInput instance to a cursor

public static ICursor UserUtilsReader(String pathName,boolean hasTitle){

return UserUtils.newCursor(newInstance(pathName,hasTitle), "t");

}

//Skip an individual row

public boolean skipLine() throws IOException{

BufferedReader bfr = getBufferedReader();

try {                

String s = bfr.readLine();

if(s!=null){                     

return true;

}

} catch (EOFException e) {

return false;

}             

return false;

}

//Close the cursor

public void close() throws IOException {

if (bfr != null) {

bfr.close();

bfr = null;

}

}

(II) Place a LineReaders.class file in the api folder in the [esProc installation root directory]/classes path.

(III) The contents of the file (it uses the character encoding of UTF-8) retrieved by a cursor are as follows:

(IV) Invoke the customized function with invoke() function in the esProc cellset file:

 

A

 

1

=invoke(api.LineReaders.UserUtilsReader,"D://abc.txt",true)

Call the customized function

2

=A1.skip(3)

3

3

=A1.fetch()

 

isalpha()[755][756]

Description:

Check if a string is composed of letters.

Syntax:

isalpha(s)

Note:

The function checks if string s is composed of letters. If s is an integer, look it up in the ASCII table to see if the corresponding characters are letters.

Parameters:

s

String/ numeric expression

Return value:

Boolean value

Example:

isalpha("abc")

true

isalpha(97)

true

isalpha("@#$")

false

isalpha("1@23")

false

isalpha("a@23")

false

Related functions:

isdigit()

isdigit()[757][758]

Description:

Check if a string is composed of numbers.

Syntax:

isdigit (string)

Note:

The function checks if the string string is composed of numbers. If string is an integer, look it up in the ASCII table to see if the corresponding characters are a number.

Parameters:

String

String/ numeric expression

Return value:

Boolean value

Example:

isdigit("123")

true

isdigit(123)

false

isdigit("abc")

false

isdigit("123ss")

false

Related functions:

isalpha()

isect()[759][760]

Here’s how to use isect() function.

A.isect()[761][762]

Description:

Compute the intersection of all the sequences that are members of a larger sequence.

Syntax:

A.isect()

Note:

Members of sequence A are also sequences. The function creates a new sequence composed of all common members of the sub-sequences.

Parameters:

A

A sequence whose members are also sequences.

Return value:

A sequence

Example:

 

A

 

1

=[[1,2,3,4,5],[3,7,8]].isect()

[3]

2

=[[1,2,3],[3,2]].isect()

[2,3]

3

=[[1,2,2,3],2].isect()

[2]

4

=demo.query("select top 2 * from EMPLOYEE")

5

=demo.query("select top 1 * from EMPLOYEE")

6

=[A4,A5].isect()

[] Since A4 and A5 come from different table sequences and have different store addresses, so same records are regarded as different members

Related functions:

A.union()

A.diff()

A.conj()

A.xunion()

A.isect(x)[763][764]

Description:

Compute x with each member of the sequence whose members are sequences, and then perform intersection operation between members of the new sequence.

Syntax:

A.isect(x)

Note:

Members of sequence A are also sequences. The function loops through members of sequence A to compute expression x and creates a sequence composed of all common members of the new sub-sequences.

Parameters:

A

A sequence whose members are also sequences

x

An expression that returns a sequence

Return value:

A sequence

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

2

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

3

=[A1,A2].isect(~.(NAME))

Intersection operation between A1 and A2

Related functions:

A.isect()

iselect()[765][766]

Here’s how to use iselect() function.

f.iselect()[767][768]

Description:

Create a cursor based on an ordered file and return it.

Syntax:

f.iselect(A,x;Fi,…;s)

Retrieve records from file f that is ordered by field/expression x, according to the criterion that the values of x should be members of sequence A, and return them as a cursor

 

f.iselect(a:b,x;Fi,…;s)

Rtrieve records from file f that is ordered by field/expression x, according to the criterion that the values of x should fall in the interval [a:b], and return them as a cursor

 

Note:

The function retrieves records from file f that is ordered by x field, according to the criterion that the values of x should be members of sequence A, or fall in the interval [a:b], and returns the records as a cursor. By default the values of x are all considered distinct in f.

Parameters:

f

A file object

A

A single value or a sequence

a

Field value

b

Field value

x

Field name/expression; the sign # is used to represent a field with a sequence number

Fi

Fields to be retrieved, and all fields will be retrieved by default

s

User-defined separator. The default is tab. When the parameter is omitted, the comma preceding it can be omitted, too

Options:

@t

Use the first row of f as the field names. If omitted, then use_1,_2,… as the default field names

@b

Retrieve data from an exported binary file, with the support for parameters A, x and Fi, and with no support available for parameter s. Ignore options @t and @c. Segments containing no records may appear if it is a file containing a small number of records; an error report will appear if the file isn’t segmented when being retrieved.

@c

Use comma as the separator when the parameter s is absent. But the user-defined separator s should take priority when there is one.

@r

Find all records with the same value of x field; by default x is distinct in the file f.

@q

First remove quotation marks surrounding strings, including the headers, and then handle the escaping

@o

Use quotation marks as the escape character

@k

Retain the white space on both sides of the data item; without it a trim operation will be automatically performed

@e

Return a null column if parameter Fi doesn’t exist; the default way of handling is to report error

@d

Perform type matching and delete a record if there is mismatching data type or format in it

@v

Throw an exception, terminate execution, and output the content of the current record when type matching error appears

@n

Discard a row whose number of columns doesn’t match the number in the first row

Return value:

A cursor

Example:

 

A

 

1

=to(1:10)

 

2

=file("E:/files/employee.txt").iselect(A1,#1;;"|")

Below is the file employee.txt:

The first column is ordered and is separated from the next column by "|". No fields are specified to be retrieved, so all will be retrieved – if the value of the first one is in sequence A1 –  and returned as a cursor.

3

=A2.fetch()

4

=file("E:/files/employee1.txt").iselect@t(A1,EID;EID,SALARY)

Below is the file employee1.txt:

Retrieve corresponding EID and SALARY fields value – if EID value is in sequence A1 – and return them as a cursor

5

=A4.fetch()

6

=file("E:/files/employee2.txt").iselect@tc(A1,EID)

Below is the file employee2.txt:

Comma is used as the seperator

7

=A6.fetch()

8

=file("E:/files/employee3.txt").iselect@b(A1,EID)

Retrieve the bin file employee3.txt exported through f.export@z(A,x:F,...;s) and get records where EID1 and 10

9

=A8.fetch()

 

10

=file("E:/files/employee1.txt").iselect@t(1:10,EID;EID,SALARY)

Retrieve EID field and SALARY field according to the condition that EID1 and 10

11

=A10.fetch()

Same result as A5

12

=file("D:/Sale2.txt").iselect@tr(7,ID;ID,ENAME)

Retrieve all records where ID is 7 from Sales2.txt:

13

=A12.fetch()

14

=file("D:/Department1.txt").iselect@t(1:5,id;id,name;"|").fetch()

15

=file("D:/Department1.txt").iselect@tk(2,id;id,name;"|").fetch()

Use @k option to retain whitespaces on both sides of the data item

16

=file("D:/Department1.txt").iselect@tq(1,id;id,name;"|").fetch()

Remove quotation marks surrounding strings

17

=file("D:/Department1.txt").iselect@tqo(5,id;id,name;"|").fetch()

18

=file("D:/emp1.txt").iselect@et(2:5,EID;EID,SALARY,SEX).fetch()

Below is the file emp1.txt:

With @e option, the function returns an empty corresponding column since column SEX doesn’t exist in the file

19

=file("D:/emp1.txt").iselect@tn(7:10,EID;EID,NAME,SALARY).fetch()

Discard the row where EID is 10 since its number of columns isn’t the same as that in the first row

20

=file("D:/emp2.txt ").iselect@t(A1,EID-5;;",").fetch()

Get 10 records whose EIDs are from 5 to 15 and which satisfy the specified expression

21

=file("D:/emp2.txt ").iselect@t(110,EID-5;;",").fetch()

Use an interval to get the same result

islower()[769][770]

Description:

Check if a string is composed of lower case letters.

Syntax:

islower(string)

Note:

The function checks if the string string is composed of lower case letters. If string is an integer, look it up in the ASCII table to see if the corresponding characters are in lower case.

Parameters:

String

String expression/numeric expression

Return value:

Boolean value

Example:

islower("dgfdsgf")

true

islower(97)

true

islower("dsfaAFD")

false

islower("97ffdsf")

false

Related functions:

isupper()

isolate()[771][772]

Here’s how to use isolate() function.

db.isolate()[773][774]

Description:

Define transaction isolation level for the connection according to the option and return the original level.

Syntax:

db.isolate()

Note:

The function sets transaction isolation level for the connection according to the option and returns the original level, i.e. its corresponding character of the option. Establish the connection via JDBC by default if no option is used.

Option:

@ncurs

Correspond to NONE,READ_COMMITTED,READ_UNCOMMITTED,REPEATABLE_READ,SERIALIZABLE respectively

Parameters:

db

Database connection

Return value:

The orignal level of the database connection

Example:

 

A

 

1

=connect("demo")

 

2

=A1.isolate@r()

Set transaction isolation level as REPEATABLE_READ and return the original level " c"

Related functions:

connect()

isupper()[775][776]

Description:

Check if a string is composed of upper case letters.

Syntax:

isupper(string)

Note:

The function checks if the string string is composed of upper case letters. If string is an integer, look it up in the ASCII table to see if the correponding characters are in upper case.

Parameters:

String

String expression/numeric expression

Return value:

Boolean value

Example:

isupper("ADSFDGKJ")

true

isupper(85)

true

isupper("SDsdsSDAS")

false

isupper("8ASDS7")

false

Related functions:

islower()

iterate()[777][778]

Here’s how to use iterate() function.

A.iterate()[779][780]

Description:

Perform interative loop on a record sequence and return the result of the last calculation of a given expression.

Syntax:

A.iterate(x,a,c)

Note:

The function loops through members of record sequence A to calculate expression x and returns the result of the last calculation of x. ~~ represents the previous value of x. Parameter a is the default initial value for each calculation, whose absence indicates a null initial value. Exit the loop once the result of expression c is true.

Parameters:

A

A sequence/record sequence

x

An expression

a

The initial value

c

A boolean expression

Options:

@a

Return the results of calculating the expression over every member

Return value:

Result of expression x

Example:

 

A

 

1

[2,222,22,122,2222]

 

2

=A1.iterate(~*2)

4444

3

=A1.iterate@a(~*2)

[4,444,44,244,4444]

4

=A1.iterate(~~*2,3)

96

5

=A1.iterate(~~*2,5,~>500)

80

6

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

 

7

=A6.derive(A6.(AMOUNT).iterate(~~*2,5,~>20000):Cumulation)

Related functions:

iterate()

 

ch.iterate()[781][782]

Description:

Perform interative loop on record sequences in a channel and return the result of the last calculation of a given expression.

Syntax:

ch.iterate(x,a,c)

Note:

The function loops through record sequences in channel ch to calculate expression x and returns the result of the last calculation of x. ~~ represents the previous value of x. Parameter a is the default initial value for each calculation, whose absence indicates a null initial value. Exit the loop once the result of expression c is true.

Parameters:

ch

A channel

x

An expression

a

Initial value

c

An expression returns true/false

Return value:

Result of expression x

Example:

 

A

 

1

=[2,222,22,122,2222]

 

2

=channel()

 

3

=channel()

 

4

=A2.iterate(~*2)

 

5

=A3.iterate(~~*2,3)

 

6

=A1.push(A2,A3)

 

7

=A2.result()

4444

8

=A3.result()

96

9

=[100,200,800,2000]

 

10

=channel()

 

11

=A10.iterate(~~*3,10,~>250)

 

12

=A9.push(A10)

 

13

=A10.result()

90

 

cs.iterate()[783][784]

Description:

Perform interative loop on record sequences in a cursor and return the result of the last calculation of a given expression.

Syntax:

cs.iterate(x,a,c)

Note:

The function loops through record sequences in cursor cs to calculate expression x and returns the result of the last calculation of x. ~~ represents the previous value of x. Parameter a is the default initial value for each calculation, whose absence indicates a null initial value. Exit the loop once the result of expression c is true.

Parameters:

cs

A cursor

x

An expression

a

Initial value

c

An expression returns true/false

Return value:

Result of expression x

Example:

 

A

 

1

=[2,222,22,122,2222].cursor()

 

2

=A1.iterate(~*2)

4444

3

=[2,222,22,122,2222].cursor().iterate(~~*2,3)

96

4

=[2,222,22,122,2222].cursor().iterate(~~*2,5,~>500)

80

5

=demo.cursor("select * from SALES")

 

6

=A5.(AMOUNT).iterate(~~*2,5,~>20000)

40

iterate()[785][786]

Description:

An iterative loop for calculating an expression.

Syntax:

iterate(x,a;Gi,…)

Note:

The function performs an interative loop to compute expression x – which contains a ~~, and returns the result. Each time when the value of field Gi changes, the value of ~~ becomes a. The parameter Gi can be omitted. When parameter a isn’t supplied, its value is null.

Parameters:

x

An expression containing ~~

a

Initial value

Gi

Field name

Return value:

Value of the given expression

Example:

 

A

 

1

=demo.query("select top 7 * from SCORES ")

 

2

=A1.groups(CLASS:Class,STUDENTID:StudentID;iterate(~~*2): Score1)

3

=A1.groups(CLASS:Class,STUDENTID:StudentID;iterate(~~*2,10): Score1)

4

=A1.derive(iterate(~~*2,10;STUDENTID):F1)

Related functions:

A.iterate()

join()[787][788]

Here’s how to use join() function.

join()[789][790]

Description:

Join multiple sequences together.

Syntax:

join(Ai:Fi,xj,..;…)

Note:

The function joins multiple sequences of Ai according to the condition that the value of relational field/expression xj is equal to x1, and generates a table sequence whose fields are Fi,…. which reference the records of the original record sequences Ai. If xj is omitted, then use the key of Ai. An omitted xj won’t be matched. No matter how many record sequences are mutually related, the equivalence determination is conducted according to the x1 in A1. Therefore this is a one-to-many relationship.

Parameters:

Fi

Field name of the resulting table sequence

Ai

Sequences or record sequences to be joined

xj

Relational field/ expression

Options:

@f

Full join;if no matching records are found, then use nulls to correspond

@1

Left join; it is the number "1" instead of the letter "l"

@m

If all Ai are ordered against xj, then use merge operation to compute

@p

Perform a join according to positions while ignoring parameter xj

@x

If field values of the sequences to be joined are records, the joining values will be unfolded

Return value:

A new table sequence whose fields are all referencing ones

Example:

 

A

 

1

=demo.query("select top 3 EID,NAME from EMPLOYEE").keys(EID)

2

=demo.query("select top 3 EID,NAME from FAMILY").keys(EID)

3

=join(A1:Employee,EID;A2:Familymembers,EID)

 

4

=join@f(A1:Employee,EID;A2:Familymembers,EID)

Full join. If no matches, then use the nulls

5

=join@1(A1:Employee,EID;A2:Familymembers,EID)

6

=join@m(A1:Employee,EID;A2:Familymembers,EID)

7

=join@p(A1:Employee;A2:Familymembers)

8

=join(A1:Employee;A2:Familymembers)

 

9

=join(A1:Employee1;A2:Familymembers1)

 

10

=join(A7:Employee2;A8:Familymembers2)

11

=join@x(A7:Employee2;A8:Familymembers2)

Field values of A7 and A8 are records, the joining values will be unfolded

Related functions:

xjoin()

A.join()[791][792]

Description:

A foreign-key-style join between table sequences/record sequences, or a table sequence and a record sequence.

Syntax:

A.join(C:.,T:K,x:F,…; …;…)

Note:

The function matches C field of table sequence/record sequence A with the key of table sequence/record sequence T to find the desired records. Add an F field represented by x, which is T’s field expression, to A to generate a new table sequence. K can be omitted or represented by #. When omitted, K is T’s key; when written as #, K is represented by a sequence number.

Options:

@i

Delete a record with a non-matching foreign key value; by default a non-matching record will be represented by null. If parameters x:F are omitted, perform the filtering purely over parameter A

@o(F;)

Use the record as the value of F field to generate a new record; here expression x is equivalent to ~

@d

If parameter x:F is absent, delete the records matching the foreign key and perform the filtering operation only over table sequence/record sequence A

@k

When parameter x is ~, record the relationship between parameter F and parameter C to identify the potentially associative foreign key

Parameters:

A

Table sequence/record sequence

C

A’s foreign key; separate multiple fields in a composite key with the colon

T

Table sequence/record sequence/memory table

K

T’s key

x

T’s field expression, which can be represented by ~ and #; the pound sign # represents the sequence number of a record in T; record the sequence number as 0 if a record doesn’t exist in T

F

Field name in expression x

Return value:

A table sequence/record sequence

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE order by  EID" )

 

2

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

 

3

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").cursor().memory().keys(EMPLOYEEID)

Return a memory table

4

=A1.join(EID,A2,BONUS+1:SALARY1)

Use null to represent a record with non-matching foreign key value

5

=A1.join(EID,A3,BONUS+1:SALARY1)

A3 is a memory table; the resut is the same as above, where null is used to represent a record with non-matching foreign key value

6

=A1.join@i(EID,A2,BONUS+1:SALARY1)

Delete a record with non-matching foreign key value

7

=A1.join@i(EID,A2:#1,BONUS+1:SALARY1)

Same result as A4’s; #1 means the first field

8

=A1.join@o(F1;EID,A2,BONUS+1:SALARY1)

Records are the values of F1 field

9

=A1.join@i(EID,A2)

As parameters x:F are omitted, perform the filtering purely over parameter A1

10

=A1.join@d(EID,A2)

Since parameter x:F is absent, delete the records matching the foreign key and perform the filtering operation only over A1

ch.join()[793][794]

Description:

A foreign-key-style join between a channel and a record sequence.

Syntax:

ch.join(C:.,T:K,x:F,…; …;…)

Note:

The function uses the key of table sequence/record sequence T to match C,… field in channel ch, and add an F field to ch by joining T’s field expression x to for a new channel. K can be omitted or represented by #; when it is omitted, use T’s key; when represented by #, the key is pointed by a sequence number. This is an attached computation.

Options:

@i

Delete the whole record if the foreign key can’t be matched; by default make it null.

@o(F;)

Generate a new record by introducing the original record as a new field; field expression x can be represented by ~.

Parameters:

ch

Channel

C

Foreign key of a given channel; use comma to separate a composite key

T

Table sequence/record sequence

K

Key of the given table sequence/record sequence

x

A field expression of the given table sequence/record sequence

F

Name of the field expression

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,NAME,SALARY from EMPLOYEE

 order by  EID" )

 

2

=demo.query("select *

from PERFORMANCE order by

  EMPLOYEEID").keys(EMPLOYEEID)

 

3

=channel()

Create a channel

4

=channel()

 

5

=channel()

 

6

=channel()

 

7

=A1.push(A3,A4,A5,A6)

Be ready to push data in A1’s cursor into channel A3,A4,A5 and A6, but the action needs to wait

8

=A3.join(EID,A2, BONUS+1:SALARY1)

A normal join, where a record can’t be matched with the foreign key is recorded as null

9

=A8.fetch()

Fetch and store the existing data in the channel

10

=A4.join@i(EID,A2: #1, #3+1:SALARY1)

#1 represents the first field, and #3 represents the third field

11

=A10.fetch()

 

12

=A5.join@i(EID,A2, BONUS+1:SALARY1)

Delete the whole record since it doesn’t match the foreign key

13

=A12.fetch()

 

14

=A6.join@o(F1;EID,A2,~.BONUS+1:SALARY1)

Make the original record as the F1 field

15

=A14.fetch()

 

16

=A1.fetch()

 

17

=A3.result()

18

=A4.result()

19

=A5.result()

Get the same result as A18

20

=A6.result()

cs.join()[795][796]

Description:

A foreign-key-style join between a cursor and a table sequence/record sequence. 

Syntax:

cs.join(C:.,T:K,x:F,…; …;…)

Note:

The function matches foreign key field C of cursor cs with the key of parameter T to find the corresponding records in T. Add an F field represented by x, which is T’s field expression, to cs and return the original cursor. K can be omitted or represented by #. When omitted, K is T’s key; when written as #, K is represented by a sequence number. It supports the multicursor.   

Parameters:

cs

A cursor/A multicursor

C

Cursor cs’s foreign key; separate multiple fields in a composite key with the colon

T

A table sequence/A record sequence

K

T’s key

x

T’s field expression

F

Field name in expression x.

Options:

@i

Delete a record with a non-matching foreign key value; by default a non-matching record will be represented by null

@o(F;…)

Use the record as the value of F field to generate a new record; here expression x can be represented by ~, which is T’s record

@d

If parameters x:F are absent, only perform a filtering over the cursor by deleting its records where the foreign key is matched

Return value:

The orignal cursor

Example:

 

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from

EMPLOYEE where EID<10 order by  EID" )

Return retrieved data as a cursor:

2

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

Return a table sequence:

3

=A1.join(EID,A2,BONUS+1:SALARY1)

Normal join; a non-matching record will be displayed as null

4

=A3.fetch()

5

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID" )

Same as A1

6

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

Same as A2

7

=A5.join@i(EID,A6, BONUS+1:SALARY1)

Delete non-matching records

8

=A7.fetch()

9

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID" )

Same as A1

10

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

Same as A2

11

=A9.join@i(EID,A10: #1, #3+1:SALARY1)

#1 represents the 1st field; #3 represents the 3rd field

12

=A11.fetch()

Same as A8

13

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID" )

Same as A1

14

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

Same as A2

15

=A13.join@o(F1;EID,A14,BONUS+1:SALARY1)

Use records as values of F1field

16

=A15.fetch()

17

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID" )

Same as A2

18

=demo.query("select * from PERFORMANCE order by  EMPLOYEEID").keys(EMPLOYEEID)

Same as A2

19

=A17.join@o(F1;EID,A18,~:SALARY1)

Replace parameter x with the sign ~

20

=A19.fetch()

21

=file("D:\\test7.ctx")

 

22

=A21.create(#EMPLOYEEID,EVALUATION,BONUS;EMPLOYEEID

Create a composite table

23

=A22.attach(table3,#EMPLOYEEID,EVALUATION,BONUS)

Add an attached table

24

=demo.cursor("select * from PERFORMANCE")

Return a table sequence

25

=A23.append(A24)

Append records to A23’s attached table

26

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE where EID<10 order by  EID" )

 

Related functions:

join()

cs.join()[797][798]

Description:

A foreign-key-style join between a cluster cursor and a record sequence.

Syntax:

cs.join(C:.,T:K,x:F,…; …;…)

Note:

The function matches foreign key field C,… of cluster cursor cs with the key of parameter T to find corresponding records in table T. Add an F field represented by x, which is T’s field expression, to cs and return the original cluster cursor. K can be omitted or represented by #. When omitted, K is T’s key; when written as #, K is represented by a sequence number. It supports the multicursor.

Options:

@c

With a distributed cluster table, the operation won’t involve a cross-node reference but it assumes that the referenced records are local

Parameters:

cs

A cursor/multicursor/cluster cursor

C

cs’s foreign key; separate multiple fields in a composite key with the colon

T

A cluster memory table

K

T’s key

x

T’s field expression

F

Name of T’s field expression

Return value:

The original cursor

Example:

 

A

 

1

[192.168.18.143:8281]

 

2

=file@0("emp_1.ctx", A1)

 

3

=A2.create()

 

4

=A3.cursor()

A cluster cursor

5

[192.168.0.110:8281]

 

6

=file@0("PERFORMANCE.ctx",A5)

 

7

=A6.create()

 

8

=A7.cursor()

 

9

=A8.memory()

A cluster memory table

10

=A4.join(EID,A9:EMPLOYEEID, BONUS*12:total)

Match EID field of A4’s cluser cursor with the key field EMPLOYEEID of A9’s cluster memory table, make the value of calculating expression BONUS*12 over the memory table total field and join it up with the cluster cursor, and return the cluster cursor

11

=A10.fetch()

Fetch data from A10’s cursor

joinx()[799][800]

Here’s how to use joinx() function.

joinx()[801][802]

Description:

Join table sequences retrieved from a series of cursors.

Syntax:

joinx(csi:Fi,xj,..;…)

Note:

The function performs join@m over a resulting set generated from a series of ordered cursors csi and returns a new cursor. If parameter xj is omitted, join the cursors according to their primary keys; if parameter xj is present but there isn’t any primay key, perform the join based on values of xj. The function can be also used to join multiple multicursors where each one must have the same number of parallel cursors or subcursor. Parameter csi can be a table sequence.

Supposing multiple cursors csi are already ordered by relational field/expression xj, the function performs a join between them on the condition that xj’s value is equivalent to the value of x1 field and returns a cursor consisting of Fi,…. fields. Fi,…. are referencing fields that reference the records of the cursors csi. Note: xjonly supports the ascending order.

Regardless of the number of cursors being joined, the equivalence determination is conducted according to cursor cs1’s x1 field. Therefore, it is a one-to-many relationship.

 

Options:

@f

Full join. If no matching records are found, then use nulls to correspond.

@1

Left join. Note that it is the number “1”, instead of letter “l”.

@p

Perform a join according to positions, while ignoring the parameter xj

@u

Order by the key isn’t a must when cs1 is cursor while others are in-memory table sequences

Parameters:

csi

Cursors/table sequences being joined.

Fi

Field name of the result table sequence.

xj

Relational field/expression.

Return value:

A cursor

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE order by  EID" )

 

2

=demo.cursor("select * from PERFORMANCE order by  EMPLOYEEID")

 

3

=join@x(A1:EmployeeID1,EID;A2:EmployeeID2,EMPLOYEEID)

Normal join. Discard the non-matching items, and each field value points to a record in the original cursor.

4

=A3.fetch()

5

=demo.cursor("select * from EMPLOYEE order by  EID" )

 

6

=demo.cursor("select * from PERFORMANCE order by  EMPLOYEEID")

 

7

=joinx@f(A5:EmployeeID1,EID;A6: EmployeeID2,EMPLOYEEID)

Full join. If no matching records, then use nulls to correspond.

8

=A7.fetch()

9

=demo.cursor("select * from EMPLOYEE order by  EID" )

 

10

=demo.cursor("select * from PERFORMANCE order by  EMPLOYEEID")

 

11

=joinx@1(A9:EmployeeID2,EID-5;A10:EmployeeID1,EMPLOYEEID)

Left join. The first cursor is regarded as the basis. If there are no matching records, then use null to correspond.

12

=A11.fetch()

13

=demo.cursor("select * from EMPLOYEE order by  EID" )

 

14

=demo.cursor("select * from PERFORMANCE where EMPLOYEEID>3 order by  EMPLOYEEID ")

 

15

=joinx@p(A13:EmployeeID2;A14:EmployeeID1).fetch()

Perform the join according to positions

16

=demo.query("select top 3 EID,NAME from EMPLOYEE")

 

17

=A16.modify(2,2,null)

 

18

=A16.cursor()

 

19

=demo.cursor("select top 20 * from EMPLOYEE")

 

20

=joinx(A18:Employee1,EID,NAME;A19: Employee2,EID,NAME)

Perform a join by EID and NAME fields

21

=A20.fetch()

22

=demo.query("select top 3 EID,NAME from EMPLOYEE").keys(EID)

 

23

=A22.cursor()

 

24

=demo.query("select top 20 * from EMPLOYEE").keys(EID)

 

25

=A24.cursor()

 

26

=joinx(A23:Employee1;A25: Employee2)

Perform the join according to primary keys

27

=A26.fetch()

28

=demo.cursor("select * from EMPLOYEE" )

 

29

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

 

30

=joinx@u(A28:EmployeeID1,EID;A29:EmployeeID2,EMPLOYEEID)

With @u option, order by the ky isn’ required as only A28 is the cursor and others are in-memory table sequences

 

31

=A30.fetch()

Related functions:

join()

joinx()[803][804]

Description:

Join up synchronously segmented cluser cursors.

Syntax:

joinx(csi:Fi,xi,..;…)

Note:

Suppose that the joining fields/expressions xi are ordered in an ascending order, the function joins up multiple synchronously segmented cluster cursors according to the condition that the values of the joining fields/expressions xi and x1 are equal to generate a cluster cursor consisting of fields Fi,…. Parameter Fi is a referencing field that references records of the csi, the sequence of the original cluster cursors. Join up the cluster cursors by primary keys when parameter xj is absent; and by the values of xj when the parameter is present but no dimensions are set. The function supports cluster multicursors that should contain the same number of subcursors. The join operation is performed by matching the joining field x1 in cs1 with the values of all the other joining fields/expressions, which means it is a one-to-many relationship. The to-be-joined cursors should be stored in one node; cross-node retrieval isn’t allowed.

Options:

@f

Full join; use null to correspond when there is no matching value

@1

Left join; the option is number 1 instead of letter l

@p

Join by positions; ignore parameter xj

Parameters:

Fi

The resulting field

csi

To-be-joined cluster cursors

xi

Joining field/expression

Return value:

Synchronously distributed cluster cursor

Example:

 

A

B

 

1

[192.168.0.114:8281,192.168.18.131:8281]

 

A cluster of two nodes

2

=file@0z("salespart.ctx", A1)

=file@0z("orderpart.ctx", A1)

Composite tables salespart.ctx  and orderpart.ctx are stored on the two nodes by segments

3

=A2.create()

=B2.create()

Open the two composite tables respectively

4

=A3.cursor()

=B3.cursor()

Generate cluster cursors for the two cluster compositetables respectively

5

=B4.sortx(EID; A4)

=joinx(A4:s,EID;A5:o,EID)

A5 sorts B4’s result, distributes it according to the distribution way of salespart.ctx and generate a cursor for it; B5 joins up the two synchronously distributed cluster cursors

 

 

A

 

1

=file@n("D:/t1.ctx","192.168.0.111:8281")

 

2

=A1.create()

Open cluster composite table t1.ctx

3

=A2.cursor@m(;;3)

Generate a synchrounous 3-parts multicursor from A2’s cluster composite table

4

=file@n("D:/t2.ctx","192.168.0.111:8281")

 

5

=A4.create()

Open cluster composite table t2.ctx

6

=A5.cursor(;;A3)

Synchronously segment A5 according to A3’s multicursor

7

=joinx(A3:t1,EID;A6:t2,EID).fetch()

Join up A3 and A6 to perform a multithreading computation

cs.joinx()[805][806]

Description:

Join up a cursor and a segmentable bin file by the foreign key.

Syntax:

cs.joinx(C:…,f:K:…,x:F,…;…;…;n)

Note:

The function matches the foreign key fields C,… in cursor cs with the key K in segmentable bin file f, which is ordered by K, to find the corresponding record in f, and makes the record’s expression x a new field F and adds it to cs to generate a new cursor. The value corresponding to a mismatched record will be recorded as null.

Options:

@i

Discard the records whose foreign key values can’t be matched

@o(F;)

Generate a new record by adding a F field whose values are referenced records; expression x can be represented by ~, which means a record

@d

When parameters x:F are absent, discard the records whose foreign key values are matching

@q

Speed up the matching action according to a certain order when the cursor contains a relatively small amount of data or it is a sequence

@c

Speed up the matching action if the cursor is ordered by the first foreign key field; can work with @q option

@u

Speed up the matching operation by shuffling records in the cursor

Parameters:

cs

A cursor/multicursor

C

cs’s foreign key

f

A bin file

K

The bin file’s key; it is treated as row number when written as #

x

An expression of the field of f

F

Name of the field of expression x

n

Number of buffer rows

Return value:

A cursor

Example:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from

EMPLOYEE where EID<10 order by  EID" )

Return a data retrieval cursor:

2

=file("D:\\joinx.btx")

Return a bin file:

3

=A1.joinx(EID,A2:EMPLOYEEID,BONUS+1:SALARY1)

Normal join; use null to represent the records whose foreign key values are mismatched

4

=A3.fetch()

5

=A1.joinx@i(EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Discard the records whose foreign key values are mismatched

6

=A5.fetch()

7

=A1.joinx@i(EID,A2:EMPLOYEEID;5)

The result when parmeters x:F are absent when @i option works:

8

=A7.fetch()

9

=A1.joinx@o(F1;EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Use the original records as values of the new field F1

10

=A9.fetch()

11

=A1.joinx@o(F1;EID,A2:EMPLOYEEID,~:SALARY1;5)

Use ~ to represent parameter x

12

=A11.fetch()

13

=A1.joinx@d(EID,A2:EMPLOYEEID;5)

Keep records whose foreign key values are  mismatched when parameters x:F are absent

14

=A13.fetch()

15

=A1.joinx@q(EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Retrieve corresponding records from the bin file in order to match with the foreign key

16

=A15.fetch()

16

=A1.joinx(EID,A2:#1,BONUS+1:SALARY1)

#1 represents the field whose number is 1, which is EMPLOYEEID here

17

=A16.fetch()

cs.joinx()[807][808]

Description:

Join up a cursor and an entity table by the foreign key.

Syntax:

cs.joinx(C:…,T:K:…,x:F,…;…;…;n)

Note:

The function matches the foreign key fields C,… in cursor cs with the key K in entity table T, which is ordered by K, to find the corresponding record in T, and makes the record’s expression x a new field F and adds it to cs to generate a new cursor. The value corresponding to a mismatched record will be recorded as null. Parameter n is the number of buffer rows.

Options:

@i

Discard the records whose foreign key values can’t be matched

@o(F;…)

Generate a new record by adding a F field whose values are referenced records; expression x can be represented by ~, which means a record

@d

When parameters x:F are absent, discard the records whose foreign key values are matching

@q

Speed up the matching action according to a certain order when the cursor contains a relatively small amount of data or it is a sequence

@qc

Speed up the matching action if the cursor is ordered by the first foreign key field

@u

Speed up the matching operation by shuffling records in the cursor

Parameters:

cs

A cursor/multicursor

C

cs’s foreign key

T

An entity table/composite table cursor

K

The entity table’s key; it is treated as row number when written as #

x

An expression of the field of T

F

Name of the field of expression x

n

Number of buffer rows

Return value:

A cursor

Example:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from

EMPLOYEE where EID<10 order by  EID" )

Return a data retrieval cursor:

2

=file("D:\\PERFORMANCE3.ctx")

 

3

=A2.create()

Open an entity table:

4

=A1.joinx(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Normal join; use null to represent the records whose foreign key values are mismatched

5

=A4.fetch()

6

=A1.joinx@i(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Discard the records whose foreign key values are mismatched

7

=A6.fetch()

8

=A1.joinx@d(EID,A3:EMPLOYEEID;5)

Keep records whose foreign key values are  mismatched when parameters x:F are absent

9

=A8.fetch()

10

=A1.joinx@o(F1;EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Use the original records as values of the new field F1

11

=A10.fetch()

12

=A1.joinx@o(F1;EID,A3:EMPLOYEEID,~:SALARY1;5)

Use ~ to represent parameter x

13

=A12.fetch()

14

=A1.joinx@q(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Retrieve corresponding records efficiently from the entity table in order to match with the foreign key

15

=A14.fetch()

16

=demo.cursor("select * from PERFORMANCE")

Return a cursor

17

=file("D:/employees.ctx").create().cursor()

Return a composite table cursor

18

=A16.joinx(EMPLOYEEID,A17:EID,Name).fetch()

Join a cursor and a composite table cursor via the foreign key

19

=A1.joinx(EID,A3:#1,BONUS+1:SALARY1;5)

#1 represents the field whose number is 1, which is EMPLOYEEID here

20

=A19.fetch()

 

ch.joinx()[809][810]

Description:

Join up a channel and a bin file or an entity table by the foreign key.

Syntax:

ch.joinx(C:…,f:K:…,x:F,…;…;…;n)   Match C,… field in channel ch with key K of the segmentable bin file f to find the corresponding records in f

ch.joinx(C:…,T:K:…,x:F,…;…;…;n)   Match C,… field in channel ch with key K of the entity table T to find the corresponding records in T

Note:

The function matches the foreign key fields C,… in channel ch with the key K in bin file f or entity table T, which is ordered by K, to find the corresponding record in f /T, and makes the record’s expression x a new field F and adds it to ch to generate a new channel. The value corresponding to a mismatched record will be recorded as null. Parameter n is the number of buffer rows.

Options:

@i

Discard the records whose foreign key values can’t be matched

@o(F;…)

Generate a new record by adding a F field whose values are referenced records; expression x can be represented by ~, which means a record

@d

When parameters x:F are absent, discard the records whose foreign key values are matching

@q

Speed up the matching action according to a certain order when the channel contains a relatively small amount of data or it is a sequence

@qc

Speed up the matching action if the channel is ordered by the first foreign key field

@u

Speed up the matching operation by shuffling records in the channel

Parameters:

ch

A channel

C

ch’s foreign key

f

A bin fiel

T

An entity table

K

The bin file/entity table’s key

x

An expression of the field of f/T

F

Name of the field of expression x

n

Number of buffer rows

Return value:

    Channel

Example:

Bin file:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from

EMPLOYEE where EID<10 order by  EID" )

Return a data retrieval cursor:

2

=file("D:\\joinx.btx")

Return a bin file:

3

=channel()

Create a channel

4

=channel()

 

5

=channel()

 

6

=channel()

 

7

=channel()

 

8

=channel()

 

9

=A1.push(A3,A4,A5,A6,A7,A8)

Join cursor A1 to channels A3, A4, A5, A6, A7 and A8, and be ready to push data into the channels

10

=A3.joinx(EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Normal join; use null to represent the records whose foreign key values are mismatched

11

=A4.joinx@i(EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Discard the records whose foreign key values are mismatched

12

=A5.joinx@o(F1;EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Use the original records as values of the new field F1

13

=A6.joinx@o(F1;EID,A2:EMPLOYEEID,~:SALARY1;5)

Use ~ to represent parameter x

14

=A7.joinx@d(EID,A2:EMPLOYEEID;5)

Keep records whose foreign key values are  mismatched when parameters x:F are absent

15

=A8.joinx@q(EID,A2:EMPLOYEEID,BONUS+1:SALARY1;5)

Retrieve corresponding records from the bin file in order to match with the foreign key

16

=A1.fetch()

Push data in cursor A1 into the channels

17

=A3.result().fetch()

18

=A4.result().fetch()

19

=A5.result().fetch()

 

20

=A6.result().fetch()

21

=A7.result().fetch()

22

=A8.result().fetch()

 

 

Entity table:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from

EMPLOYEE where EID<10 order by  EID" )

Return a data retrieval cursor:

2

=file("D:\\PERFORMANCE3.ctx")

 

3

=A2.create()

Open an entity table:

4

=channel()

Create a channel

5

=channel()

 

6

=channel()

 

7

=channel()

 

8

=channel()

 

9

=channel()

 

10

=A1.push(A4,A5,A6,A7,A8,A9)

Join cursor A1 to channels A3, A4, A5, A6, A7 and A8, and be ready to push data into the channels

11

=A4.joinx(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Normal join; use null to represent the records whose foreign key values are mismatched

12

=A5.joinx@i(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Discard the records whose foreign key values are mismatched

13

=A6.joinx@o(F1;EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Use the original records as values of the new field F1

14

=A7.joinx@o(F1;EID,A3:EMPLOYEEID,~:SALARY1;5)

Use ~ to represent parameter x

15

=A8.joinx@d(EID,A3:EMPLOYEEID;5)

Keep records whose foreign key values are  mismatched when parameters x:F are absent

16

=A9.joinx@q(EID,A3:EMPLOYEEID,BONUS+1:SALARY1;5)

Retrieve corresponding records from the entity table in order to match with the foreign key

17

=A1.fetch()

Push data in cursor A1 into the channels

18

=A4.result().fetch()

19

=A5.result().fetch()

20

=A6.result().fetch()

21

=A7.result().fetch()

22

=A8.result().fetch()

23

=A9.result().fetch()

 

json()[811][812]

Description:

Parse a string, a record or a table sequence in JSON format.

Syntax:

        json(x)

Note:

If parameter x is a JSON string, the function parses it into a table sequence to return; if parameter x is a record or a table sequence, the function parses it into a JSON string to return.

Parameters:

x

A JSON string/record/sequence

Return value:

A table sequence/JSON string

Example:

1

{name:'China',province:[{name:'Heilongjiang',cities:

{city:['Harbin','Daqing']}},{name:'Guangdong',

cities:{city:['Guangzhou','Shenzhen','Zhuhai']}},{name:'Taiwan',cities:

{city:['Taipei','Kaohsiung']}},{name:'Xinjiang',cities:{city:['Urumqi']}}]}

 

2

=json(A1)

A1 is a JSON string, which is parsed into a table sequence and return the result:

3

=demo.query("select EID,NAME,SURNAME from EMPLOYEE")

4

=json(A3)

A3 is a table sequence, which is parsed into a JSON string and return the result:

k()[813][814]

Description:

Generate a serial byte with a specified number of bytes.

Syntax:

k(n:l)

Generate a serial byte with the length of l bytes from the integer n

k(ni,…)

Generate a serial byte where byte values are ni,…

Note:

The function generates a serial byte (Sbyte) with a specified number of bytes. A SByte is an integer made up of byte values and can have a maximum length of 8 bytes. It is used to represent key values. Two SBytes with the same length are comparable, but can’t be computed.

Parameters:

n

An integer

l

The length of bytes with 1 being the default value; the max value is 8

ni

Byte value

Return value:

A serial byte value

Example:

=k(1)

1; generate a serial byte value whose length is one byte from integer 1

=k(256:1)

Generate a serial byte value whose length is 1 byte from integer 256; since 256 occupies more than one byte, error will be reported:Out-of-bound index

=k(256:2)

256; generate a serial byte value whose length is two bytes from integer 256

=k(1,2,3)

66051

k{}[815][816]

Description:

Get certain bytes from a serial byte to form a new serial byte value.

Syntax:

k{a,…,b:c,…}

Note:

The function gets certain bytes a,…,b:c,… from a serial byte k to form a new serial byte value. {} can only use constants.

Parameters:

k

a

A serial byte value

The ath byte of a serial byte

b:c

The bytes from the bth position to the cth position in a serial byte

Return value:

A serial byte

Example:

=k(4,5,6,8){2}

5; get the second byte from serial byte value k(4,5,6,8) to generate a singe-byte serial byte value

 

=k(4,5,6,8){1:3}

263430; get the bytes from 1 to 3 from serial byte value k(4,5,6,8) to generate a new serial byte value

 

=k(4,5,6,8){1,2,3}

263430; get the first 3 bytes from serial byte value k(4,5,6,8) to generate a new serial byte value

 

=k(4,5,6,8){1,2:3}

263430; get the first byte and the next two bytes from serial byte value k(4,5,6,8) to generate a new serial byte value

 

=k(1,2,3,4,5,6,7){1,2:3,5,6}

4328719622 get the first, the 2nd and 3rd, and the 5th and the 6th bytes from serial byte value k(1,2,3,4,5,6,7) to generate a new serial byte value

 

 

 

 

 

 

A

 

 

1

=create(k1,v1).record([k(1000:3),110000,k(223332:3),2045803,k(31121:3),90730,k(453384:3),78940,k(231410:3),100])

Create a table sequence

 

2

=file("D:/ckv.ctx")

The composite table file

 

3

=A2.create(#k1:3,v1;k1:3)

Create the composite table’s base table where key k1 is the serial byte data whose length is 3

 

4

=A3.append(A1.cursor())

Append cursor records to the base table

 

5

=A3.cursor(k1).fetch()

Return data of column k1 in the base table

 

6

=A3.cursor(k1{1}).fetch()

Get the serial bytes of the fist bytes of k1’s values

 

7

=A3.cursor(k1{2}).fetch()

Get the serial bytes of the second bytes of k1’s values

 

8

=A3.cursor(k1{2:3}).fetch()

Get the serial bytes of the second and third bytes of k1’s values

 

 

kafka_close()[817][818]

Description:

Close a Consumer connection.

Syntax:

kafka_close (fd)                

Note:

The function closes a Consumer connection to release resources.

Parameter:

fd

A consumer object

Example:

 

A

 

1

=kafka_subscribe("D:/kafka_string.properties";"topic-test";"String","byte[]")

Connect to Kafka server

2

=kafka_close(A1)

Close connection to Kafka server

kafka_commit()[819][820]

Description:

Commit the current consumer offset position.

Syntax:

kafka_commit (fd)                

Note:

By default, the function commits the real-time consumer offset position.

Parameters:

fd

A consumer object

Example:

 

A

 

1

=kafka_subscribe("D:/kafka_string.properties";"topic-test";"String","byte[]")

Connect to Kafka server

2

=kafka_poll(A1)

Get records from topic test1

3

=kafka_commit(A1)

Commit the current consumer offset

 

kafka_poll()[821][822]

Description:

Return records in a Consumer topic as a table sequence.

Syntax:

kafka_poll (fd, timeout)                

Note:

The function gets records of the current Consumer topic.

Parameters:

fd

A Consumer object

timeout

The interval of consumer poll loop; default is 1000ms

Options:

@c

Enable a cursor-based query

Return value:

Table sequence or cursor

Example:

 

A

 

1

=kafka_subscribe("D:/kafka_string.properties";"topic-test";"String","byte[]")

Connect to Kafka server

2

=kafka_poll(A1)

Get records from topic test1

3

=kafka_poll@c(A1)

Get records from topic test1 with cursor

kafka_subscribe()[823][824]

Description:

Connect to Kafka server.

Syntax:

kafka_subscribe (prop:value,....;topic,...;keyType, valueType)                

kafka_subscribe (filename or fileObject; topic,...; keyType, valueType)

Note:

The function connects to the Kafka server, and inputs the property parameter properties in the form of k:v, or stores properties as a configuration file suffixed with .properties.

Parameters:

prop:value

The property parameter Properties, which will be input in the form of k:v and which can include multiple property parameters; refer to Kaka documents to learn more about this

topic

Query a topic or multiple topics

keyType

The data type of a Consumer key, which is by default the string; it supports int, integer, float, long and string

filename

The property parameter file suffixed with .properties

fileObject

valueType

A file object

The data type of a Consumer key, which is by default the string; it supports int, integer, float, long and string

Return value:

A Consumer object

Example:

 

A

 

1

=kafka_subscribe("D:/kafka_string.properties";"test1";"String","byte[]")

Connect to Kafka server through the configuration file kafka_string.properties where the topic is test1, key is String, and value is byte[]

2

=kafka_subscribe(file("D:/kafka_string.properties");"test1";"String","byte[]")

Connect to Kafka server through the configuration file object, with the rest of the settings being same as the above

3

=kafka_subscribe("bootstrap.servers":"192.168.0.144:9092","zookeeper.connect":"192.168.0.144:2181",

"group.id":"test","zookeeper.session.timeout.ms":"4000","zookeeper.sync.time.ms":"200",

"auto.commit.interval.ms":"500","auto.offset.reset":"latest",

"serializer.class":"kafka.serializer.StringEncoder",

"key.deserializer":"org.apache.kafka.common.serialization.StringDeserializer",

"value.deserializer":"org.apache.kafka.common.serialization.ByteArrayDeserializer";

"test1";"String","byte[]")

Connect to Kafka server through a parameter, with the rest of the settings being same as the above

key()[825][826]

Here’s how to use key() function.

r.key()[827][828]

Description:

Get the primary key value of a record.

Syntax:

r.key(Fi,…)

Note:

The function gets the primary key value of record r according to key Fi. If Fi is omitted, return the whole primary key value. If the key isn’t set for r, return null. If it is a one-field key, just return the single key value; and with a composite key, return a sequence of values.

Parameters:

r

A record

Fi

Key

Return value:

A record’s primary key

Example:

 

A

 

1

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

 

2

=A1(1).key()

1; return null because A1 doesn’t set a key

3

=A1.keys(EID)

Set EID field as the key

4

=A1(1).key()

1; return the primary key value of the first record

5

=A1.keys(EID,DEPT)

Set EID&DEPT fields as the key

6

=A1(1).key()

[1,R&D]; the primay key value is a sequence because the key consist of two fields

7

=A1(1).key(DEPT)

R&D; get the value of a specified key field

Related functions:

T.keys()

v.v()

keys()[829][830]

Here’s how to use keys() function.

T.keys()[831][832]

Description:

Set a key for a table sequence.

Syntax:

T.keys(Ki,…)

Note:

The function sets Ki,… as the key of the table sequence T. The absence of the parameter will clear the key. A T.create() operation will copy the key at the same time.

Parameters:

T

A table sequence

Ki

Key

Return value:

A table sequence with a key

Example:

 

A

 

1

=demo.query("select EID,NAME,DEPT,SALARY from EMPLOYEE order by EID asc,DEPT asc")

 

2

=A1.keys(EID,DEPT)

Set EID&DEPT fields as A1’s key

3

=A1(1).key()

[1,R&D]

4

=A1.keys()

Remove the ky

5

=A1(1).key()

Return null because A1 doesn’t set a key

6

=A1.keys(EID,DEPT)

 

7

=A1.create()

Copy the key since table sequence T has one

8

=A7.insert(0,1,"Jack","HR",3000)

9

=A8(1).key()

[1,HR]

Related functions:

r.key()

v.v()

T.keys(Ki,…)[833][834]

Description:

Define the key(s) for a memory table.

Syntax:

T.keys(Ki,…)

Note:

The function defines the key(s) Ki,… for memory table T.

Parameters:

Ki

Key name; can be one or multiple keys; delete all keys of a memory table when the parameter is absent

T

A memory table

Return value:

A memory table

Example:

 

A

 

1

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

Return cursor of the retrieved data

2

=A1.memory()

Return a memory table

3

=A2.keys(EID,NAME)

Set EID and NAME as the memory table’s keys

4

=A3(1).key()

Get the keys of the first record and return the result:

5

=A2.keys()

Delete all keys of the memory table

6

=A3(1).key()

Query the keys of the first record and return null

T.keys(Ki,…;n)[835][836]

Description:

Create an index over a primary key when the latter is set.

Syntax:

T.keys(Ki,…;n)     

Note:

The function set primary key Ki,... for table sequence/memory table T and, in the meantime, create an index over the key. To create a hash index, one of @i option and parameter n should be present. To create a serial byte index, omit parameter n. When both @s option and parameter n exist, ignore the option.

Parameters:

Ki

Primary key, which can be one or multiple; delete all keys of a memory table when this parameter is absent

T

A table sequence/memory table

n

An integer greater than 1, which is length of the hash table; its default lenght is the table length. Will be omitted when creating a serial byte index with @s option

Options:

@i

Create a hash index

@s

Create a serial byte index for a serial byte primary key; omit parameter n when using this option

Return value:

A table sequence/memory table

Example:

 

A

 

1

=demo.query("select EID,NAME,DEPT,SALARY from EMPLOYEE")

 

2

=A1.keys(EID,DEPT;1)

Set EID,DEPT as A1’s primary key and create a hash index for it;  length of the hash is 1

3

=A1.keys@i(EID,DEPT)

Same as A2

4

=A1.keys@i(EID,DEPT;1)

Same as A2

5

=A1.keys@s(EID)

Set EID as A1’s primary key and create a serial byte index over the key

 

6

=A1.keys@s(EID;1)

Set EID as A1’s primary key and create a hash index whose length is 1 for the key; ignore @s option since parameter n is present

lcm()[837][838]

Description:

Return the least common multiple.

Syntax:

lcm(xi,…)

lcm(A)

Note:

The function gets the least common multiple of the numeric members of [x1, x2,…]. If there is any member that is equal to or less than 0, than the lcm function returns the false value 0

Parameter:

A

A sequence

xi

An expression, which will be ignored if its value is not a number

Return value:

The least common multiple

Example:

lcm(5,2)

10

left()[839][840]

Description:

Get a substring starting from the leftmost side of a string.

Syntax:

left(string,n)

Note:

The function gets a substring with the length of n starting from the leftmost side of string string. If n<0, the substring’s length is the sum of source string’s length and the value of n.

Parameters:

string

The source string from which the substring is obtained

n

The length of the substring

Return value:

A string

Example:

left("abcdefg",3)

"abc"

left("abcdefg",-3)

"abcd" 

Related functions:

mid()

right()

len()[841][842]

Here’s how to use len() function.

A.len()[843][844]

Description:

Get the length of a sequence.

Syntax:

A.len()

Note:

The function gets the length of sequence A.

Parameters:

A

Sequence object

Return value:

An integer

Example:

 

A

 

1

=[1,2,4]

 

2

=A1.len()

3

3

=["a","b"].len()

2

4

=[]

 

5

=A4.len()

0

k.len()[845][846]

Description:

Get the length of a serial byte.

Syntax:

k.len()

Note:

The function returns the length of serial byte k, which is the number of bytes in k.

Parameters:

k

A serial byte

Return value:

An integer

Example:

k(2).len()

1

k(256:2).len()

2

k(1,2,3).len()

3

T.len()[847][848]

Description:

Get the number of records in a memory table.

Syntax:

T.len()

Note:

The function gets the number of records in memory table T.

Parameters:

T

A memory table

Return value:

An integer

Example:

 

A

 

1

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

Return cursor of retrieved data

2

=A1.memory()

Return a memory table

3

=A2.len()

9

len()[849][850]

Description:

Compute the length of a string.

Syntax:

len(s,cs)

Note:

The function computes the length of a string. The default charset is GB2312; calculate the string’s length in Unicode if parameter cs is absent.

Parameters:

s

String for which you want to compute the length

cs

Charset; can be omitted

Return value:

An integer

Example:

len("esproc")

6

len(" esproc ")

8

len("esproc",)

6

len("esproc","UTF-8")

6

lg()[851][852]

Description:

Compute the logarithm to base 10.

Syntax:

lg(numberExp)

Note:

The function computes numberExp’s logarithm to base 10.

Parameters:

numberExp

Data for which you want to compute the logarithm to base 10

Return value:

Numeric value

Example:

lg(54)

1.7323937598229684

Related functions:

ln()

like()[853][854]

Description:

Find if a string matches a format string.

Syntax:

like(stringExp, formatExp)

Note:

The function checks if the string stringExp matches the format string formatExp. In the formate string, the symbol asterisk "*" matches 0 or multiple characters; and the question mark "?" matches a single character. An escape character is used to make "*" match the character itself, for example, \* is escaped to * and \\ to \.

Parameters:

stringExp

A string expression

formatExp

A format string expression

Option:

@c

It makes the matching case-insensitive, while the default is case-sensitive.

Return value:

Boolean value

Examples:

like("abc123", "abc*")

true

like("abc123", "abc1?3")

true

like("abc123", "abc*34")

false

like("abc123", "ABC*")

false

like@c("abc123", "ABC*")

true

like ("abc*123", "abc\*")

true

like("abc*123", "abc\\**")

true     abc\\** is escaped to abc\**

ln()[855][856]

Description:

Compute the natural logarithm of the parameter.

Syntax:

ln(numberExp)

Note:

The function computes the natural logarithm of parameter numberExp.

Parameters:

numberExp

Data for which you want to compute the natural logarithm

Return value:

Numeric value

Example:

ln(54)

3.9889840465642745

Related functions:

lg()

lock()[857][858]

Description:

Use a synchronization lock.

Syntax:

lock(n,s)

Note:

The function enforces limits on access to a file in an multithreading execution environment using lock-based synchronization. With the lock, only one thread can access and process the file at a time.

Parameters:

n

Lock name

s

Timeout (in millisecond); waiting to be locked if the parameter is absent

Options:

@u

Unlock the restriction

Return value:

Lock name

Example:

   Locking:

 

A

 

1

=lock(1)

Use a lock named 1

2

>output("Task "/arg1/" start...")

Output the parameter and start to calcualte

3

=file("D:/file/test/1.btx")

Create a btx file

4

=create(ID,Value)

Create a table sequence

5

>A4.record([arg1,arg1*arg1])

Add records to A4’s table sequence

6

>sleep(1000)

Make the system sleep for 60s

7

>A3.export@ab(A4)

Write A4’s table sequence into the btx file

8

>output("Task "/arg1/" finished.")

Output the parameter and finish the calculation

9

>lock@u(1)

Unlock the access restriction

File access:

 

A

 

1

=file("D:/file/test/1.btx")

 

2

D:\test\December’s esProc release \lock1.dfx

 

3

=callx(A2,to(100))

When using callx() function to acess a file, the max number of parallel task set in Tool -> Options should be greater than 1 in case that the lock-based synchronization reports an error

4

=A1.import@b()

 

 

long()[859][860]

Description:

Convert a string or a number to a 64-bit long integer.

Syntax:

long(stringExp)

long(numberExp)

Note:

The value of parameter stringExp must be a string that consists of a long integer which has 64 bits or less. For a value with more than 64 bits, the result of long(stringExp) is imprecise and its decimal part, if any, will be truncated.

The value of parameter numberExp must be a long integer which has 64 bits or less. For a value with more than 64 bits, the result of long(numberExp) is imprecise.

Parameters:

stringExp

The string expression you want to convert as a long integer.

numberExp

The number you want to convert as a long integer, whose decimal part, if any, will be truncated.

Return value:

A 64-bit long integer

Examples:

long("1234567")

1234567

long(1234567.789)

1234567

Related functions:

float()

int()

decimal()

number()

string()

lower()[861][862]

Description:

Convert all characters of a string to lower case.

Syntax:

lower(s)

Note:

The function converts all characters of a string to lower case.

Parameters:

s

The string you want to convert to the lower case

Options:

@q

A quoted string won’t be converted

Return value:

A string

Example:

lower("ABCdef")

abcdef

lower("defABC")

defabc

lower@q("\'AD\'")

lower("\'AD\'")

'AD'

'ad'

 

 

A

 

1

"ABC"

 

2

=lower@q(A1)

"ABC"

Related functions:

upper()

m()[863][864]

Here’s how to use m() function.

A.m()[865][866]

Description:

Get members at specified positions.

Syntax:

A.m(i)

-n<=i<=n and i is not equal to 0; 1<=i<=n indicates getting the ith member; -n<=i<=-1 indicates getting the ith member from the bottom

A.m(P)

P is a non-zero n-integer sequence

Note:

A is a sequence whose length is n, from which you get members at specified positions. The function is generally used to get members reversely from a sequence.

Parameters:

A

A sequence expression

i

An integer

P

A non-zero n-integer sequence

Options:

@r

Turn back if the specified position exceeds the boundary of A, that is, to set i=if(i%n==0,n,i%n), where n is the length of A.

@0

The member represented by a sequence number that exceeds the boundary of A will be excluded from the result.

Return value:

A value or a sequence composed of the members at the specified positions in sequence A

Example:

 

A

 

1

[a,b,c,d,e,f,g,h,i,j]

 

2

=A1.m(2)

b

3

=A1.m(-2)

i

4

=A1.m([2,3])

[b,c]

5

=A1.m([-2,-3])

[i,h]

6

=A1.m@0([5,12])

[e]

7

=A1.m@r([5,12])

[e,b]

Related functions:

A.p()

A.m(a:b,c,d:e)[867][868]

Description:

Get members of a sequence at specified positions to form a new sequence.

Syntax:

A.m(a:b,c,d:e)

 

Note:

A is a sequence whose length is n, from which you get members at specified positions to form a new sequence, with the condition -n<=a<=n & a!=0. If 1£a£n, it is the ath member of sequence A when counted from left to right; if -n£ a £-1, it is the ath member of sequence A when counted from right to left. The rules also apply to b, c, d, and e. So the function is ofent used to get members reversely from a sequence. The members a and d represent must be respectively on the left side of the members b and e designate. When the parameter on the left side of the colon is omitted, the default value is 1; when the parameter on the right side of the colon is omitted, the default value is -1.

Parameters:

A

A sequence

a

An integer; 1 by default

b

An integer; -1 by default

c

An integer

d

An integer; 1 by default

e

An integer; -1 by default

Return value:

A sequence

Example:

 

A

 

1

=to(1,100).m(1:3,9,97:)

[1,2,3,9,97,98,99,100]

2

=to(1,100).m(:5,-1,66:-32)

[1,2,3,4,5,100,66,67,68,69]

max()[869][870]

Here’s how to use max() function.

A.max()[871][872]

Description:

Compute the maximum value of all the non-null members in a sequence.

Syntax:

A.max()

Equivalent to max(x1,…,xn)

Note:

The function computes the maximum value of all the non-null members in sequence A. Note that this function doesn’t apply to a sequence whose members are not of the same data type.

Parameters:

A

A sequence

Return value:

The maximum value of all members in sequence A

Example:

 

A

 

1

=[8,-6,1,3,5].max()

8

2

=["c","b","e","A"].max()

"e"

3

=["a",1].max()

Error message is displayed because the members are of different data types

4

=["a",null,"b"].max()

"b"

5

=max(8,-6,1,3,5)

8

Related functions:

A.sum()

A.avg()

A.min()

A.count()

A.max(x)

A.max(x)[873][874]

Description:

Compute x with each member of the sequence and then find the maximum value of the members of the new sequence.

Syntax:

A.max(x)

Equivalent to A.(x).max()

Note:

The function loops through members of sequence A and returns the maximum value among members of the new sequence.

Parameters:

A

A sequence

x

Generally an expression of a single field name, or a legal expression composed of multiple field names

Return value:

The maximum value of members of a new sequence obtained by performing computations on members of sequence A.

Example:

 

A

 

1

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

 

2

=A1.max(SALARY)

Compute the highest salary

3

=A1.(SALARY+100).max()

Add 100 to the salary of each employee and then compute the highest salary

Related functions:

A.max()

maxp()[875][876]

Here’s how to use maxp() function.

A.maxp()[877][878]

Description:

Get the member of a sequence that makes the maximum value for the expression.

Syntax:

A.maxp(x)

Note:

The function computes expression x with each member of sequence A and returns the member which makes the maximum value for expression x.  

Options:

@1

Return the first member that fulfills the condition.

@a

Return all the members that fulfill the condition. By default, return what @1 gets.

@z

Search the member from back to front

Parameters:

A

A sequence

x

The expression to be computed

Return value:

The member which makes the maximum value for the expression x

Example:

 

A

 

1

[2,5,4,3,2,1,4,1,3]

 

2

=A1.maxp(~*~)

5, @1 is the default option

3

=A1.maxp@a(~*~)

[5]

4

=A1.maxp@z(~*~)

5

5

=A1.maxp@az(~*~)

[5]

6

=demo.query("select EID,NAME,BIRTHDAY from EMPLOYEE")

 

7

=A6.maxp(BIRTHDAY)

Related functions:

A.pmax()

A.minp()

mcursor()[879][880]

Here’s how to use mcursor() function.

CS.mcursor()[881][882]

Description:

Generate a multicursor based on a sequence of cursors.

Syntax:

CS.mcursor()

Note:

The function generates a multicursor based on CS, a sequence of cursors. Every cursor in the cursor sequence must have the same structure. A multi-multicursorwill be generated if CS is a sequence of multicursor.

Parameters:

CS

A sequence of cursors

Return value:

Multicursor

Example:

test_mcs.dfx is the deployment file for deploying remote node servers. The nodes are "192.168.0.204"," 192.168.0.205","192.168.0.206"; their port numbers are 8081. Below is the file:

 

A

1

=connect("demo").cursor("select * from SCORES  where SUBJECT=?",arg1)

2

return A1

 

 

A

 

1

=callx("test_mcs.dfx",["English","Math","PE"];["192.168.0.204:8081","192.168.0.205:8081","192.168.0.206:8081"])

Each of the three parallel nodes returns a cursor to form a cursor sequence

2

=A1.mcursor()

Generate a multicursor based on the cursor sequence

3

=A2.fetch()

Fetch all records from the multicursor

cs.mcursor()[883][884]

Description:

Generate a multicursor based on one cursor.

Syntax:

cs.mcursor(n)

Note:

The function generates a multicursor based on cursor cs, from which data is fetched and stored in n subcursors. If n isn’t set, the default value is the number of parallel tasks set in Tool>Options.

Parameters:

cs

A single cursor

n

An integer

Return value:

Multicursor

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE")

 

2

=A1.mcursor(3)

Create a multicursor

md5()[885][886]

Description:

Return a string’s MD5 signature.

Syntax:

Md5(s)

Note:

The function returns string x’s MD5 signature. MD5 is a widely used hash function producing a hash value.

Parameters:

s

A string

Return value:

A string

Example:

md5("abced")

median()[887][888]

Here’s how to use median() function.

A.median(k:n)[889][890]

Description:

Divide a sequence into multiple segments and return the specified bordering member(s).

Syntax:

A.median(k:n)

Divide sequence A into n segments evenly according to its length and return the bordering member between the kth segment and the (k+1)th segment

A.median(k:n,x)

Calculate expression x over each member of sequence A to generate a new sequence in ascending order, then divide the new sequence into n segments evenly according to its length and return the bordering member between the kth segment and the (k+1)th segment

A.median(k:n)

Note:

The function returns a sequence of the bordering members between every two segments when parmeter k is absent but parameter n is present.

Parameter x should always be present. When prameters k,n are absent, if the length of the sequence is an odd, return the median member value; if it is an even, return the average value of the two members in the middle. Perform a logical division if the length of the sequence is indivisible.

Parameters:

A

A sequence

k

The kth segment (1=<k<=n); return the bordering members of between every two segments as sequence when k is absent

n

The number of to-be-divided segments, which is greater than 1 and whose default is 2; can be omitted when parmeter k is absent

x

An expression

Return value:

A number or a sequence

Example:

 

A

 

1

=[1,2,3,4,5,6,7,8]

 

2

=A1.median()

As all parameters are absent and the length of the sequence is an even number, the function returns the average of the two members in the middle, that is (4+5)/2=4.5

3

=A1.median(2:3)

The sequence is divided as follows:

Divide the sequence into 3 segments and return the bordering member between the second segment and the third on, which is 6

4

=A1.median(:3)

As no segment is specified, return the bordering members between every two segments as a sequence, which is [3,6]

5

=A1.median(:10)

The sequence is divided as follows:

Result: [1,2,3,4,4.5,5,6,7,8]

6

=A1.median(:,~%2)

Divide each member of sequence A1 by 2 and get the remaider to generate a new sequence in ascending order: [0,0,0,0,1,1,1,1]; As prameters k,n are absent and the the length of the sequence is an even, the function returns the average value of the two members in the middle: (0+1)/2=0.5

7

A1.median(2:3,~%2)

Divide the new sequence evenly into 3 segments and return the bordering member between the 2nd and the 3rd : 1

memory()[891][892]

Here’s how to use memory() function.

cs.memory(K,…)[893][894]

Description:

Generate a memory table from a cursor.

Syntax:

cs.memory(K,…)

Note:

The function generates a memory table, whose key is K, from a cursor. When parameter K is absent, the newly-generated memory table will inherit the cursor’s key.

Parameters:

K

The key; can be omitted

cs

A cursor

Options:

@z

Generate a compressed memory table to save space

Return value:

A memory table

Example:

 

A

 

1

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

Return the cursor with retrieved data

2

=A1.memory(EID)

Return a memory table whose key is EID

cs.memory(K,…)[895][896]

Description:

Generate a cluster memory table from a cluster cursor.

Syntax:

cs.memory(K,…)

Note:

According to cluster cursor cs, the function generates a cluster memory table that distributed the same way as cs and whose key is K. If cs is a cluster multicursor, load a series of cursors in order.

Parameters:

K

The key; can be omitted

cs

A cluster cursor

Return value:

A cluster memory table

Example:

 

A

 

1

=file@n("D:/test0.ctx","169.254.121.62:8281")

Open a duplicate file

2

=A1.create()

Create a duplicate cluster table

3

=A2.attach(table)

Retrieve cluster table table

4

=A3.cursor(NAME,GENDER;EID<6)

Get NAME field and GENDER field where EID<6 from cluster table table and return them as a cursor

 5

=A4.memory(GENDER)

Generate a cluster memory table whose key is GENDER from a cluster cursor

 

memory(h,V)[897][898]

Description:

Generate a cluster memory table from a local memory table.

Syntax:

memory(h,V)

Note:

The function generates a cluster memory table from local memory table V, which is stored in a global variable, held in node sequence h.

Parameters:

h

Node sequence

V

A memory table’s global variable

Return value:

Cluster memory table

Example:

Generate a global variable:

 

A

 

1

=file@0("test1.ctx",["192.168.31.72:8281","192.168.31.72:8291"])

Open a cluster file

2

=A1.create()

Open a cluster composite table

3

=A2.memory(;;arg1)

arg1Generate global variable cluster memory table arg1 from A2’s cluster composite table

 

 

A

 

1

=memory(["192.168.31.72:8281","192.168.31.72:8291"],arg1)

Generate a cluster memory table from the local memory table arg1

2

=A1.cursor().fetch()

T.memory()[899][900]

Description:

Convert a compressed memory table into an uncompressed one.

Syntax:

T.memory()

Note:

The function converts a compressed memory table into an uncompressed one.

Options:

@z

Convert an uncompressed memory table into a compressed one to save memory space

Return value:

A memory table

Example:

 

A

 

1

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

Return a cursor containing retrieved data

2

=A1.memory@z(EID)

Return a compressed memory table whose key is EID

3

=A2.memory()

Convert a compressed memory table into an uncompressed one

4

=A3.memory@z()

Convert an uncompressed memory table into a compressed one

T.memory(C,…;w)[901][902]

Description:

Generate a memory table from an entity table.

Syntax:

T.memory(C,…;w)

Note:

The function filters entity table T according to filtering condition w and imports the data into the memory to generate a memory table containing column C. we can handle a memory table as we do to a table sequence. When parameter C,… is absent but parameter w is present, the semicolon before w can’t be omitted. If a column C is preceded by # in the entity table, column C will be the key of memory table T. The memory table inherits the entity table’s key if you don’t set a key for it.

Parameters:

C

A column name; import all columns when the parameter is omitted

w

Filtering condition; won’t perform filtering when the parameter is omitted

T

An entity table in a composite table

Return value:

    A memory table

Example:

 

A

 

1

=file("D:\\employees.ctx")

employees is an existing composite table file

2

=A1.create()

Open the composite table

3

=A2.attach(t1)

Return the composite table’s attached table t1

4

=A2.memory()

Generate a memory table using all columns of the base table

5

=A2.memory(EID,Dept,Name;EID<5)

Get some columns where EID<5 from the base table to generate a memory table

6

=A3.memory()

Get all columns from the attached table to generate a memory table

T.memory(C,…;w)[903][904]

Description:

Generate a cluster memory table from a cluster entity table.

Syntax:

T.memory(C,…;w)

Note:

The function generates a cluster memory table from a cluster entity table T, which must have at least one dimension that is used to segment T and facilitates the segmentation.  Clear a node’s memory at exit; will perform auto-clear when timeout occurs.

Parameters:

C

A column name; import all columns when the parameter is omitted

w

Filtering condition; won’t perform filtering when the parameter is omitted

T

A cluster composite table’s entity table with dimensions

Return value:

    A cluster memory table object

Example:

 

A

 

1

=file@0("emp1.ctx",["192.168.0.116:8281","192.168.0.129:8281"])

Open a duplicate file

2

=A1.create()

Create a duplicate cluster table

3

=A2.attach(t1)

Get cluster table t1

4

=A3.memory(NAME,GENDER;EID<5)

Get columns NAME and GENDER with EID being less than 5 from t1 to generate a memory table

 

merge()[905][906]

Here’s how to use merge() function.

A.merge()[907][908]

Description:

Merge multiple table sequences/record sequences.

Syntax:

A.merge (xi,…)

Note:

The function merges multiple table sequences/record sequences A(i)s (which can be represented as A(i)|…) according to the rules of r.v() function when parameter xi is omitted and primary keys are not set for A, a sequence of table sequences/record sequences. Every A(i) must be of the same structure.

Parameters:

A

Multiple table sequences/record sequences of the same structure

xi

A field of A(i); if performing merge by multiple fields, use the comma to separate them, for example, x1,x2...

Options:

 

@u

Remove the duplicates from the table sequence/record sequence generated from unioning members of A(i)s in certain order

 

@i

Return a table sequence/record sequence composed of the common members of A(i)s

 

@d

Generate a new table sequence/record sequence by removing members of A(2)&…A(n) from A(1).

@o

Do not assume that A(i) is already sorted by [xi,…]

@0

Put records with null values at the end

@x

Remove common members of A(i) and union the other members to generate a new table sequence/sequence

Return value:

Table sequence/record sequence

Example:

 

A

 

1

=demo.query("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<6")

 

EID field is ordered

2

=demo.query("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID>3")

EID field is ordered

3

=[A1,A2].merge(EID)

 

Merge A1 and A2 in order by EID field

4

=[A1,A2].merge@u(EID)

Merge A1 and A2 in order by EID field and remove duplicates from the result

5

=[A1,A2].merge@i(EID)

Merge A1 and A2 in order by EID field but only keep records that have duplicates

6

=[A1,A2].merge@d(EID)

Delete A2’s members from A1

7

=[A1,A2].merge@o(SALARY)

8

=[A1,A2].merge@x(EID)

Merge A1 and A2 to get a new sequence by removing their common members

9

=demo.query("select * from EMPLOYEE where GENDER = 'M'").keys(EID)

10

=demo.query("select * from EMPLOYEE where GENDER = 'F'").keys(EID)

11

=[ A9,A10].merge()

With xi omitted, this table sequence is the result of merge by the order of the primary keys

12

=demo.query("select * from EMPLOYEE where GENDER = 'M' and EID<15")

 

13

=demo.query("select * from EMPLOYEE where GENDER = 'M' and EID>=15")

 

14

=[A12,A13].merge(EID,GENDER)

Merge by the EID field and GENDER field

15

=A1.run(EID=null)

 

16

=[A2,A15].merge(EID)

17

=[A2,A15].merge@0(EID)

Related functions:

   CS.mergex()

Mergex()[909][910]

Here is how to use mergex() function.

CS.mergex()[911][912]

Description:

Merge data of the member cursors of a cursor sequence.

Syntax:

CS.mergex(xi,…)

Note:

CS is a sequence of cursors ordered by [xi,…], and from each cursor a sequence of records can be output. The function merges the records of these cursors by the expression xi. Members of the cursor sequence must be of the same structure. If members are multicursors, they must have the same number of parallel cursors and be segmented synchronically.

Parameters:

CS

A sequence of cursors.

xi

An expression. If perfoming merge by multiple fields, use comma to separate them, for example, x1,x2...

Options:

@u

Union operation. Remove the duplicate records from the resulting cursor obtained by unioning the cursor members of CS in certain order. By default the duplicate records are included

@i

Intersection operation. Return a cursor composed of common members of members of CS, the sequence of cursors.

@d

Difference operation. Create a new cursor by removing members of CS2&CSn from CS1

@0

Put records with null values at the end

@x

Only merge distinct records in member cursors

Return value:

A cursor

Example:

 

A

B

C

 

 

1

=demo.cursor("select * from STOCKRECORDS")

Retrieve data and return a cursor

 

2

For

 

 

3

 

=A1.fetch(500)

Fetch data from the cursor

4

 

if B3==null

break

 

5

 

else

 

 

6

 

 

=B3.sort(STOCKID)

Sort by STOCKID

7

 

 

=file("D:\\"+"a"+string(A2)+".txt").export@t(C6)

Store data retrieved each time in a file.

8

 

 

=B1=B1|file("D:\\"+"a"+string(A2)+".txt")

File object sequence

9

for B1

 

 

 

10

 

=A9.cursor@t()

 

 

11

 

=C1=C1|B10

 

File cursor sequence

12

=C1.mergex(STOCKID)

Merge members of the sequence in order by STOCKID.

13

=A12.fetch()

Get records from the merged cursor

14

=directory@p("D://*.txt")

Below are several txt files:

15

for A14

 

 

 

16

 

=file(A15).c

rsor@t()

=B14=B14|B16

 

17

=B14.mergex@i(STOCKID)

=A17.fetch()

 

 Return a cursor composed of their common members, with STOCKID already ordered.

18

=directory@p("D://*.txt")

 

The txt files are

the same as the above

19

for A18

 

 

 

20

 

=file(A19).cursor@t()

=B18=B18|B20

 

21

=B18.mergex@u(STOCKID)

=A21.fetch()

 

 Return a new cursor in which

duplicate records have been removed. STOCKID is already ordered.

 

22

=directory@p("D://*

txt")

 

The txt files are

the same as above

23

for A22

 

 

 

24

 

=file(A23).cursor@t()

=B22=B22|

24

 

25

=B22.mergex@d(STOCKID)

=A25.fetch()

 

 

A new cursor created by removing from the first cursor the members of the other cursors; STOCKID is already ordered.

26

=directory@p("D://*.txt")

 

 

 

27

for A26

 

 

 

28

 

=file(A27).cursor@t()

=B26=B26|B28

 

29

=B26.mergex@x(STOCKID)

=A29.fetch()

 

Get dinstinct recors from the cursors to create a new cursor ordered by STOCKID

Related functions:

A.merge()

cs.mergex()[913][914]

Description:

Merge all parts of a cluster cursor into a local ordinary cursor.

Synatx:

cs.mergex(xi,…)

Note:

The function merges all parts of a cluster cursor by field expression xi. Parameter cs is a sequence made up of all parts of a cluster cursor ordered by field expressions [xi,…]. If cs is multicursor for a composite table and there are no parameters, perform the merge by dimension(s).

Parameters:

cs

A sequence consisting of all parts of a cluster cursor

xi

A field expression; use the comma to separate multiple expressions if it is a merge by multiple fields, like x1,x2...

Return value:

An ordinary cursor

Example:

 

A

 

1

=file@0("emp2.ctx",["127.0.0.1:8282"])

Open a cluster file

2

=A1.create()

Create a cluster composite table

3

=A2.cursor(EID,NAME;EID<8)

Return a part of the cluster cursor

4

=A2.cursor(EID,NAME;EID>495)

Return a part of the cluster cursor

5

=[A3,A4].mergex(EID)

Merge two parts of the cluster cursor in A3 and A4 by EID and return a local ordinary cursor

6

=A5.fetch()

 

 

A

 

1

[192.168.0.110:8281,192.168.18.143:8281]

 

2

=file@0("emp.ctx", A1)

Distributed composite table file

3

=A2.create()

Open a cluster composite table

4

=A3.cursor@m(;;3)

Return a cluster multicursor

5

=A4.mergex()

Perform the merge by deminsion as A4 is a multicursor for a composite table and there are no parameters

mcs.mergex()[915][916]

Description:

Merge multicursors into an ordinary cursor.

Syntax:

mcs.mergex(xi,…)

Note:

The function merges multicursors by field expression xi. Parameter mcs is a sequence of multicursors ordered by field expressions [xi,…], in which each member is synchronously segmented and has the same number of segments. When mcs is a sequence of multicursors for a composite table, perform the merge automatically by dimensions.

Parameters:

mcs

A sequence of multicursors

xi

A field expression; use the comma to separate multiple expressions if it is a merge by multiple fields, like x1,x2...

Return value:

An ordinary cursor

Example:

 

A

 

1

=demo.query("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<6")

Data is ordered by EID

2

=demo.query("select EID,NAME,GENDER,SALARY from EMPLOYEE where EID<10 and EID>5")

Data is ordered by EID

3

=[A1.cursor(),A2.cursor()].mcursor()

Union A1 and A2 into a multicursor

4

=[A1.cursor(),A2.cursor()].mcursor()

Same as A3

5

=[A3,A4].mergex(EID)

Merge A3 and A3’s multicursors by EID

6

=A5.fetch()

mid()[917][918]

Description:

Return the substring of a string.

Syntax:

mid(s,start{,len})

Note:

The function returns a substring of s from the specified position start. The length of the substring is len.

Parameters:

s

The source string from which you get the substring

start

The starting position of the substring

len

The length of substring. By default, the length will be counted from the starting character to the end of the source string

Return value:

A string

Example:

mid("abcde",1)

abcde

mid("abcde",1,2)

ab

mid("abcde",3)

cde

Related functions:

left()

right()

millisecond()[919][920]

Description:

Get the millisecond from a specified datetime value.

Syntax:

millisecond(datetimeExp)

Note:

The function gets the millisecond from the datetime value datetimeExp.

Parameters:

datetimeExp

An expression whose result is a date or a datetime value of standard format

Return value:

An integer

Example:

millisecond(datetime("1980-02-27 12:00:02:123 ","yyyy-MM-dd HH:mm:ss:SSS"))

123

millisecond(now())

Milliseconds of the current time

Related functions:

year()

month()

day()       

hour()

minute()

second()

min()[921][922]

Here’s how to use min() function.

A.min()[923][924]

Description:

Compute the minimum value of all the non-null members in a sequence.

Syntax:

A.min()

Equivalent to min(x1,…,xn)

Note:

The function computes the minimum value of all the non-null members in sequence A. Note that this function doesn’t apply to a sequence whose members are of different data types.

Parameters:

A

A sequence

Return value:

The minimum value of all members in sequence A

Example:

 

A

 

1

=[8,-6,1,3,5].min()

-6

2

=["c","b","e","A"].min()

"A"

3

=["a",1].min()

An error message will be displayed because members are of different data types

4

=["a",null,"b"].min()

"a"

5

=min("c","b","e","A")

"A"

Related functions:

A.sum()

A.avg()

A.count()

A.min(x)

A.max()

A.min(x)[925][926]

Description:

Compute x with each member of the sequence and then find the minimum value of the members of the new sequence

Syntax:

A.min(x)

Equivalent to A.(x).min()

Note:

The function loops through each member of sequence A to compute expression x and return the minimum value of members of the resulting sequence.

Parameters:

A

A sequence

x

Generally an expression of a single field name, or a legal expression composed of multiple field names.

Return value:

The minimum value of all members after computations have been performed on sequence A.  

Example:

 

A

 

1

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

 

2

=A1.min(SALARY)

Compute the lowest non-null value of SALARY

3

=A1.(SALARY+100).min()

Add 100 to the salary of each employee and then compute the lowest salary

Related functions:

A.min()

minp()[927][928]

Here’s how to use minp() function.

 

A.minp()[929][930]

Description:

Get the member that makes the minimum value for the expression.

Syntax:

A.minp(x)

Note:

The function computes expression x with each member of sequence A and returns the member which makes the minimum value for the expression x

Options:

@1

Return the first member that fulfills the condition.

@a

Return all the members that fulfill the condition. By default, return what @1 gets

@z

Search the member from back to front

Parameters:

A

A sequence

x

The expression to be computed

Return value:

The member which makes the minimum value for the expression x

Example:

 

A

 

1

[2,5,4,3,2,1,4,1,3]

 

2

=A1.minp(~*~)

1, @1 is the default

3

=A1.minp@a(~*~)

[1,1]

4

=A1.minp@z(~*~)

1

5

=A1.minp@az(~*~)

[1,1]

6

=demo.query("select EID,NAME,BIRTHDAY from EMPLOYEE")

 

7

=A6.minp(BIRTHDAY)

Related functions:

A.pmin()

A.maxp()

minute()[931][932]

Description:

Get the minute from a datetime value.

Syntax:

minute(datetimeExp)

Note:

The function gets the minute from the specified datetime value datetimeExp.

Parameters:

datetimeExp

An expression whose result is a date or a datetime value of standard format

Return value:

An integer

Example:

minute(datetime("19800227","yyyyMMdd"))

0

minute("1972-11-08 10:20:30")

20

minute(datetime("2006-01-15 13:20:30"))

20

Related functions:

year()

month()

day()       

hour()

second()

millisecond()

modify()[933][934]

Here’s how to use modify() function.

r.modify(xi:Fi,…)[935][936]

Description:

Modify the field values of a record.

Syntax:

r.modify(xi:Fi,…)

Note:

The function modifies the field values in record r, the status of r will be changed to 1(modify) after being modified. Automatically update the index, if any, and check distinctness.

Parameters:

r

The record to be modified

xi

Modification expression

Fi

Name of the field to be modified. The ith field in r will be modified if Fi isn’t supplied.

r'

The new record that will replace record r

Options:

@r(r')

Replace record r with record r' according to the former’s order

@f(r')

Modify a certain field value of record r with record r'

Return value:

The modified record r

Example:

 

A

 

1

=[[1,"Lucy",29]].new(~(1):ID,~(2):Name,~(3):Age)

2

=A1(1).modify(2,"Petter")

Modify the first and the second field

3

=A2.modify(30:Age)

Modify Age field

4

=A3.modify(3,33:Age)

Modify the first field and Age field

5

=[[4,"Lily",23]].new(~(1):SID,~(2):SName,~(3):SAge)

6

=A4.modify@r(A5(1))

 Fill members of A5(1) in A4 according to A4’s order

7

=A6.modify@f(([["ella"]].new(~(1):Name))(1))

 Modify only the value of Name field in A6

Related functions:

T.modify()

T.insert()

T.delete()

T.modify()[937][938]

Description:

Modify field values in a table sequence.

Syntax:

T.modify(k,xi:Fi,…)

Modify the kth record, which is equal to T(k).modify(xi:Fi,…)

T.modify(k:A,xi:Fi,…)

Modify the records from the kth record to the (k+|A|-1)th record

Note:

The function modifies one or more records at the specified position(s). The status of the records which have been modified will be changed to 1. Automatically update the index, if any, and check distinctness.

Parameters:

k

The position at which the record will be modified. If k exceeds the limit, then append a new record in the end.

xi

The value of Fi field to be modified

Fi

Name of the field of the record which will be modified. If Fi is omitted, then modify the ith field of T.

T

A table sequence

A

A sequence or an integer; If A is an integer, then it is equal to to(A)

Options:

@n

Return the newly-modified records or record sequences

@r(k:A)

Modify table sequence T using squence A from the kth record according to the order of the fields

@f(k:A)

Modify table sequence T using squence A from the kth record; only the common fields are modified.

Return value:

The modified table sequence T

Example:

 

A

 

1

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

2

=A1.modify(1,"Sales",5)

3

=A1.modify(2,6:MANAGER)

4

=A1.modify@n(2:1,"AAA":DEPT,76:MANAGER)

Return the modified second record

5

=create(DeptName,ManagerID)

6

=A5.modify(1:A1,DEPT:DeptName,MANAGER:ManagerID)

7

=A1.delete(A1.select(MANAGER>5))

 

8

=A5.modify@r(1:A7)

Modify A5 using A7 from the first record

9

=create(DeptName,MANAGER)

 

10

=A9.modify@f(1:A7)

Modify MANAGER field only

Related functions:

r.modify()

T.insert()

T.delete()

A.modify()

A.modify()[939][940]

Description:

Assign value(s) to one or more members of a sequence according to the specified position(s).

Syntax:

A.modify(k,x)

Assign x to the kth member of sequence A

A.modify(k,X)

Assign members of X to members of A in order from the kth position to the (k+|X|-1)th position

Note:

The function assigns x to the kth member of sequence A or members of X to the members of A from the kth position to the number (k+|X|-1)th position in order. Automatically update the index, if any, and check distinctness.

Parameters:

A

A sequence

k

A member position; If k is greater than the length of sequence A, then append the member in the end

x

A member value

X

A sequence

Options:

@n

Return the modified record or a record sequence of modified records

Return value:

A sequence

Example:

 

A

 

1

=["a","c","d","e","f"]

 

2

=A1. modify(2,"g")

[a,g,d,e,f]

3

=A1.modify(6,[2,4,5])

[a,g,d,e,f,2,4,5]; append the values at the end as the specified position execeeds the limit

4

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

 

5

=A4.modify@n(2:3,ID+10:ID)

Return a record sequence of modified records

Related functions:

A.delete()

A.insert()

T.modify()

mongo_close ()[941][942]

Description:
    
Close conncetion to MongoDB database.

Syntax:
     mongo_close(fd)

Note:

The function closes conncetion to MongoDB database.

Parameters:

fd

MongoDB connection object

Example:

 

A

 

1

=mongo_open("mongodb://localhost:27017/mydb")

Connect to a MongoDB

2

=mongo_close(A1)

Close the connection

mongo_insert()[943][944]

Description:

Insert data to a MongoDB database.

Syntax:

mongo_insert(fd,collection,T)

mongo_insert(fd,collection,cs)

Note:

The function inserts data of a table sequence or a cursor to a MongoDB database.

Parameters:

fd

A MongoDB database object to be connected

collection

A MongoDB collection

T

A table sequence

cs

A cursor

Return value:

Boolean value

Example:

 

A

 

1

=mongo_open("mongodb://127.0.0.1:27017/mydb")

Connect to mydb database in Mongo server with IP: 127.0.0.1 and port 27017 and without a user name and a password

2

=demo.cursor("select NAME,GENDER,BIRTHDAY,DEPT,SALARY from employee  where DEPT = 'R&D' ")

Query data in a table and return it as a cursor

3

=mongo_open("mongodb://127.0.0.1:27017/user0")

Query data in a table and return it as a table sequence

4

=mongo_insert(A1,"emp",A2)

Insert data in A2’s cursor to mongodb’s emp collection

5

=mongo_insert(A1,"emp",A3)

Insert data in A3’s table sequence to mongodb’s emp collection

6

=mongo_shell(A1,"emp.find()").fetch()

Get data from emp collection

7

=mongo_close(A1)

Close MongoDB connection

mongo_open()[945][946]

Description:
  
Connect to the MongoDB server.

Syntax:
     
mongo_open(url)

Note:

The function establishes a connection to the MongoDB server. If parameter username is absent, parameter password can be omitted.

Parameters:

url  

mongodb://[username:password@]host1[:port1]       [,host2[:port2],...[,hostN[:portN]]]/database[?options]

usernamepassword

Username and password; can be omited

host

The host name or IP of to-be-connected MongoDB server; at least one value needs to be specified; to connect a replica set, specifiy multiple host machine IPs

port

Port number

database

Database name

options

MongoDB connection in standard format; can bet omitted

Return value:
MongoDB connection object

Example:

 

A

 

1

=mongo_open("mongodb://root:sa@localhost:27017/col")

With username root, password sa, host name localhost, and port number 27017, connect to database col on MongoDB server

2

=mongo_open("mongodb://127.0.0.1:27017/mydb")

With IP: 127.0.0.1 and port number 27017, connect to database mydb on MongoDB server; no username and password

3

=mongo_open("mongodb://127.0.0.1/mydb?safe=true; wtimeoutMS=2000")

Conncet to database mydb on MongoDB server via IP: 127.0.0.1 in the safe mode; no port number; timeout value is 2 seconds

mongo_shell()[947][948]

Description:
  
Query the databsase and return the query result.

Syntax:
   mongo_shell(fd,s)

Note:

The function executes aMongoDB shell command s and returns the result. So far functions supported by s are find, count, distinct and aggregate.
Options:

@x

Close the MongoDB connection automatically closes when the execution finishes; if the returned result is a cursor, disconnect from the database as the cursor closes.

Parameters:

fd

MongoDB connection object

s      

An MongoDB function, which supports find, count, distinct and aggregate and follows the MongoDB syntax

Return value:
       
A sequence/table sequence/cursor

Example:

 

A

 

1

=mongo_open("mongodb://localhost:27017/mydb")

Conncet to database mydb on MongoDB server

2

=mongo_shell(A1,"emp.find()").fetch()

Query records of the emp set in database mydb

3

=mongo_shell(A1,"emp.find({GENDER:\"F\"})")

Query records where GENDER is F and return result as a cursor

4

=A3.fetch()

5

=mongo_shell@x(A1,"emp.count()")

Use @x option to query the number of records, and close the connection after result is returned

6

=mongo_open("mongodb://localhost:27017/mydb")

Connect to the MongoDB database

7

=mongo_shell(A6,"emp.aggregate([{$group : {_id : \"$GENDER\", number : {$sum : 1}}}])")

Count records by gender

8

=mongo_shell(A6,"emp.distinct(DEPT)")

Query DEPT in the emp set to remove duplicate values

9

=mongo_close(A6)

Close the database connection

 

month()[949][950]

Description:

Get the month from a specified date/datetime value.

Syntax:

month(dateExp)

Note:

The function gets the month from the date dateExp.

Parameters:

dateExp

An expression whose result is a date or a datetime value of standard format.

Options:

@y

Return a 6-digit number if there is a year part in the parameter

Return value:

An integer

Example:

month(datetime("19800227","yyyyMMdd"))

2

month("1972-11-08 10:20:30")

11

month(datetime("2006-01-15 13:20:30"))

1

month@y("1972-11-08 10:20:30")

197211

Related functions:

year()

day()       

hour()

minute()

second()

millisecond()

movefile()[951][952]

Here’s how to use movefile() function.

movefile(fn,path)[953][954]

Description:

Move, delete, or rename a file.

Syntax:

movefile(fn,path)

Note:

The function moves file fn to a file specified by parameter path. Delete file fn if path is absent; rename the file if only the file name is specified in the path.

Parameters:

fn

A file

path

The path (with file name) along which the file is moved, or a file name

Options:

@y

Force an execution of the function if the target file already exists. Without the option you can’t force an execution. Delete the target file if parameter path is absent.

@c

Copy the file. If the target file name is the same as that of the specified file to which it will be moved, the copy fails.

Return value:  

Boolean value

Example:

 

A

 

1

=movefile(file("E://test.property"),"D://testfile.property")

Move the file to testfile.property file under root directory on driver D

2

=movefile(file("D://testfile.property"),"file.property")

D://testfile.property is renamed file.property

3

=movefile(file("D://file.property"))

Delete file.property

4

=movefile@y(file("E://test1.property"),"D://testfile1.property")

The file testfile1.property already exists. Force the move and override the original file

5

=movefile@c(file("D://testfile1.property"),"file.property")

Copy the file, instead of renaming it

6

=movefile@cy(file("E://test2.property"),"D:// file.property")

file.property already exists. Force the copy and override the original file

7

=movefile@y(file("D://testfile1.property"))

Delete testfile1.property

Related functions:

f. exists()

f. date()

f. size()

n.f(x)[955][956]

Description:

Perform a loop operation by declaring an integer loop variable.

Note:

The function performs a loop operation with integer n as the loop variable.

n.(x)

Equivalent to to(n).(x)

n.f(x)

Equivalent to to(n),f(x)

Parameters:

n

An integer

x

An expression

f

The function name

Example:

Ø  n.(x)

 

A

 

1

=3.(~*2)

[2,4,6]

Ø  n.f(x)

 

A

 

1

=3.sum(~*2)

12

name()[957][958]

Here’s how to use name() function.

f.name()[959][960]

Description:

Return a file’s path relative to the main directory.

Syntax:

f.name()

Note:

The function returns file f’s path relative to the main directory; return the full path if f isn’t in the main directory.

Parameters:

f

A file

Options:

   @p   Return a full path

Return value:

String

Example:

 

A

 

1

=file("G:/Program files/raqsoft/esProc/demo/data/data.txt").name()

Return the path which is relative to the main directory because the file is under the main directory: G:/Program files/raqsoft/esProc/demo

2

=file("E:/Program files/raqsoft/esProc/data/data.txt").name()

Return the full path when the file isn’t in the main directory

3

=file("employee1.txt").name@p()

Return the full path since employee1.txt is in the main directory

 

new()[961][962]

Here’s how to use new() function.

A.new(xi:Fi,…)[963][964]

Description:

Generate a new table sequence/record sequence, whose field values are computed from the field values of a table sequence/record sequence.

Syntax:

A.new(xi:Fi,…)

Note:

The function generates a new table sequence/record sequence with the same length as table sequence/record sequence A, the field names and values of which are respectively Fi and xi. When parameter xi is #i, it represents the ith field and the original field name will be used.

Parameters:

Fi

Field name. If omitting it, then use the identifier parsed from the xi.

xi

Expression whose result is the field value. If omitted, field values will be null and :Fi must not be omitted at the same time. The sign # is used to represent a field with a sequence number.

A

Table sequence/record sequence.

Options:

@m

Use parallel algorithm to handle data-intensive or computation-intensive tasks; no definite order for the records in the result set.

@i

Won’t generate a record if the result of expression xi is null.

Return value:

The new table sequence.

Example:

Ø  Generate from an individual table sequence

 

A

 

1

=demo.query("select EID,NAME,DEPT,BIRTHDAY from EMPLOYEE")

2

=A1.new(EID:EmployeeID,NAME, #3:dept)

3

=A1.new(NAME,age(BIRTHDAY):AGE)

Generate the new table sequence by computing new field values.

4

=A1.new@m(NAME,age(BIRTHDAY):AGE)

Use @m option to increase performance of big data handling.

5

=file("D:\\txt_files\\data1.txt").import@t()

Below is the file data1.txt:

6

=A5.new@i(CLASS,STUDENTID,SUBJECT,SCORE:score)

If the SCORE value is null, the corresponding record won’t be generated

Ø  Generate from multiple table sequences of the same order

 

A

 

1

=create(Name,Chinese).record(["Jack",99,"Lucy",90])

2

=create(Name,Math).record(["Jack",89,"Lucy",96])

3

=A1.new(Name:Name,Chinese:Chinese,A2(#).Math:Math)

 

Related functions:

cs.new()

ch.new()[965][966]

Description:

Return the channel with newly-computed field values for its records.

Syntax:

ch.new(xi:Fi,…)

Note:

The function computes expression xi over each of the records in channel ch, names the new fields Fi, and returns the original ch consisting of Fi fields. This is an attached computation.

Parameters:

ch

Channel

xi

An expression, whose values are used as new field values. It is treated as null if omitted; in that case, parameter : Fi can’t be omitted. The sign # is used to represent a field with a sequence number

Fi

Field name in the given channel; use the identifiers parsed from expression xi if it is omitted

Options:

@i

Won’t generate the corresponding record when the result of computing expression xi is null

Return value:

        The original channel with new field values

Example:

 

A

 

1

=demo.cursor("select * from SCORES")

Create a cursor

2

=file("D:\\txt_files\\data1.txt").import@t()

Below is data1.txt:

3

=channel()

Create a channel

4

=channel()

Create a channel

5

=A3.new(CLASS,#2:ID,SCORE+5:newScores)

Change the structure of A2’s channel into CLASS, ID and newScores, among which the newScores values are computed from the original SCORE values according to an expression

6

=A3.fetch()

Fetch and store the existing data in the channel

7

=A4.new@i(CLASS,STUDENTID,SUBJECT,SCORE:score)

Won’t generate the corresponding record if the result of computing a SCORE value is null

8

=A4.fetch()

 

9

=A1.push(A3)

Be ready to push data in A1’s cursor into A3’s channel, but the action needs to wait

10

=A2.push(A4)

Push data in A2’s sequence into A4’s channel

11

=A1.fetch()

Data in A1’s cursor is pushed into the channel and operations are performed as the fetch() operation is performed over A1

12

=A3.result()

13

=A4.result()

cs.new()[967][968]

Description:

Return a cursor with newly-computed field values for its records.

Syntax:

cs.new(xi:Fi,…)

Note:

The function computes expression xi against each record in cursor cs, names the newly-computed Fi fields, and returns the original cursor containing Fi fields.

Parameters:

cs

Cursor

xi

An expression, whose values are uses as the new field values. It is treated as null if omitted; in that case, : Fi can’t be omitted. The sign # is used to represent a field with a sequence number

Fi

Field name of cs; use the identifiers parsed from expression xi if it is omitted

Options:

@i

Won’t generate a record if the result of expression xi is null

Return value:

        The original cursor with new field values

Example:

 

A

 

1

=connect("demo").cursor("select * from SCORES where SCORES<60")

 

2

=A1.new(#2:ID, CLASS, SCORE+5:newScores)

Generate a new cursor composed of ID, CLASS, and newScores by performing expression evaluation on the existing SCORE field

3

=A2.fetch()

4

=file("D:\\txt_files\\1.txt").cursor@t()

Below is the file data1.txt:

5

=A4.new@i(CLASS,STUDENTID,SUBJECT,SCORE:score)

If the SCORE value is null, the corresponding record won’t be generated

6

=A5.fetch()

T.new(A/cs,x:C,…;wi,...)[969][970]

Description:

Retrieve non-key fields from a composite table according to key values of a table sequence/record sequence or a cursor and return a table sequence or a cursor.

Syntax:

T.new(A/cs,x:C,…;wi,…)

Note:

The function retrieves non-key fields from composite table T according to key values of table sequence/record sequence A or cursor cs; parameter A/cs is ordered by their key.

Parameters:

T

A composite table

A/cs

A table sequence/cursor

x

Field values

C

Column alias

wi

Filtering condition; separate multiple conditions, which should be met at the same time, by comma(s)

Return value:

A table sequence/cursor

Example:

 

A

 

1

=file("D:\\emp10.ctx")

 

2

=A1.create()

Open a composite table

3

=demo.query("select  EID from EMPLOYEE")

 

4

=A2.new(A3,NAME,GENDER)

Retrieve non-key fields from A2’s composite table accroding to the key values of A3’s table sequence

5

=demo.query("select  EID from EMPLOYEE").cursor()

 

6

=A2.new(A5,NAME:NAME,GENDER:GENDER).fetch()

Retrieve non-key fields from A2’s composite table accroding to the key values of A5’s cursor

7

=file("D:/employees.ctx").create()

Open a composite table

8

=demo.query("select EID from employee where EID<10 ").keys(EID)

Return a table sequence

9

=A7.new(A8,EID,Gender,Dept;Gender=="F",Dept=="Sales")

Retrieve Gender field and Dept field from A7’s composite table by the key EID; filtering condition is Gender=="F" & Dept=="Sales"

T.new(A/cs,x:C,…;wi,...)[971][972]

Description:

Retrieve non-key fields from a cluster composite table according to key values of a table sequence/record sequence or a cursor and return a table sequence or a cluster multcursor.

Syntax:

T.new(A/cs,x:C,…;wi,…)

Note:

The function retrieves non-key fields from cluster composite table T according to key values of table sequence/record sequence A or cursor cs; parameter A/cs is ordered by their key.

Parameters:

T

A composite table

A/cs

A table sequence/cursor

x

Field values

C

Column alias

wi

Filtering condition; separate multiple conditions, which should be met at the same time, by comma(s)

Return value:

A table sequence/cursor

Example:

 

A

 

1

=file@0("emp10.ctx",["192.168.0.118:8281"])

 

2

=A1.create()

Open a composite table

3

=demo.query("select  EID from EMPLOYEE")

 

4

=A2.new(A3,NAME,GENDER)

Retrieve non-key fields from A2’s cluster composite table accroding to the key values of A3’s table sequence

5

=demo.query("select  EID from EMPLOYEE").cursor()

 

6

=A2.new(A5,NAME:NAME,GENDER:GENDER).fetch()

Retrieve non-key fields from A2’s cluster composite table accroding to the key values of A5’s cursor

news()[973][974]

Here’s how to use news() function.

A.news(X;xi:Fi,…)[975][976]

Description:

Compute field values based on a table sequence/record sequence, and concatenate them to generate a new one. 

Syntax:

A.news(X;xi:Fi,…)

Note:

The function computes field values based on record sequence X, concatenates the newly-computed fields to create a new table sequence/record sequence where parameter xi is field value of each record and Fi is the field name, which will be automatically identified according to parameter xi if Fi is omitted. When parameter xi is #i, it represents the ith field and the original field name will be used.

Parameters:

A

A table sequence/record sequence

X

A record sequence/integer; equivalent to to(X) if it is an integer, meaning the frequency of inserting each record in A

xi

Expression, whose results will be field values; the sign ~ used in the parameter references data from record sequence X instead of A. The sign # is used to represent a field with a sequence number

Fi

Field name of the new table sequence/record sequence; when omitted, it will be automatically identified

Return value:

A new table sequence/record sequecne

Example:

 

A

 

1

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

 

2

=A1.group(GENDER;~:group,~.avg(SALARY):avg)

Perform group by GENDER

3

=A2.news(group;EID,NAME,GENDER, #3:surname, age(~.BIRTHDAY):age,SALARY+50: salary,A2.avg:AvgSalary)

A2 is composed of data groups; based on each group field values are computed and a table sequence is generated; and then table sequences are concatenated into a new one.

4

=A1.news(2;EID,NAME,GENDER,STATE,age(A1.BIRTHDAY):AGE)

Generate a new table sequence by inserting each record twice

5

=A1.group(DEPT).(~.group(GENDER))

 

Group records first by DEPT then by GENDER

6

=A5.news(~;A5.~.DEPT:DEPT,A5.~.~.GENDER:GENDER,A5.~.~.avg(SALARY):AvgSalary)

1559034619(1)

Get DEPT values and GENDER values from A5 to show the average salaries of different GENDERs in every DEPT

Related functions:

cs.new()

ch.news()[977][978]

Description:

Get new values for the fields of records in a channel and update them into the channel.

Syntax:

ch.news(X;xi:Fi,…)

Note:

With channel ch, the function computes values of fields in record sequence X and updates the new field values into the channel. Fi is the new field name that will be automatically identified if the parameter is omitted; xi represents the new field values. This is an attached computation.

Parameters:

ch

Channel

X

Record sequence

xi

Expression, whose results will be field values; the sign ~ used in the parameter references data from X instead of A. The sign # is used to represent a field with a sequence number

Fi

Field name in the given channel; will be automatically identified if the parameter is omitted

Return value:

The original channel with new fields

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE")

 

2

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

 

3

=channel()

Create a channel

4

=A2.group(GENDER;~:group)

Group records by GENDER

5

=A1.groupx(GENDER;avg(SALARY):avg)

Group records by GENDER

6

=A5.join(GENDER,A4:GENDER,group)

 

7

=A3.news(group;EID,NAME,GENDER,#3:surname, age(~.BIRTHDAY):age,SALARY+50: salary,avg:AvgSalary)

A6 is one of the groups; compute field values based on each group and concatenate the results into A3’s channel

8

=A3.fetch()

Fetch and store the existing data in the channel

9

=A6.push(A3)

Be ready to push data in A6’s cursor into A3’s channel, but the action needs to wait

10

=A6.fetch()

Data in A6’s cursor is pushed into the channel and operations are performed as the fetch() operation is performed over A6

11

=A3.result()

cs.news()[979][980]

Description:

Compute new cursor field values to update them into the original cursor.

Syntax:

cs.news(X;xi:Fi,…)

Note:

The function computes field values based on cursor cs, updates the newly-computed fields into the original cursor where xi is field value of each record and Fi is the new field name, which will be automatically identified if Fi is omitted.

Parameters:

cs

Cursor

X

Record sequence

xi

An expression, whose values are uses as the new field values. It is treated as null if omitted; in that case, : Fi can’t be omitted. The sign # is used to represent a field with a sequence number

Fi

Filed name of the new cs; use the identifiers parsed from expression xi if it is omitted

Return value:

The original cursor with the new field values

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE")

 

2

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

 

3

=A2.group(GENDER;~:group)

Perform group by GENDER

4

=A1.groupx(GENDER;avg(SALARY):avg)

Perform group by GENDER

5

=A4.join(GENDER,A3:GENDER,group)

 

6

=A5.news(group;EID,NAME,GENDER,#3:surname, age(~.BIRTHDAY):age,SALARY+50: salary,avg:AvgSalary)

A4 is composed of data groups; based on each group field values are computed and a cursor is generated; and then cursors are concatenated into a new one.

7

=A6.fetch()

 

Related functions:

A.news(X;xi:Fi,…)

T.news(A/cs,x:C,…;wi,...)[981][982]

Description:

Retrieve fields from a table sequence or a cursor according to key values to form a new table sequence.

Syntax:

T.news(A/cs,x:C,…;wi,...)

Note:

The function retrieves fields from table sequence A or cursor cs according to key values to form a new table sequence. It can perform a one-to-many association between a table sequence/cursor and a composite table and return a result set consisting of composite table T’s records pointing to the table sequence/cursor.

Parameters:

T

A composite table

A/cs

A table sequence/cursor/composite table cursor

x

Field value

C

Column alias

wi

Filtering condition; multiple conditions are separated by comma(s) and they must be met at the same time

Return value:

A table sequence

Example:

 

A

 

1

=file("score.ctx").create()

Open a composite table file

2

=demo.query("select * from students").keys(ID)

Return a table sequence with ID as the key

3

=A1.news(A2,STUDENTID,SUBJECT,SCORE;SUBJECT=="Math",SCORE>70)

Join A1’s composite table and A2’s table sequence where the filteing condition is SUBJECT=Math & SCORE>70 and return eligible records in the composite table

 

next{a}[983][984]

Description:

Skip the current loop and continue with the next loop.

Syntax:

next{a}

Note:

next is used to skip the remaining code block in the current loop and execute the next loop as long as the cycling does not finish.

Parameters:

a

The master cell of the loop code block. If the master cell a is omitted, then it is the current loop that is running.

Example:

 

A

B

C

D

 

1

=[]

 

 

 

[1,1,3,3]

2

for 5

 

 

 

In this example, the next A2 and the break A2 are to control loop of the A2 level. The computation of A1 is the sequence [1, 1, 3, 3]

 

3

 

for 2

 

 

4

 

 

if A2==2

next A2

5

 

 

if A2==4

break A2

6

 

 

>A1=A1|[A2]

 

7

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

 

8

=create(ID,Dept)

 

9

for A7

 

 

 

Extract records whose DEPT values are not "Sales" from the EMPLOYEE table

10

 

if A9. DEPT=="Sales"

 

11

 

 

Next

 

12

 

>A8.insert(0,A9.EID: ID,A9. DEPT:Dept)

A8 returns the result

Note:

1.       By comparison, the break is to jump out of the cycling directly, while next is to ignore the remaining code block in the current loop, and proceeds to the next loop as long as the cycling does not finish.

2.       If a is omitted, then the current loop will be under control. To control the loop at higher level, a is required.

nodes()[985][986]

Here’s how to use nodes() function.

P.nodes()[987][988]

Description:

Find the children nodes of a specified record.

Syntax:

P.nodes(F,r,n)

Note:

The functions performs recursive query on field F of record sequence P referred by the foreign key until the value of field F is equal to r, and returns the children nodes of the record r. If the specified record r can’t be found, the function will return NULL. n is the maximum recursion depth, its default value is 1,000.

Parameters:

P

A record sequence

F

Field name

r

A record

n

A number

Options:

@d

Make the function return leaf-level nodes

@p

Make the function return paths connecting children nodes and their leaf-level nodes

Return value:

A sequence

Example:

 

A

 

1

=file("D://emp.txt").import@t().keys(empid)

 

2

>A1.switch(mgrid,A1:empid)

 

3

=A1.nodes(mgrid,A1.select@1(name=="Diana"),5)

According to mgrid field, the foreign key references, search for all records of Diana’s subordinates and those of the subordinates of Diana’s subordinates

4

=A1.nodes@d(mgrid,A1.select@1(name=="Diana"),5)

Search for the records of Diana’s subordinates who are not an executive

5

=A1.nodes@p(mgrid,A1.select@1(name=="Diana"),5)

 

Display a relationship structure with Diana as the root, from which you see that Diana is the superior of empid=7, who is the superior of empid=14

not()[989][990]

Description:

On integers, perform bitwise NOT operation to get the logical negation on each bit.

Syntax:

not(x)

Note:

The function performs bitwise NOT operation to get the logical negation on each bit of an integer.

Parameters:

x

The numeric expression for which you want to find the logical negation on each bit

Return value:

An integer

Example:

not(6)

-7

now()[991][992]

Description:

Get the current system datetime.

Syntax:

now()

Note:

The function gets the current system datetime accurate to the millisecond.

Options:

@d

Return the date part only, date type

@t

Return the time part only, time type

@m

Acurrate to minute

@s

Accurate to second

Return value:

Datetime

Example:

now()

The current system datetime, for example: 2010-07-15 16:10:40

now@d()

The current system date, for example:2010-07-15

now@t()

The current system time, for example:16: 10: 40

now@m()

The current system datetime, for example:2013-12-09 17:05:00:0

now@s()

Current system datetime, for example:2013-12-09 17:05:33:0

null[993][994]

Description:

Null value

Syntax:

null

Usually the value of an empty cell is null.

Note:

It can be used directly in a constant cell or expression.

Example:

 

A

B

 

1

=null

 

Assign a null value to A1

2

=A1==null

 

Judge if A1 is null

3

if A2==true

>a=4

If it is null, assign 4 to a

4

else

>a=3

Otherwise, assign 3 to a

Related functions:

true

false

number()[995][996]

Description:

Convert a string to a number.

Syntax:

number (stringExp,format

Note:

The function parses string stringExp as a numeric value in the format of fmt.The value of stringExp must be a numeric string.

Parameters:

stringExp

A string expression, the result of which is a numeric value

format

A format string;can be absent

Return value:

32-bit integer, 64-bit integer, or 64-bit floating-point number

Example:

number("123")

123

number("123f")

123.0

number("123.45")

123.45

number("123.456d")

123.456

number("$1,100.05","$#,###.##")

1100.05

Related functions:

float()

int()

long()

decimal()

string()

nvl()[997][998]

Description:

Get the first non-null member that isn’t double quoted from an integer sequence.

Syntax:

A.nvl()

Equivalent to nvl(x1,…,xn)

Note:

The function gets the first non-null member that isn’t double quoted from integer sequence A.

Parameters:

A

An integer sequence

Return value:

A non-null an non-double-quoted member

Example:

 

A

 

1

=[1,2,4].nvl()

1

2

=[null,2,3,4].nvl()

2

3

=["",2,3,4].nvl()

2

olap_close()[999][1000]

Description:

Close connection to a multidimensional database.

Syntax:

olap_close(conn)

Note:

This external library function closes the connection to a multidimensional database.

Parameters:

conn

Database connection string

Example:

 

A

 

1

=olap_open("http://192.168.0.178:8088/msmdpump.dll","CubeTest","Administrator","admin")

 

2

>olap_close(A1)

Close connection to the multidimensional database

Related functions:

olap_open()

olap_query()

olap_open()[1001][1002]

Description:

Establish connection to multidimensional database.

Syntax:

olap_open(url, catalog, user, pwd)

Note:

An external library function. Whether or not the username and password are required depends on how the privilege levels are set up for the given server.

Parameters:

url

Address of the server on which a multidimensional database runs

catalog

The multidimensional database name

user

User name for accessing a multidimensional database

pwd

Password for accessing a multidimensional database

Return value:

Return the connection object

Example:

 

A

 

1

=olap_open("http://192.168.0.178:8088/msmdpump.dll","CubeTest","Administrator","admin")

Connect to the multidimensional database named CubeTest

2

=olap_open("http://192.168.0.178:8088/msmdpump.dll","Analysis Services Tutorial")

Connect to the multidimensional database named Analysis Services Tutorial

Related functions:

olap_close()

olap_query()

olap_query()[1003][1004]

Description:

Query data in a multidimensional database and return the result.

Syntax:

olap_query(conn,mdx)

Note:

This external library function queries data from a multidimensional database and returns the result.

Options:

@c

Return a cursor

Parameters:

conn

The connection object

mdx

A multidimensional database query that allows one or two axes

Return value:

A table sequence or a cursor

Example:

 

A

 

1

=olap_open("http://192.168.0.178:8088/msmdpump.dll","CubeTest","Administrator","admin")

Connect to the multidimensional database named CubeTest

2

=olap_query(A1," select {[Measures].[OrderAmount]} on columns from [DataSourceMulti]")

Find out total sales amount

3

=olap_query@c(A1," with member [Measures].[AnnualInterestRate] as

'[Measures].[SalesAmount]/[Measures].[StandardCost]-1'

select{[Measures].[SalesAmount],[Measures].[StandardCost],[Measures].[ AnnualInterestRate]} on columns,

{[Order Date].[Calendar Year].[Calendar Year]} on rows

from [DataSourceMulti]")

Find out each year’s sales amount and standard cost and calculate the annual interest rate, and return result as a cursor

4

=A4.fetch(5)

 

5

>olap_close(A1)

Close connection to the dimensional database

Related functions:

olap_close()

olap_open()

or()[1005][1006]

Description:

Perform bitwise OR operation on integers.

Syntax:

or(xi,…)

or(A)

Note:

Bitwise OR operation on integers.

Parameters:

A

A sequence

xi

A numeric expression based on which you perform the bitwise OR operation

Retrun value:

An integer

Example:

or(3,5)

7

output()[1007][1008]

Description:

Output data to console.

Syntax:

output(x,...)

Note:

The function exports one or more variables separated with the comma; the data printed out from console is separated with the tab. If parameter x is a table sequence, the function can only export 10 rows at most; to export all rows, use A.export() function first to convert the table sequence into strings and then output the data with this function.

Parameters:

x,…

Export parameters separated with the comma.

Options:

@t

Output data as well as the current time which will be placed before the printout data.

Example:

 

A

 

1

=to(4)

 

2

=output(A1)

Output “[1,2,3,4]

3

=output@t(A1)

Output “2013-05-02 11:51:59        [1,2,3,4]

4

=demo.query("select * from employee").export()

 

5

=output(A4)

Output all rows in the table sequence

p()[1009][1010]

Here’s how to use p() function.

A.p()[1011][1012]

Description:

Get sequence numbers of the members at specified positions.

Syntax:

A.p(i)

-n<=i<=n; 1<=i<=n indicates getting the sequence number of the ith member; -n<=i<=-1 indicates getting the sequence number of the ith member backwards.

A.p(P)

P is the n-integer sequence whose length is m. Its members should be greater than -n and less than n, but they should not be equal to 0.

Note:

A is a sequence whose length is n, from which you get sequence numbers of the members at specified positions. The function is generally used to get the sequence numbers of the members reversely.

Parameters:

A

A sequence object whose length is n

i

An integer

P

An n-integer sequence whose length is m

Options:

@r

Turn back if the specified position exceeds the boundary of A, that is, to set i=if(i%n==0,n,i%n), where n is the length of A.

@0

The member represented by a sequence number that exceeds the boundary of A will be excluded from the result of A.p(P).

Return value:

An integer or an integer sequence composed of sequence numbers of members at specified positions in a sequence

Example:

 

A

 

1

[a,b,c,d,e,f,g,h,i,j]

 

2

=A1.p(2)

2

3

=A1.p(-2)

9

4

=A1.p([2,3])

[2,3]

5

=A1.p([-2,-3])

[9,8]

6

=A1.p@0([5,12])

[5]

7

=A1.p@r([5,12])

[5,2]

Related functions:

A.m()

pad()[1013][1014]

Here’s how to use pad() function.

pad()[1015][1016]

Description:

Pad a string to the specified length with another string added on the left.

Syntax:

pad(s,c,l)

Note:

The function pads string s to a new length of l by continuously adding characters of string c to the left side.

Parameters:

s

A string expression

c

A string expression

l

A number or an xpression whose result is the numeric value

Options:

@r

Pad to the right side of a string, to a new length

Return value:

String

Example:

 

A

 

1

=pad("Soth","Miss",10)

The return value is" MissMiSoth "

2

=pad@r("Soth","er",8)

The return value is" Sotherer "

A.pad()[1017][1018]

Description:

Add members of a sequence to another one until the latter reaches certain length.

Syntax:

A.pad(x,n)

Note:

The function adds members of sequence x sequentially and continuously to sequence A until the length of A reaches n. If n is less than A’s length, the function will return A itself.

Parameters:

A

A sequence

x

A single value or a sequence; with a sequence, add its members sequentially to sequence A

n

An integer

Options:

@l

Add members before the existing members of sequence A; by default the additions will be placed at its end.

@m

If the length of sequence A is the multiple of n, do not perform the adding action. If the length of A isn’t the multiple of n, add members to A until its length is the multiple of n; the number of additions – which are members of sequence x – need to be added after the existing members can be calculated with the formula – m=n-A.len()%n.

Return value:

Sequence

Example:

 

A

 

1

[a,b,c,d,e,f]

 

2

=A1.pad(["q",2],2)

["a","b","c","d","e", "f"]

3

=A1.pad("j",9)

["a","b","c","d","e", "f","j","j","j"]

4

=A1.pad@m("j",7)

["a","b","c","d","e", "f","j"]

5

=A1.pad@m("j",3)

["a","b","c","d","e", "f"]

6

=A1.pad@l(["q",2],11)

["q",2, "q",2, "q","a","b","c","d","e", "f"]

parse()[1019][1020]

Description:

Parse a string into the corresponding data type.

Syntax:

parse(s)

Note:

This function analyzes string s and parses it into corresponding data type.

Parameters:

s

String

Options:

@e

Remove quotes of the string before starting an escape sequence including the escape character and unicode. By default the string will not be escaped.

@n

Retrieve a substring with enough length starting from the left side and parse it, while ignoring the non-numeric rest. Note that the string needs to begin with the numeric value.

@q

If a string starts with the squotation marks, parse it until the next quotation marks appear and leave the rest of the string alone, and return a string.

Return value:

Data of different data types

Example:

 

A

 

1

="10:20:30"

 

2

=parse(A1)

10:20:30. The string is parsed into time data type

3

\u4e2d\u56fd

 

4

a\tb

 

5

=parse@e(A3)

中国. The string is automatically parsed into the corresponding Unicode characters

6

=parse@e(A4)

a      b. Escape characters are handled automatically

7

=parse@n("12sadsdxc23")

12. Retrieve and parse the first numeric value

8

=parse@q("\'sadsdxc\'+23")

'sadsdxc' ; the string begins with quotation marks and the parsing stops at the next quotation marks

paste()[1021][1022]

Here’s how to use paste() function.

T.paste()[1023][1024]

Description:

Loop through the records of a sequence to modify the specified field of a table sequence in order.

Syntax:

T.paste(Ai:Fi,…;k)

Note:

The function loops through the records of sequence Ai to modify the values of Fi field of table sequence T from the kth record. The modification will stop once the the number of records that have been modified reaches this result number.

Parameters:

T

A table sequence

Ai

A table sequence/record sequence/sequence, whose records/members will be values of Fi field

Fi

The field to be modified; when it isn’t supplied, modify the ith field of T

k

The position the modification starts. The default is 0, in which case records or members will be appended at the end.

Options:

@i

Loop through the records of sequence Ai to insert them to Fi field of table sequence T before the kth record.

Return value:

A table sequence

Example:

 

A

 

1

=demo.query("select * from DEPARTMENT").keys(DEPT)

 

2

=A1.modify(1,"Sales",5)

 

3

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

 

4

=A3.paste(A1:DEPT,[20,10,20]:MANAGER;3)

Modify values of records according to different fields

5

=A3.paste@i(A1:DEPT,[20,10,20]:MANAGER;3)

Insert values according to different fields.

pdate()[1025][1026]

Description:

Get the first day and the last day of the week/month/quarter to which a date belongs.

Syntax:

pdate (dateExp)

Note:

The function gets the first day and the last day of the week/month/quarter to which the date dateExp belongs.

Parameters:

dateExp       Expression whose result is a date, or of standard date format

Options:

@w

Get the Sunday of the week to which the specified date belongs

@we

Get the Saturday of the week to which the specified date belongs

@m

Get the first day of the month to which the specified date belongs

@me

Get the last day of the month to which the specified date belongs

@q

Get the first day of the quarter to which the specified date belongs

@qe

Get the last day of the quarter to which the specified date belongs

The default is to get the Sunday of the week to which the specified date belongs

@y

Get the first day of the year to which the specified data belongs

Return value:

Datetime type

Example:

pdate@w(datetime("19800227","yyyyMMdd"))

1980-02-24

pdate@we (datetime("19800227","yyyyMMdd"))

1980-03-01

pdate@m(datetime("19800227","yyyyMMdd"))

1980-02-01

pdate@me(datetime("19800227","yyyyMMdd"))

1980-02-29

pdate@q(datetime("19800227","yyyyMMdd"))

1980-01-01

pdate@qe(datetime ("19800227","yyyyMMdd"))

1980-03-31

pdate@y(datetime("19800227","yyyyMMdd"))

1980-01-01

penum()[1027][1028]

Here’s how to use penum() function.

E.penum()[1029][1030]

Description:

Judge to which enum group an object belongs.

Syntax:

E.penum(y)

Note:

The functions judges to which group of record sequence E the y belongs, and returns the sequence number(s) of the group(s), i.e. sequence number(s) of the record(s) of E that satisfy the grouping condition.

Parameters:

E

A sequence/record sequence

y

y is allowed to be omitted

Options:

@r

Return the sequence numbers of all the groups satisfying the grouping condition, and the default is to return the sequence number of the first group

@n

If no eligible sequence member of E is found, return the length of E plus 1.

Function keyword:

?

Represents the value of y

Return value:

A sequence number or an integer sequence composed of sequence numbers

Example:

Ø  E is the sequence

 

A

 

1

=["?<=70&&?<=60","?>=70 && ?<=90","?>=90"]

Use y to replace the ? in the grouping conditions when computing

2

=A1.penum(90)

2; the sequence number of the first group satisfying the condition will be returned

3

=A1.penum@r(90)

[2,3]; return the sequence numbers of all the groups

4

=A1.penum@n(43)

4

Related functions:

P.enum()

periods()[1031][1032]

Description:

Generate a sequence of datetime values by specified regular intervals.

Syntax:

periods(s,e,i)

Note:

The function generates a new sequence composed of datetimes in a period from s to e inclusive at a regular interval of i.

Parameters:

s

A datetime variable

e

A datetime variable

i

An integer indicating the interval; its unit is day and its value is 1 by default

Options:

@y

i is the year

@q

i is the quarter

@m

i is the month

@t

i is measured by ten days

@s

i is the second

@x

Exclusive of the ending point

@o

Do not adjust the first datetime value to the beginning point of the time unit. By default, it will be adjusted, and the adjustment is mandatory in the case of using @t.

Return value:

A new sequence composed of datetimes

Example:

 

A

 

1

2000-08-10 12:00:00

 

2

=periods@y(A1,now(),1)

Set year as the interval unit

3

=periods@yo(A1,now(),1)

Do not adjust the first datetime; it is adjusted to the beginning point of the time unit by default, and must be adjusted when using @t.

4

=periods@q(A1,now(),1)

Set quarter as the interval unit

5

=periods@m(A1,now(),1)

Set month as the interval unit

6

=periods@s(A1,now(),7)

Set second as the interval unit

7

=now()

 

8

=pdate@m(A7)

Get the beggining date of the current month

9

=pdate@me(A7)

Get the ending date of the current month

10

=elapse(A8,6-day@w(A8))

Get the first Friday

11

=periods@x(A10,A9,7)

Get the sequence of Fridays

12

=A11(2)

Get the second Friday

13

=A11.m(-1)

Get the last Friday

14

=A11.len()

Get the number of Fridays

permut()[1033][1034]

Description:

Return the number of permutations.

Syntax:

permut(n,k)

Note:

The number of ways of rearranging the k elements picked from a set of n different objects.

Parameters:

n

An integer that is the number of the objects

k

An integer that is the number of the objects in each permutation

Retrun value:

The number of permutations

Example:

permut(5,4)

120

pfind()[1035][1036]

Here’s how to use pfind() function.

A.pfind()[1037][1038]

Description:

Get the sequence number of a record by its primary key.

Syntax:

A.pfind(k)

Note:

The function gets the sequence number of a record whose primary key value is k. Report error if the key isn’t set; return 0 if the eligible record can’t be found.

Parameters:

A

Record sequence/table sequence

k

Primary key; multiple field values from a composite primary key will be presented in sequence [k1,k2,…] or (k1,k2,…).

Options:

@b

Enable the binary search which requires that A must be ordered by the key, otherwise the result will be wrong.

@s

Return the opposite number of an insertable position number when the eligible record cannot be found

Return value:

The sequence number of the eligible record

Example:

 

A

 

1

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

2

=A1. keys (NAME,DEPT)

 

3

=A1.pfind(["Alexis","Sales"])

7; use a sequence to represent the value of a multi-field primay key

4

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

5

=A4.keys(EID)

 

6

=A4.pfind@b(3)

3; @b is used to enable the binary search in order to speed up the computation

7

=demo.query("select * from EMPLOYEE where GENDER='M'")

8

=A7.keys(EID)

 

9

=A7.pfind@s(7)

-2; Return the opposite number of an insertable position number when the record in which EID=7 cannot be found

Related functions:

A.find()

pi()[1039][1040]

Description:

Compute the circumference-to-diameter ratio or its multiple.

Syntax:

pi(numberExp)

Note:

The function computes the circumference-to-diameter ratio or its multiple. The default value of numberExp is 1.

Parameters:

numberExp

The number of times. If this parameter is not supplied, the function returns the circumference ratio.

Return value:

Circumference ratio or its multiple

Example:

pi()

3.141592653589793

pi(2)

6.283185307179586

pivot()[1041][1042]

Here’s how to use pivot() function.

A.pivot(g,;F,V;Ni:N'i,…)[1043][1044]

Description:

Perform row-to-column transposition for a sequence.

Syntax:

A.pivot(g,;F,V;Ni:N'i,…)

Note:

According to grouping fields/expression g, the function transfers values Ni in F field in each group as new field names N'i  to perform a row-to-column transposition, and reassigns values of V field to the new fields. By default, Ni includes non-duplicate values in F field; when N'i is omitted , just use Ni.

Parameters:

A

A sequence

g

Grouping fields/expressions

F

A to-be-transposed field in the specified sequence

V

A field in the specified sequence

Ni

Values of F field

N'i

The new name of Ni field

Options:

@r

Transpose rows to columns. In this case the default fields in Ni are the fields of A that are not included in g. Perform column-to-row transposition, where field names Ni are transposed as values of F field; when parameter N'i is present, it will be values of F field and values of original Ni field will be assigned to new field V . In this case the default values of Ni are all fields in sequence A except for grouping field g

Return value:

A sequence/record sequence

Example:

 

A

 

1

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

2

=A1.pivot(CLASS,STUDENTID;SUBJECT,SCORE;"English":"ENGLISH","Math","PE")

Transpose values of SUBJECT column English, Math and PE to new fields, in which the new name of English field is ENGLISH; values of original SCORE field will be reassigned to the new fields

3

=A1.pivot(CLASS,STUDENTID;SUBJECT,SCORE;"English","Math","PE")

N'I is omitted

4

=A1.pivot(CLASS,STUDENTID;SUBJECT,SCORE)

Both Ni and N'i are omitted, and values of Ni are by default the distinct values of the original SUBJECT field

5

=A2.pivot@r(CLASS,STUDENTID;SUBJECT,SCORE;ENGLISH:"English",Math,PE)

column-to-row transposition; make columns ENGLISH, Math and PE values of SUBJECT field; and values of original ENGLISH, Math, PE fields values of column SCORE

6

=A2.pivot@r(CLASS,STUDENTID;SUBJECT,SCORE)

Ni is omitted; its values are by default all the original field names except for CLASS and STUDENTID

 

pmax()[1045][1046]

Here’s how to use pmax() function.

A.pmax()[1047][1048]

Description:

Get the positions of members with the maximum value in a sequence.

Syntax:

A.pmax( x)

Note:

The function computes expression x with each member of sequence A and returns the sequence numbers of the members whose computations are the maximum. Can be used to find positions of the maximum value in a sequence.

Parameters:

A

A sequence

x

A field name or an expression, in which "~" is used to reference the current record.

Options:

@a

Return one sequence number or multiple ones s of the members that make expression x get the largest value. When omitted, only return the sequence number of the first member.

@z

Perform the search backwards from the last member; by default perform the search from the first member.

Return value:

A sequence number or a sequence composed of sequence numbers

Example:

 

A

 

1

[2,5,4,3,2,9,4,9,3]

 

2

=A1.pmax(~*~)

6

3

=A1.pmax@a(~*~)

[6,8]

4

=A1.pmax@z(~*~)

8

5

=A1.pmax@az(~*~)

[8,6]

6

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

 

7

=A6.pmax(BIRTHDAY)

472

Related functions:

A.maxp()

A.pmin()

pmin()[1049][1050]

Here’s how to use pmin() function.

A.pmin()[1051][1052]

Description:

Get the positions of members with the minimum value in a sequence.

Syntax:

A.pmin(x)

Note:

The function computes expression x with each member of sequence A and returns the sequence numbers of the members whose computations are the minimum. Can be used to find the positions of the minimum value in a sequence.

Parameters:

A

A sequence

x

A field name or an expression, in which "~" is used to reference the current record.

Options:

@a

Return one sequence number or multiple ones of the members that make expression x get the smallest value.

@z

Perform the search backwards from the last member; by default perform the search from the first member.

Return value:

A sequence number or a sequence composed of sequence numbers

Example:

 

A

 

1

[2,5,4,3,2,1,4,1,3]

 

2

=A1.pmin(~*~)

6

3

=A1.pmin@a(~*~)

[6,8]

4

=A1.pmin@z(~*~)

8

5

=A1.pmin@az(~*~)

[8,6]

6

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

 

7

=A6.pmin(BIRTHDAY)

296

Related functions:

A.minp()

A.pmax()

pos()[1053][1054]

Here’s how to use pos() function.

A.pos()[1055][1056]

Description:

Get the position of a member in a sequence.

Syntax:

A.pos(x)

Note:

The function locates member x in sequence A where x may appear repeatedly. Return null if the member cannot be found; return different values according to different options.

Parameters:

A

A sequence object or an expression that returns one.

x

A member.

Options:

@b

Use the binary search to query the location. In this case A is by default an ordered sequence. Both increasing and decreasing are applicable.

@a

Return an n-integer sequence consisting of sequence numbers of all the members that fulfill the query condition.

@z

Perform the search backwards from the last member; by default perform the search from the first member.

@s

With an ordered A and the binary search, return the position of x if it is a member of A; otherwise, return the opposite number for the sequence number representing the position where x can be inserted sequentially.

@p

Find position of the sequence x, which needs to be treated as a single value, in A, which, in this case, is a sequence of sub-sequences.

@n

Return the result of the length of A plus 1 if x cannot be found in A. This option and @a are mutually exclusive.

Return value:

A sequence number or a sequence composed of sequence numbers

Example:

 

A

 

1

=[1,2,8,4,5,6,7,8]

 

2

=A1.pos(8)

3

3

=A1.pos@a(8)

[3,8]

4

=A1.pos@z(8)

8

5

=A1.pos@az(8)

[8,3]

6

=A1.pos@z(9)

null

7

=[1,2,3,4,5,6,7,8].pos@b(5)

5

8

=[1,2,4,5,6,7,8].pos@s(3)

-3

9

=[[6,2,1,4,6,3,7,8],[1,4,6]].pos@p([1,4,6])

2

10

=[6,2,1,4,6,3,7,8].pos@n(5)

9

Note:

If A is not ordered, then options @b and @s should not be used, or they may bring about the incorrect results. For example:

[7,6,1,2,3].pos@b(3)

Return null

Related functions:

A.pos(x)

A.psort()

A.pos(x)[1057][1058]

Description:

Get the positions of sequence members in another sequence.

Syntax:

A.pos(x)

Note:

x is a sequence. The function returns integer sequence p which satisfies A(p)==x, and returns null if it cannot find the positions for all members of x.

Parameters:

A

A sequence

x

A sequence

Options:

@i

Return a monitonically increasing integer sequence p which satisfies A(p)==x

@c

Return the position in which sequence x first appears in A. By doing so, the position of sub-sequence x in sequence A can be located. If x is not the sub-sequence of A, then return null.

@b

Use the binary search to query the location. In this case A is by default assumed as an ordered sequence. Both Increasing and decreasing are applicable

Return value:

A monotonically increasing integer sequence or an integer sequence

Example:

[6,2,1,4,6,3,7,8].pos@i([1,4,6])

[3,4,5], which is a monitonically increasing integer sequence

[6,2,1,4,6,3,7,8].posi([1,4,6])

[3,4,1], which is an integer sequence

[1,2,3,4,6,7,8].pos@b([3,1,4,6])

[3,1,4,5]

[2,1,4,6,3,7,8].pos@i([8,4,6])

null

[2,1,4,6,3,7,8,4,6,1].pos@c([4,6])

[3]

Related functions:

A.pos()

A.psort()

pos()[1059][1060]

Description:

Get the position of a substring in its parent string.

Syntax:

pos(s1, s2{, begin})

Note:

The function finds the position of substring s2 in the parent string s1, which starts from the position begin, and returns null if the substring cannot be found.

Parameters:

s1

The parent string where you want to search for the substring.

s2

Substring of interest.

begin

The position from which the search starts; the default search is from the beginning.

Options:

@z

Perform the search leftward starting from begin, while the search will be done rightward by default.

Return value:

Integer type

Example:

pos("abcdef","def")

4

pos("abcdefdef","def",5)

7

pos("abcdef","defa")

(null)

pos@z("abcdeffdef","def",7)

pos("abcdeffdef","def",7)

4

8

power()[1061][1062]

Description:

Perform exponentiation or find the nth root of a number.

Syntax:

power(x, n)

Note:

The function computes number x raised to the nth power, or takes an nth root of x; if parameter n’s value is a reciprocal (1/n), the function finds the root .

Parameters:

x

Base

n

Power; default is 2

Return value:

Numeric type

Example:

power(2,4)

power(16,1/4)

16.0

2.0

power(5)

25

Related functions:

exp(n)

 

prior()[1063][1064]

Here’s how to use prior() function.

r.prior()[1065][1066]

Description

Among the records, query fields referred by the foreign key recursively.

Syntax:

r.prior(F,r',n)

Note

The function recursively queries field F referred by the foreign key, like [r,r. F, r. F. F,…] in record r. The query will not stop until the value of field F is equal to r'. If r == r' , then return [].The default value of r' is NULL. The recursive query will be performed through all the records to the end. If the specified record r' does not exist, then return NULL. n is the maximum recursion depth, its value is 1,000 by default.

Parameters

r

Records

F

Field name

r'

A record

n

A Number

Return value

A sequence

Example

 

A

 

1

=file("D://emp.txt").import@t().keys(empid)

2

>A1.switch(mgrid,A1:empid)

 

3

=A1.select@1(name=="Kitty").prior(mgrid)

Based on mgrid field referred by the foreign key , select all records of people who are superior to Kitty

4

=A1.select@1(name=="Kitty").prior(mgrid,A1.select@1(name=="Tiger"),5)

Judge if Tiger is superior to Kitty and list all records of people superior to Barnes but inferior to Tiger

proc()[1067][1068]

Here’s how to use proc() function.

db.proc()[1069][1070]

Description:

Call a database stored procedure.

Syntax:

db.proc( sql, param:type:mode:variable, ... )

Note:

The function calls a database stored procedure and sends its output variables to a cellset file. The output variables can be entered into the current context and their generated values can thus be referenced by the current cellset program.

Parameters:

db

Database connection object

sql

The statement for executing a stored procedure, like call test(?,?)

param

The value of an input parameter.

type

The data type of the parameter

mode

"i" or "o". "i" indicates an input parameter and "o" indicates an output parameter.

variable

The output variable's name, through which the result of executing the stored procedure can be referenced in a cellset file.

 

Values for type:

    public final static byte DT_DEFAULT = (byte) 0; // By default, perform automatic recognition.

        public final static byte DT_INT = (byte) 1;

        public final static byte DT_LONG = (byte) 2;

        public final static byte DT_SHORT = (byte) 3;

        public final static byte DT_BIGINT = (byte) 4;

        public final static byte DT_FLOAT = (byte) 5;

        public final static byte DT_DOUBLE = (byte) 6;

        public final static byte DT_DECIMAL = (byte) 7;

    public final static byte DT_DATE = (byte) 8;

        public final static byte DT_TIME = (byte) 9;

        public final static byte DT_DATETIME = (byte) 10;

        public final static byte DT_STRING = (byte) 11;

        public final static byte DT_BOOLEAN = (byte) 12;

 

       public final static byte DT_INT_ARR = (byte) 51;

        public final static byte DT_LONG_ARR = (byte) 52;

        public final static byte DT_SHORT_ARR = (byte) 53;

        public final static byte DT_BIGINT_ARR = (byte) 54;

        public final static byte DT_FLOAT_ARR = (byte) 55;

        public final static byte DT_DOUBLE_ARR = (byte) 56;

        public final static byte DT_DECIMAL_ARR = (byte) 57;

 

       public final static byte DT_DATE_ARR = (byte) 58;

        public final static byte DT_TIME_ARR = (byte) 59;

        public final static byte DT_DATETIME_ARR = (byte) 60;

        public final static byte DT_STRING_ARR = (byte) 61;

        public final static byte DT_BYTE_ARR = (byte) 62;

        public final static byte DT_CURSOR = (byte) 101;

        public final static byte DT_AUTOINCREMENT = (byte) 102;

Example:

Ø  Return a record through a stored procedure

 

A

 

1

=orac.proc("{call RQ_TEST_CUR(?,?)}",:101:"o":table1,1:0:"i":)

2

=table1

A2 references the result of executing the stored procedure via the output variable table1 in A1.It gets the same result as A1.

Here’re the contents of the stored procedure:

Ø  Return table sequences through a stored procedure

 

A

 

1

=orac.proc("{call proAA(?,?)}",:101:"o":a,:101:"o":b)

[[7369,7499,7521,…],[1,2,3]]. Return a sequence of table sequences; each table sequence is referenced by an output variable

2

=A1(1)

Return the first table sequence in the sequence of A1

3

=a

A3 and A4 get stored procedure results by referencing the output variables in A1

 4

=b

Here’re the contents of the stored procedure:

Related functions:

db.execute()

db.query()

product()[1071][1072]

Description:

Return the product of a set of numbers.

Syntax:

product(xi,…)

product(A)

Note:

The function multiplies the members of [x1, x2,…], where any member that is not a number will be ignored.

Parameter:

A

A sequence

xi

An expression

Example:

       

A

 

1

=product(17,3,5)

255

2

=product(4,"b",12,2)

96

 

property()[1073][1074]

Here’s how to use property() function.

f.property()[1075][1076]

Description:

Retrieve property value from the property file.

Syntax:

f.property(p)

Note:

The function retrieves property p from property file f and return.

Parameters:

f

File object

p

Property name; the function returns a table sequence composed of all properties if it is omitted

Options:

@v

Read a property value and parse it as what it is; by default return the value as a string.

Return value:

    A value/a table sequence

Example:

       

A

 

1

=file("E://test.property").property("color")

Property file, export”red

2

=file("E://test.property").property()

Related functions:

f.read()

f.write()

pseg()[1077][1078]

Here’s how to use pseg() function.

A.pseg(x,y)[1079][1080]

Description

Return the sequence number of the interval in which the parameter falls.

Syntax

A.pseg(x,y)

Note

The function returns the sequence number of the interval in which y falls in sequence A, which must be an ordered one. By default the sequence members form intervals that are left-closed and right-open. Parameter x is an expression which will be calculated over each member of sequence A.

In the cases where y is not a member of A, if y is less than the smallest member of an increasing sequence A (or y is greater than the largest member of a decreasing sequence A), then return 0; if y is greater than or equal to the largest member of an increasing sequence A (or y is less than or equal to the smallest member of a decreasing sequence A), then return the length of A.

Parameters

A

A sequence

x

An expression, which is a field name or a legal expression made up of field name and in which the sign ~ can be used to reference the current record; can be absent

y

An expression

Options:

   @r    Form intervals that are left-open and right-closed

Return value

The sequence number of the interval to which y belongs

Example

       

A

 

1

[2,22,122,222,2222]

 

2

=A1.pseg(12)

1. The intervals formed by members of the sequence are [2,22), [22,122),

[122,222), [222,2222) and [2222,∞)

3

=A1.pseg(2222)

5

4

=A1.pseg@r(2222)

4

5

[1,4,8]

 

6

=A5.(~+~).pseg(10)

2

7

=A5.pseg(~+~,10)

2; the expression is equivalent to A6’ s expression

8

=A1.pseg(1)

0

 

pselect()[1081][1082]

Here’s how to use pselect() function.

A.pselect()[1083][1084]

Description:

Get the positions of the specified members from a sequence.

Syntax:

A.pselect( x)

 

A.pselect(x1:y1,x2:y2,......xi:yi)

The simplified syntax for the composite query using "&&" . It is equal to A.pselect(x1==y1 && x2==y2 &&...... xi==yi).

Note:

The function returns the sequence number of a member that fulfils condition x, or returns an empty sequence/null if it cannot find the eligible member. The return value is also subject to the option working with the function.

Options:

@a

Return a sequence composed of sequence numbers of all the members that fulfill the condition x. When it is not supplied, return the sequence number of the first eligible member.

@z

Perform the search backwards from the last member; by default perform the search from the first member.

@b

Perform the binary search when A is an ordered sequence by default. Note that in this case xi must be in ascending or descending order. If A is not an ordered sequence, this option could return incorrect result. When it is used with A.pselect(x1:y1,x2:y2,......xi:yi) to find out members that make cmp(x,y) return 0, simply write A.pselect@b(x1:y1,x2:y2,......xi:yi) without including cmp().

@s

It requires that members in A are ordered for expression x. With the binary search, if no members in A can make the expression x return 0, then return the opposite number of the position where x can be inserted.

@n

If no sequence member is found, return the result of the length of A plus 1. This option and @a are mutually exclusive

Parameters:

A

A sequence

x

A boolean expression, whose value can be null. When using @b option, x should be an expression whose return value is an integer

xi:yi

xi is an expression, and yi is a comparing value

Return value:

The sequence numbers of the member that fulfils condition x or that makes the result of expression x equals y in the given sequence. @a option works to return a sequence composed of all the sequence numbers of the member that fulfils condition x, and return a sequence composed of the sequence numbers of all the members when x is null.

Example:

 

A

 

1

[2,5,4,3,2,9,4,9,3]

 

2

=A1.pselect(~>4)

2

3

=A1.pselect@a(~>4)

[2,6,8]

4

=A1.pselect@z(~>4)

8

5

=A1.pselect@az(~>4)

[8,6,2]

6

=[1,3,5,7,9].pselect@b(~-5)

3. The syntax of A8 and A9 are equal, and their return values are the same. When using a colon, the syntax of using @b doesn’t need to be changed

7

=[1,3,5,7,9].pselect@b(~:5)

8

=[1,3,5,7,9].pselect@s(~:4)

-3. Cannot find 4 and return the opposite number of the position where 4 can be inserted

9

=[1,3,5,7,9].pselect@n(~:4)

6

10

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

 

11

=A10.pselect(GENDER:"M",DEPT:"Sales")

6

12

=demo.query("select * from EMPLOYEE where GENDER='M' order by EID asc")

EID and GENDER are in the same order

13

=A12.pselect@b(EID:10,GENDER:"M")

2

14

=A12.pselect@s(EID:3,GENDER:"M")

-1. Cannot find the record satisfying EID=3 and GENDER=M and return the opposite number of the position where the record can be inserted

15

=A12.pselect@n(EID:3,GENDER:"M")

239

Note:

If A is not an ordered sequence, and xi is not in ascending or descending order, the use of options @b and @s may bring about incorrect results.

Related functions:

A.select()

psort()[1085][1086]

Here’s how to use psort() function.

A.psort()[1087][1088]

Description:

Get the original positions of the sorted members of a sequence.

Syntax:

A.psort (x)

A.psort(xi,...)

Note:

The function sorts members of sequence A according to the value of expression x and returns their sequence numbers before they are sorted.

Parameters:

A

A sequence

x

The sorting expression

xi

If there are multiple sorting expressions, they can be written as xi,.., a compound expression consisting of multiple expressions. The function sorts members by xi,… sequentially in ascending order by default. - xi means sorting in descending order

Options:

   @m   Perform parallel algorithm to enhance performance of handling data-intensive or computation-intensive tasks.

@z

Sort a sequence in descending order and return the position of a member in the original sequence

@0

Put records with null values at the end

Return value:

A sequence composed of the sequence numbers of all the members in a given sequence before they are sorted by expression x.

Example:

 

A

 

1

[a,c,e,g,f,d,b]

 

2

=A1.psort(~)

[1,7,2,6,3,5,4]

3

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

 

4

=A3.psort(DEPT,BIRTHDAY)

A3 is sorted in ascending order by DEPT first, and then in descending order by BIRTHDAY.

5

=A3.psort@m(DEPT,BIRTHDAY)

Use @m opton to increase performance of big data handling.

6

=A1.psort@z(~)

[4,5,3,6,2,7,1]

7

[a,c,e,,f,d,b]

 

8

=A7.psort(~)

[4,1,7,2,6,3,5]

9

=A7.psort@0(~)

[1,7,2,6,3,5,4]

Related functions:

A.pos()

A.sort()

A.pos(x)

A.swap(p,q)

A.rvs()

ptop()[1089][1090]

Here’s how to use ptop() function.

A.ptop()[1091][1092]

Description:

Get the sequence numbers of the n smallest members in a sequence.

Syntax:

A.ptop(n,x)

Note:

The function sorts members of sequence A according to expression x and returns a sequence comprising the sequence numbers of the n smallest members in the given sequence. List both if the smallest member and the largest member are the same. n must be supplied; if n is 0, return null. The absence of x is equivalent to ~; and if the value of x is 0, sorting action won’t be performed.

Parameters:

A

A sequence

x

Sorting expression

n

An integer

Options:

@1

Return a single value if n is ±1

Return value:

A sequence composed of sequence numbers of specified members

Example:

 

A

 

1

[a,c,e,g,f,d,b]

 

2

=A1.ptop(3,~)

[1,7,2]

3

=A1.ptop(3)

Same as A2, as x is not supplied

4

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

 

5

=A4.ptop(3,HIREDATE)

[8,18,203]

6

=A1.ptop(-1)

4

7

=A4.ptop(3,0)

[1,2,3]

8

=A1.ptop@1(-1)

9

[a,c,e,g,f,d,b,a]

 

10

=A9.ptop(1,~)

[1,8]

Related functions:

A.pos()

A.sort()

A.pos(x)

A.psort()

A.top()

push()[1093][1094]

Here’s how to use push() function.

A.push()[1095][1096]

Description:

Push data in a given sequence into a channel.

Syntax:

A.push(chi ,…)

Note:

The function pushes data in sequence A into channel chi and returns the sequence itself. Unless a function that gets the final result set is attached to the channel, the final result set can’t be retrieved from it as the sequence is pushed in.

Parameters:

A

A sequence

chi

Channel

Return value:

Sequence

Example:

 

A

 

1

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

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A2.groups(SELLERID:SellerId;sum(AMOUNT):Amount)

Attach ch.groups() operation that gets the final result to A2’s channel

5

=A3.select(ORDERID<10)

A3 attaches ch.select() operation to A2’s channel

6

=A3.fetch()

Attach ch.fetch() function that gets the final result to A3’s channel to fetch and store the existing data

7

=A1.push(A2,A3)

Push data in A1’s sequence into A2’s channel and A3’s channel

8

=A2.result()

Get results from A2’s channel

9

=A3.result()

Get results from A3’s channel

Related functions:

ch.push()

cs.push()

channel()

ch.push()[1097][1098]

Description:

Push data in a channel into another channel.

Syntax:

ch.push(chi ,…)

Note:

The function pushes data in channel ch into channel chi, and returns channel ch itself.

Parameters:

ch

Channel

chi

Channel

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from SALES")

Create a channel

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A2.select(ORDERID>100)

Attach ch.select() operation to A2’s channel

5

=A1.push(A2)

Push data in A1’s cursor into A2’s channel

6

=A2.push(A3)

A3 Push data in A2’s channel into A3’s channel

7

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data

8

=A3.groups(SELLERID:SellerId;sum(AMOUNT):Total)

Attach ch.groups() operation to A3’s channel

9

=A1.groups(SELLERID:SellerId;sum(AMOUNT):Total)

Data in A1’s cursor is actually pushed into the channel as the operation begins

10

=A2.result()

Get results from A2’s channel

11

=A3.result()

Get results from A3’s channel

Related functions:

A.push()

cs.push()

channel()

cs.push()[1099][1100]

Description:

Push data in a cursor into a channel.

Syntax:

cs.push(chi ,…)

Note:

The function pushes data in cursor cs into channel chi, but the action needs to wait until the data in the cursor is fetched; then returns the cursor itself. The function supports multicursors.

Parameters:

cs

Cursor

chi

Channel

Return value:

Cursor

Example:

 

A

 

1

=demo.cursor("select * from SALES")

Create a cursor

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A2.groups(SELLERID:SellerId;sum(AMOUNT):Total)

Perform ch.groups() operation in the channel

5

=A3.select(ORDERID<10)

Attach ch.select() operation to A3’s channel

6

=A3.fetch()

Fetch and store the existing data in the channel

7

=A1.push(A2,A3)

Be ready to push data in A1’s cursor into the channel, but the action needs to wait

8

=A1.groups(SELLERID:SellerId;sum(AMOUNT):Total)

Data in A1’s cursor is pushed into the channel as the data retrieval operation begins

9

=A2.result()

Get results from A2’s channel

10

=A3.result()

Get results from A3’s channel

 

 

A

 

1

=demo.cursor("select * from SALES")

Create a cursor

2

=channel()

Create a channel

3

=A2.select(ORDERID>100)

Attach ch.select() operation to the channel

4

=A2.fetch()

Keep data in the channel

5

=A1.push(A2)

Be ready to push A1’s cursor data to the channel

6

=A1.fetch()

Fetch data from A1 cursor when the cursor data is really pushed into the channel and the operations in the channel are executed

7

=A2.result()

Fetch the final result set from the channel

Related functions:

ch.push()

A.push()

channel()

query()[1101][1102]

Here’s how to use query() function.

db.query()[1103][1104]

Description:

Execute a SQL statement on a data source and return a table sequence composed of the query results.

Syntax:

db.query( sql {,args …})

 

db.query(A,sql{,args …})

Perform sql based on A and return a table sequence composed of query results. Here, args can be an expression evaluated based on each member of A. This type of syntax can work with @idx options.

db.query(call dfx(){,args …})

Connect to esProc-ODBC data source db to call the specified dfx file and return a result

Note:

The function performs the specified SQL query sql on the data source db and returns a table sequence composed of query results. db is the database connection object.

When there’s only one table following FROM in the SQL statement sql, the key of the result table sequence will be automatically set.

Parameters:

db

Database connection object.

sql

A SQL statement, like select * from table.

args

An argument value passed into the specified SQL command sql. It can be a constant or an expression. The comma is used to separate multiple arguments.

A

A sequence. sql is executed on each member of A. Generally args is computed against each member of A and the value is passed to sql for execution.

dfx

A cellset file; can be specified using a relative path, which is relative to the search path, or an absolute path

Options:

@1

Return only the first-found record satisfying the condition, which is a single value if only one field is involved or a sequence if multiple fields are involved.

@i

Return a sequence if the result set has only one column.

@d

Convert the numeric data type to the double data type, instead of the decimal data type.

@x

Close the database connection automatically when the statement finishes execution. Only valid with the database connection established through the connect function.

Return value:

A table sequence composed of results of executing sql.

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE where DEPT=? ","Sales")

 

2

=demo.query@1("select * from EMPLOYEE where DEPT=? ","Sales")

[3,"Rachel","Johnson","F","New Mexico",1970-12-17,2010-12-01,"Sales",9000]; with @1 option, a sequence composed of field values of the first record is returned.

3

[1,2,3,4]

 

4

=demo.query(A3,"select * from EMPLOYEE where EID=?",~)

5

=demo.query@i(A3,"select SURNAME from EMPLOYEE where EID=?",~)

Return the result as a sequence

6

=demo.query@i("select DEPT from DEPARTMENT")

Return the result as a sequence

7

=mysql.query@d("select * from ta")

8

=connect("demo")

 

9

=A8.query@x("select DEPT from DEPARTMENT")

Close the database connection automatically when the execution is over.

10

=myproc.query("call hsql(?)",10)

hsql.dfx is in the search path. Below is the file:

myproc is the esProc-ODBC data source name; the parameter value is 10. Below is the result:

11

=myproc.query("call G://hsql(?)",10)

hsql.dfx is in the root directoy on drive G; same content and same result as shown in A10

Related functions:

db.execute()

db.proc()

db.query(sql)[1105][1106]

Description:

Query an external table using simple SQL and return the query result.

Syntax:

db.query( sql {,args …})

 

Note:

The function performs a query over an external data file. As a normal table sequence, the external file can be direcly queried by using “file name.extension” as its name, which makes it the external table. The query syntax, which we call simple SQL, is similar to the SQL syntax for the database query.

Support external data files in the format of txt, csv, xlsx, xls, btx (bin files) and ctx(composite table files). An external data table file has headers by default. Use a relative path or an absolute path to access the external data table file; the relative path is relative to esProc main directory.

Parameters:

db

Use connect() to connect to a file system

sql

A “simple SQL” statement, like select * from filename.txt

args

A parameter used in a simple SQL statement, which must be assigned value; multiple parameters should be separated by the comma.

Syntax of simple SQL:

with T as (x)

Define an external table through an esProc script; the query over the file x returns a table sequence or a cursor.

select x F,…

Select data from an external table where x is a field or an expression and F is the alias of the field.

from T T’

Use a defined external table T; T’ is the alias of this table and can be omitted.

from fn T

Direclty use file fn, whose format can be txt, csv, xls, xlsx, btx (a bin file) and ctx (a composite table file) as the external table T; the file is opened as a cursor, and by default has headers; use a relative path, which is relative to esProc main directory, or an absolute path to access file fn.

from {x}

 

as

x is an expression that can be executed within the current cell; the expression should be an esProc expression that returns a table sequence or a cursor

Can use as before the alias of an external file.

where

For conditional filtering.

join,left join,full join      

Associative operations that handle all data in the memory; the corresponding function is xjoin().

/* parallel (n) */

Perform a parallel processing when there isn’t a join and when the external file is a bin file/a composite table.

group by

For grouping operation with groups() function, whose result set is supposed to be able to be wholly stored in the mermoy.

group by n      

Perform grouping by the nth expression in the select statement; n should be a constant.

having

For filtering on grouped data.

order by  

For sorting operations in ascending order, by default.

order by n

Perform sorting by the nth expression in the select statement; n should be a constant.

distinct

Synonym of SQL DISTINCT clause; support only a single table and doesn’t support count( distinct ).

and, or, not, in ,is null, case when else end

between

Used in SQL style; in only supports sets of constants and doesn’t support subqueries

A data range sandwiched by two values, such as the value f1 that falls between 1 and 3, which can be written as f1 >= 1 && f1 <= 3

like

 

 

 

 

 

 

into fn

Fuzzy query, which supports the following wildcard characters:

%  Match multiple characters

_   Match a single character

[chracter,…] A character list that matches any single character in the list

[!chracter,…] or [^chracter,…] Won’t match any single character in the character list

Write the result set to file fn, whose format is determined by its extension, which can be txt, csv, btx, xls and xlsx; use a relative path, which is relative to esProc main directory, or an absolute path to access file fn

? and ?i  

Parameters in the simple SQL statement; i represents the ith parameter

insert

Append data to a file/vector; a composite table to which data is appended must be ordered by the dimension

update

Update data; only support composite tables and the WHERE clause must use the key

delete

Delete data; only support composite tables and the WHERE clause must use the key

commit

Updated data will be temporarily stored but won’t be executed until the commit action is performed; then the new data can be retrieved

rollback

Give up the latest update

aggregate functions

including sum, count, max, min and avg (without support for count(distinct) at present).

set operations

union, union all,intersect,minus; the computation is handled all in the memory

subquery

All subqueries are executed in memory except the from statement

top n

Get first n records

limit n offset m

Skip m records to get n records

Other functions

esProc functions conforming to the syntax

String functions

 

LOWER(str)

Convert into lower case

UPPER(str)

Convert into upper case

LTRIM(str)

Delete whitespaces on the leftmost side

RTRIM(str)

Delete whitespaces on the rightmost side

TRIM(str)

Delete whitespaces on both sides

SUBSTR(str,start,len)
SUBSTR(str,start)

Return a substring

LEN(str)

Return the length of a string

INDEXOF(sub,str[,start])

Return the position of a substring

LEFT(str,len)

Return the substring in the left of a specified string

RIGHT(str,len)

Return the substring in the right of a specified string

CONCAT(str1,str2)

Concatenate two strings

CONCAT(s1,s2,)

Concatenate multiple strings

REPLACE(str,sub,rplc)

Replace a substring by another string

Nemeric functions:

 

ABS(x)

Return absolute value

ACOS(x)

Return arc cosine

ASIN(x)

Return arc sine

ATAN(x)

Return arc tangent

ATAN2(x,y)

Return arc tangent

CEIL(x)

Return the smallest integer that is not less than x

COS(x)

Return cosine value

EXP(x)

Return the base of e to the power of x

FLOOR(x)

Return the biggest integer that not greater than x

LN(x)

Return the natural logarithm

LOG10(x)

Return the logarithm with base 10

MOD(x,m)

Return the remainder of x divided by m

POWER(x,y)

Return the value of x raised to the power of y

ROUND(x,n)

Return x rounded to n digits from the decimal point

SIGN(x)

Return the sign for x

SIN(x)

Return the sine value

SQRT(x)

Return the square root of x

TAN(x)

Return the tangent value

TRUNC(x,n)

Return x truncated to n decimal places

RAND(seed)

Return a random number

Date&Time functions:

 

YEAR(d)

Return the year

MONTH(d)

Return the month

DAY(d)

Return the day of the month

HOUR(d)

Return the hour

MINUTE(d)

Return the minute from d

SECOND(d)

Return the second

QUARTER(d)

Return the quarter from d

TODAY()

Return the date

NOW()

Return the current time

ADDYEARS(d,n)

Add years

ADDMONTHS(d, n)

Add months

ADDDAYS(d, n)

Add days

ADDHOURS(d, n)

Add hours

ADDMINUTES(d, n)

Add minutes

ADDSECONDS(d, n)

Add seconds

DAYOFYEAR(d)

Return the day of year

WEEKOFYEAR(d)

Return the calendar week of the date

Conversion functions:

 

ASCII(str)

Return numeric value of left-most character

CHR(n)

Return the chracter for integer n

INT(x)

Return an integer for string or number x

DECIMAL(x,len,scale)

Return the numeric value for a string or number

TIMESTAMP(str)

Convert the format string of yyyy-mm-dd hh24:mi:ss into datetime

NUMTOCHAR(d)

Return a string for number d

DATETOCHAR(date)

Convert date into a string in the format of  yyyy-mm-dd hh24:mi:ss

Others:

 

NULLIF(x1,x2)

Return null if x1=x2, otherwise return x1

COALESCE(x1,)

Return the first non-null parameter

COUNTIF(x1,,xn)

Count the number of data objects that meet the specified criteria

Return value:

A table sequence

Example:

 

A

 

1

=connect()

 

2

=A1.query("select * from Persons.txt")

3

=A1.query("select * from D:/Orders.txt")

4

=A1.query("select Id_P, sum(OrderNo) from Orders.csv group by 1 ")

Group by Id_P field

5

=A1.query("select Id_P, OrderNo from Orders.csv order by 2 ")

Sort by OrderNo field in ascending order, by default

6

=A1.query("select * into p1.txt from Persons.csv ")

Write the query result set to the file p1.txt

7

=A1.query("select * from Persons.csv where Id_P=? or Id_P>? ",2,2)

Retrieve records where Id_P is equal to or greater than 2

8

=A1.query("select * from Persons.csv where Id_P=?1 or Id_P>?2 ",2,2)

Retrieve records where Id_P is equal to or greater than 2; ?i represents the ith parameter

 

9

=A1.query("with persons as (file(\"D:/Persons.btx\").import@b()) select * from persons ")

Perform a query over Persons.btx and name the result set persons, and then perform a second query over persons; this is an optimization way for processing huge data in SQL

 

10

=A1.query("select /*+parallel(20)*/ count(*) from Persons.btx")

Count the records in the external table Persons.btx in parallel

11

=A1.query("select  *  from Persons.txt  P  join Orders.txt  O  on P.Id_P = O.Id_P   ")

Perform a query through a join

12

=A1.query("select  distinct(Id_P),name  from Orders.txt  ")

Get records where Id_P values are unique

13

=A1.query(“select CASE  id_P   when 1  then 'one' when 2 then 'tow' else 'other'  end from p1.txt”)

Here the case when statement is used

14

=A1.query("select * from Persons.ctx  where city  like  'N%' ")

Use like syntax to find from the file Persons.ctx the record where the first character of the city field is N

15

=A1.query("select * from Persons.ctx  where Name  like  '_a_t%' ")

Use like syntax to find from the file Persons.ctx the record where the second character of the Name field is a

16

=A1.query("select * from Persons.ctx  where Name  like  '%[us]%' ")

Use like syntax to find from the file Persons.ctx the record where the Name field contains u or s

17

=A1.query("select * from Persons.ctx  where Name  like  '%[!a]%' ")

Use like syntax to find from the file Persons.ctx the record where the Name field doens’t contain character a

18

=A1.query("select * from Persons.ctx  where Name  like  '%[^s]%' ")

Use like syntax to find from the file Persons.ctx the record where the Name field doens’t contain character s

 

 

A

 

1

=connect()

 

2

=A1.query("select * from Dep.txt ")

3

=A1.query("insert into Dep.txt  values ('ABC',11)")

The insert statement appends data to Dep.txt

4

=A1.query("commit")

The appended data is temporarily stored and can’t be retrieved until the commit action is executed

5

=A1.query("select * from ctb.ctx")

6

=A1.query("insert into ctb.ctx  values (8,80)")

Append a record to the composite table

7

=A1.query("update ctb.ctx  set v1=20 where k1=2")

Update the composite table according to the key k1

8

=A1.query("delete from ctb.ctx  where k1=11")

Delete the record where k1 is 11 from the composite table, in which k1 is the key

9

=A1.query("delete from ctb.ctx  where k1=10")

Delete the record where k1 is 10 from the composite table, in which k1 is the key

10

=A1.query("rollback")

The rollback action gives up the latest update

11

=A1.query("commit")

The commit action

12

=A1.query("select * from ctb.ctx")

The updated composite table:

Since A10 performs a rollback action, the deletion of reocrd where k1 is 10 is canceled

 

 

A

 

1

=file("score1.txt")

 

2

=file("score2.txt")

 

3

=A1.cursor@t()

 

4

=A2.cursor@t()

 

5

=[A3, A4].mcursor@t()

 

6

=connect().query("select CLASS, max(SCORE)  avg_score  from {A5} where SUBJECT='math' group by CLASS")

Use from {x} syntaxt, where x is a cursor

 

r(T,F)[1107][1108]

Description:

Find a certain field of a specified row in a table sequence/memory table.

Syntax:

k.r(T,F)

Note:

The function finds F field of row k in table sequence/memory table T, which is equivalent to T(k).F. Won’t check whether k is within T’s length.

Parameters:

k

Row number

T

A table sequence/memory table

F

A field of T; can be omitted

Return value:

A record

Example:

 

A

 

1

=demo.query("select EID,NAME from employee")

2

=1.r(A1,NAME)

Get the Name value in the first row of A1’s table sequence

3

=1.r(A1)

Since parameter F is absent, list all field values of the first row

 

r.(x)[1109][1110]

Description:

Compute an expression against a record and return the result.

Syntax:

r.( x )

Note:

The function computes the expression x against record r, and return the result.

Parameters:

r

A record

x

An expression, which is generally a field name or a legal expression that is composed of field names. Use "~" to reference the current record.

Return value:

The computation of x

Example:

 

A

 

1

=[[12,23]].new(~(1):col1,~(2):col2)

 

2

=A1(1).(col2+1)

24

r.F[1111][1112]

r is a record, and r.F is the value of field F of record r .

Besides using r.F to indicate field value, you can also use r.#i, of which #i means the ith field.

r.F=x[1113][1114]

Description:

Assign value to a field of a record.

Syntax:

r.F=x

Note:

The function assigns x to field F of record r.

Parameters:

r

A record

F

Field name

x

An expression, the computation of which is the field value of F

Return value:

The computation of x

Example:

 

A

 

1

=demo.query("select EID,NAME, SALARY from EMPLOYEE")

2

>A1(1).SALARY=A1(1).SALARY+100

The value of "SALARY " in A1(1) is changed into 7100.00

rand()[1115][1116]

Description:

Get a random number.

Syntax:

rand(n)

Note:

    The function returns a random integer between 0 and 1.

Parameters:

n

An integer. Without it the function returns a random float number between 0 and 1.0

Options:

@s

Set the seed value for generating a random number.

Return value:

Numeric type

Example:

rand()

Get a random number in the range of [0, 1.0]

rand()*100

Get a random float number in the range of [0, 100]

rand(100)

Get a random integer in the range of [0, 100]

Ø  The seed value for generating a random number.

 

A

 

1

=rand@s(5)

 

2

=10.(rand())

 

3

= rand@s(5)

 

4

=10.(rand())

The 10 random numbers generated in A4 and A2 are identical

rands()[1117][1118]

Description:

Get a random string.

Syntax:

rands(s,l)

Note:

The function generates a string of length l randomly using the characters of string s.

Parameters:

s

A string

l

An integer

Return value:

A string

Example:

rands("abc",5)

Generate a string of length 5 with characters of string “abc

range()[1119][1120]

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 retunred data is determined by the date type. For example, the maximum precison 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.

Parameters:

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:

A sequence

Example:

 

A

 

1

=range(date("1982-08-09"),date("1992-08-09"),2:3)

The max precison 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 max precison 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

rank()[1121][1122]

Here’s how to use rank() function.

A.rank(y)[1123][1124]

Description:

Compute the ranking of a specified value in a sequence.

Syntax:

A.rank(y)

Note:

The function returns the ranking of a specified value y in sequence A, which by default is sorted in ascending order.

Options:

@z

Return a ranking according to members sorted in descending order. Here “z” is in lowercase.

@i

Deduplicate sequence A before getting y’s ranking.

@s

Perform average operation for each of the duplicate ranking and return the result, which could contain non-integers. Take the sequence [3,2,6,6,9] for example, a default ranking is [2,1,3,3,5]; but with @s option, the ranking becomes [2.0,1.0,(3+4)/2,(3+4)/2,5.0] after we get averages for the two duplicates.

Parameters:

A

A sequence

y

A member of sequence A

Return value:

An integer sequence composed of rankings of sequence A’s members

Example:

 

A

 

1

=[2,1,3,4,8,5,2,0]

 

2

=A1.rank(6)

8; a ranking according to ascendingly ordered members

3

=A1.rank@z(6)

2; a ranking according to descendingly ordered members

4

=A1.rank@i(2)

3; deduplicate the sequence before finding the ranking

5

=A1.rank@s(2)

3.5; get averages for duplicate rankings and then return the final result

Related functions:

A.rank(y,x)

A.rank(y,x)[1125][1126]

Description:

Get the ranking of a certain member in the computed sequence.

Syntax :

A.rank(y,x)

Equivalent to A.(x).rank(y)

Note:

The function computes expression x over each member of sequence A and returns the ranking of a given value y in sequence A.(x). By default the sequence members are sorted in ascending order.

Options:

@z

Return a ranking according to members sorted in descending order. Here “z” is in lowercase.

@i

Deduplicate sequence A.(x) before getting y’s ranking.

@s

Perform average operation for each of the duplicate ranking and return the result, which could contain non-integers. Take the sequence [3,2,6,6,9] for example, a default ranking is [2,1,3,3,5]; but with @s option, the ranking becomes [2.0,1.0,(3+4)/2,(3+4)/2,5.0] after we get averages for the two duplicates.

Parameters:

x

An expression according to which sequence A is computed.

y

A member of sequence A or a value for comparing members of sequence A.(x).

A

A sequence.

Return value:

The ranking of a given member

Example:

 

A

 

1

=demo.query("select * from SCORES where SUBJECT='English'")

 

2

=A1.rank(90,SCORE)

23; a ranking according to ascendingly ordered members

3

=A1.rank@z(90,SCORE)

5; a ranking according to descendingly ordered members

4

=A1.rank@i(90,SCORE)

10; the ranking with duplicate(s) removed

5

=A1.(SCORE).rank(90)

23

6

=A1.rank@s(90,SCORE)

23.5; get averages for duplicate rankings and then return the final result

Related functions:

A.rank(y)

rank()[1127][1128]

Description:

An interative loop for numbering records according to the values of certain fields.

Syntax:

rank(F;Gi,…)

Note:

The function performs a loop operation to number records from 1 according to the value of Gi field. With the same Gi field value, records having the same F field value will be given the same sequence number. When the value of F field changes, the sequence number for the corresponding record is the previous sequence number plus the number of the records with that sequence number. When the value of Gi field changes, start a new round of the numbering process.

Parameters:

F

Field name

Gi

Field name

Returned value:

Integer

Example:

 

A

 

1

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

 

2

=A1.derive(rank(STUDENTID;CLASS):F1)

 

ranki()[1129][1130]

Description:

An interative loop for numbering records according to the values of certain fields.

Syntax:

ranki(F;Gi,…)

Note:

The function performs a loop operation to number records from 1 according to the value of Gi field. With the same Gi field value, records having the same F field value will be given the same sequence number; add 1 to the sequence number when F field value changes. When the value of Gi field changes, start a new round of the numbering process.

Parameters:

F

Field name; under same Gi field value, records with same F field value have same sequence number; add 1 to the sequence number if F field value changes

Gi

Field name; in a loop function, number records under same Gi field value by the changes of F field value; renumber a record when Gi field value changes.

Return value:

Integer

Example:

 

A

 

1

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

 

2

=A1.derive(ranki(STUDENTID;CLASS):F1)

 

ranks()[1131][1132]

Here’s how to use ranks() function.

A.ranks(x)[1133][1134]

Description:

Get the rankings of members of sequence A.(x).

Syntax:

A.ranks(x)

Equivalent to A. (x).ranks()

Note:

The function computes expression x over each member of sequence A to return the rankings of members of sequence A.(x), which by default is sorted in ascending order.

Options:

@z

Return a ranking according to members sorted in descending order (in ascending order by default). Here “z” is in lowercase.

@i

Deduplicate sequence A.(x) before getting the rankings.

@s

Perform average operation for each of the duplicate ranking and return the result, which could contain non-integers. Take the sequence [3,2,6,6,9] for example, a default ranking is [2,1,3,3,5]; but with @s option, the ranking becomes [2.0,1.0,(3+4)/2,(3+4)/2,5.0] after we get averages for the two duplicates.

Parameters:

x

An expression according to which sequence A is computed

A

A sequence

Return value:

The rankings of members of sequence A.(x).

Example:

 

A

 

1

=demo.query("select * from SCORES where SUBJECT='English'")

 

2

=A1.ranks(SCORE)

[7,9,13,1,17,5,13,19,3,25,11,21,23,25,7,9,13,1,17,5,13,19,3,25,11,21,23,25];Rank members in ascending order

3

=A1.ranks@z(SCORE)

[21,19,13,27,11,23,13,9,25,1,17,7,5,1,21,19,13,27,11,23,13,9,25,1,17,7,5,1];Rank members in descending order

4

=A1.ranks@i(SCORE)

[4,5,7,1,8,3,7,9,2,12,6,10,11,12,4,5,7,1,8,3,7,9,2,12,6,10,11,12]; rankings with duplicates removed

5

=A1.(SCORE).ranks()

Same requirement as that in A2

6

=A1.ranks@s(SCORE)

[21.0,10.0,20.0,2.0,6.0,22.0,26.0,8.0,14.0,9.0,12.0,5.0,15.0,19.0,4.0,11.0,13.0,1.0,28.0,24.0,25.0,16.0,17.0,23.0,27.0,7.0,18.0,3.0]; get averages for duplicate rankings and then return the final result

Related functions:

A.ranks()

A.ranks()[1135][1136]

Description:

Compute the ranking of each member in a sequence.

Syntax:

A.ranks()

Note:

The function obtains the ranking of each member in sequence A and returns a sequence composed of rankings of the members, which by default are sorted in ascending order.

Parameters

A

A sequence

Options:

@z

Return a ranking according to members sorted in descending order. Here “z” is in lowercase.

@i

Deduplicate sequence A before getting the rankings.

@s

Perform average operation for each of the duplicate ranking and return the result, which could contain non-integers. Take the sequence [3,2,6,6,9] for example, a default ranking is [2,1,3,3,5]; but with @s option, the ranking becomes [2.0,1.0,(3+4)/2,(3+4)/2,5.0] after we get averages for the two duplicates.

Return value:

    An integer sequence composed of rankings of sequence A’s members

Example:

 

A

 

1

=[2,1,3,4,8,5,2,0]

 

2

=A1.ranks()

[3,2,5,6,8,7,3,1]; rank members in ascending order

3

=A1.ranks@z()

[5,7,4,3,1,2,5,8]; rank members in descending order

4

=A1.ranks@i()

[3,2,4,5,7,6,3,1]; rankings with duplicates removed

5

=A1.ranks@s()

[3.5,2.0,5.0,6.0,8.0,7.0,3.5,1.0] ; get averages for duplicate rankings and then return the final result

Related functions:

A.ranks(x)

 

read()[1137][1138]

Here’s how to use read() function.

f.read()[1139][1140]

Description:

Read contents of a file and return result as strings.

Syntax:

f.read()

Note:

The function retrieves the contents of file f and returns them as strings.

Parameters:

f               A file

Options:

@n

Return the contents of the file object f as a string sequence; each row is corresponding to a member.

@v

Return a sequence as the corresponding data type. The combined use of this option and @n is acceptable

Return value:

A string

Example:

 

 

 

A

 

 

 

1

=file("D:/score.txt")

 

 

 

2

=A1.read()

Read the contents of file object score.txt as a string

 

 

3

=A1.read@n()

With @n option, read and concatenate each line in the text file into a string and return it as a member of the resulting sequence

 

 

4

=file("D:/tmp2.txt")

 

 

 

5

=["Lucy","98"]

By default Lucy is a string and 98 is an integer

 

 

6

=A4.write(A5)

 

 

 

7

=A4.read@nv()

With @nv options, return a sequence consisting of rows of different data types

 

 

8

=A1.read@s()

Read the text file as the binary blob data

 

   Related functions:

f.write()

record()[1141][1142]

Here’s how to use records() function.

T.record()[1143][1144]

Description

Make the members of a sequence the new field values of records of a table sequence.

Syntax

T.record(A,k)

Note

From the specified record k, reassign values to the fields of table sequence T’s records in sequence with members of sequence A. The number of to-be-reassigned records is determined by the number of both A’s members and T’s fields. If the number of A’s members is indivisible by the number of T’s fields, go on to reassign A’s remaining members to the fields of the next record.

Parameters

k

An integer; this means the records will be modified from the kth one

By default or when k ==0, append records to table sequence T

A

A sequence whose members are used to reassign values to T’s fields

T

A table sequence

Options

@i

Insert one or more records before the specified record k

@n

Return the newly-inserted or -modified records or record sequences

Return value

       The modified table sequence T

Example

 

A

 

1

=create(StuID,StuName,English)

2

=A1.record([1,"Lucy",98,2,"Petter",87])

3

=A1.record([10," Claire",88],0)

 Append records to the table sequence when k=0

4

=A1.record([10,"Gail",88],3)

 Modify the 3rd record when k=3

5

=A1.record@i([11," Jamie",90],1)

 

6

=A1.record([3," Lily",67,4])

7

=A1.record@n([15,"Gail",88],3)

Return the newly-inserted record

 

r.record()[1145][1146]

Description

Modify field values of a record with members of a sequence.

Syntax

r.record(A)

Note

The function uses members of sequence A to modify the fields of record r. If the number of A’s members is more than that of r’s fields, discard the surplus members; if the former is lessr than the latter, keep the orginal values of the remaining fields.

Parameters

r

A record

A

A sequence

Return value:

A record

 Example

 

A

 

1

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

The original table sequence in A1

2

=A1(1)

 

3

[Class four,1,English,100]

 

4

=A2.record(A3)

A1’s table sequence after the first record is modified

redis()[1147][1148]

Description:

Connect to a Redis database under the single machine model.

Syntax:

redis(hostAndPort,password,connectionTimeout,soTimeout)

Note:

This external library function connects to a Redis database under the single machine model.

Parameters:

hostAndPort          

The Redis database’s IP and port number, which is a string in the format of ip:port.

password 

The Redis database’s authentication password.

connectionTimeout 

Timeout value when trying to connect to the database (in seconds).

soTimeout

Timeout value when trying to read data(in seconds).

Return value:

Cursor

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

2

=redis("192.168.18.131:6379","runqian",20,60)

 

redis_close()[1149][1150]

Description:

    Close a Redis database connection.

Syntax:

    redis_close(con)

Note:

    This external library function disconnects from a Redis database.

Parameters:

con

Database connection string

Return value:

    No return value

Example:

 

A

1

=redis("192.168.18.131:6379","runqian")

2

=redis_close(A1)

Related functions:

redis()

redis_cluster()[1151][1152]

Description:

Connect to Redis Cluster.

Syntax: 

redis_cluster(hostAndPort[;hostAndPort1;hostAndPort;...],password,[connectionTimeout,soTimeout,maxRedirections;poolConfig])

Note:

External library function. The Redis Cluster connection doesn’t support redis_keys() function.

The parameter poolConfig involves the following values:

1. testOnReturn(boolean)  #Whether connection objects will be validated before being returned.

2. blockWhenExhausted(boolean) #Whether to block when the connection is exhausted; default is true which blocks until timeout; a false value throws an exception.

3. evictionPolicyClassName(String) #Set the name of the eviction policy class name; default is DefaultEvictionPolicy (implement the eviction policy when the connection time exceeds the maximum idle time or the number of connections is greater than the maximum number of idle connections).

4. jmxEnabled(boolean)  #Whether to enable JMX functionality; default is true.

5. jmxNamePrefix(String)  #Set the MBean name, which is "pool" by default.

6. lifo(boolean)  #Whether to use the last-in-first-out order; default is true.

7. maxWaitMillis(long) #Set the maximum amount of time (in miliseconds) before an exeption is thrown (BlockWhenExhausted needs to be true); with value set to be less than 0, block until the connection is established; default is -1.

8. minEvictableIdleTimeMillis(long) #Set the minimum amount of time that a connection can be idle before being tested for eviction; default is 1800000 milliseconds (30 minutes).

  9. numTestsPerEvictionRun(int)  #Set the maximum number of connections to test during idle eviction runs; a negative value is 1/abs(n); defaut is 3.

10. softMinEvictableIdleTimeMillis(long)  #Set the minimum amount of time an object may sit idle before it is eligible for eviction; enable an eviction when idle time > this value & number of idle connections > number of idle connections, without referencing the value of minEvictableIdleTimeMillis (which is the default eviction policy).

11. testOnBorrow(boolean)  #Whether connection objects borrowed from the pool will be validated before being returned; default is true.

12. testWhileIdle(boolean)  #Return whether object sitting idle in the pool will be validated; default is false.

13. timeBetweenEvictionRunsMillis(long) #Set the amount of time (in miliseconds) between runs of the idle object evictor threads; won’t run the evictor threads if the value is negative; default is -1.

Parameters:

hostAndPort

The Redis database’s IP and port number, which is a string in the format of ip:port.

password

The Redis database’s authentication password.

connectionTimeout

Timeout value when trying to connect to the database (in seconds); can be omitted.

soTimeout

Timeout value when trying to read data(in seconds); can be omitted.

maxRedirections

The maximum number of allowed redirections; can be omitted.

poolConfig

Connection property configuration, which is a string in the format of “key:value[,key1:value1,…]”; can be omitted.

Return value:

    Cursor

Example:

 

A

1

=redis_cluster("192.168.0.76:6379";"192.168.0.76:6380","test1234",,10;JmxEnabled:true)

redis_get()[1153][1154]

Description: 

Get the values of all the given keys.

Syntax:

redis_get(con,key[,key1,key2,…])

Note:

This external library function supports getting values of multiple keys.

Parameters:

con

Database connection string

key

Key name

Return value:

    String

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_get(A1,"name")

3

=redis_get(A1,"id","name","age")

Related functions:

redis()

redis_getrange()[1155][1156]

Description:

Get a substring of the string stored at a key.

Syntax:

redis_getrange(con,key,start,end)

Note:

External library funcition. The length of the substring is determined by the two offset parameters start and end inclusive. Zero represents the first character of the string. A negative offset value counts from the end of the string. For instance, -1 represents the last character, -2 is the second-to-last character, and so on.

Parameters:

con

Database connection string

key

Key name

start

The beginning of the substring

end

The end of the substring

Return value:

A substring of the specified string

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_getrange(A1,"name",0,7)

3

=redis_getrange(A1,"name",-3,-1)

Related functions:

redis()

redis_hkeys()[1157][1158]

Description:

Get all the fields in a hash.

Syntax:

redis_hkeys(con,tbl)

Note:

This external library function won’t return a table of fields if the key doesn’t exist.

Parameters:

con

Database connection string

tbl

Hash table name

Return value:

A table containing all fields in the hash.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_hkeys(A1,"website")

redis_hlen()[1159][1160]

Description:

Get the number of fields in a hash.

Syntax:

redis_hlen(con,tbl)

Note:

This external library function returns zero if the key doensn’t exist.

Parameters:

con

Database connection string

tbl

Hash table name

Return value:

The number of fields in the hash.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_hlen(A1,"da")

3

=redis_hlen(A1,"db")

Related functions:

redis()

redis_hmget()[1161][1162]

Description:

Get the values of all the given hash fields.

Syntax:

redis_hmget(con,tbl,field[,field1,field2,....)

Note:

External library function. The order of the returned values is consistent with that of the given hash fields; if a given hash field doesn’t exist, return an empty string.

Parameters:

con

Database connection string

tbl

Hash table name

field

Field name

Return value:

A table containing all the given hash field values.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_hmget(A1,"pet","dog")

3

=redis_hmget(A1,"pet","dog","cat","aa")

Related functions:

redis()

redis_hvals()[1163][1164]

Description:

Get the values of all hash fields.

Syntax:

redis_hvals(con,tbl)

Note:

This external library function won’t return the table of hash field values if the key doesn’t exist.

Parameters:

con

Database connection string

tbl

Hash table name

Return value:

A table containing all hash key values.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

= redis_hvals(A1,"website")

Related functions:

redis()

redis_keys()[1165][1166]

Description:

Find all keys matching the specified pattern.

Syntax:

redis_keys(con,pattern)

Note:

This external library function finds all keys matching the given pattern.

Parameters:

con

Database connection string

pattern

A matching string

Return value:

A list of keys matching the given pattern.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_keys(A1,"*")

3

=redis_keys(A1,"?b")

4

=redis_keys(A1,"*b")

5

=redis_keys(A1,"a[g]*")

redis_lindex()[1167][1168]

Description:

Get a member from a list by its index.

Syntax:

redis_lindex(con,key,index)

Note:

External library function. The parameter index representing an index starts from 0. That is to say, 0 represents the first member in the list, 1 the second member, and so on. The indexes can also be negative. -1 represents the last member in the list, -2 the second-to-last member, and so on. If the index value is beyond the range of the indexes of the list members, the function returns an empty value. If the data type of the parameter key isn’t list, an error will be reported.

Parameters:

con

Database connection string

key

List name

index

Index

Return value:

The list members whose indexes are the parmeter index.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_lindex(A1,"mylist",0)

3

=redis_lindex(A1,"mylist",1)

4

=redis_lindex(A1,"mylist",2)

5

=redis_lindex(A1,"mylist",-1)

redis_llen()[1169][1170]

Description:

Get the length of a list.

Syntax:

redis_llen(con,key)

Note:

External library function. If the parameter key isn’t supplied, the function will interpret it as an empty list and return 0. If the data type of the parameter key isn’t list, an error will be reported.

Parameters:

con

Database connection string

key

List name

Return value:

The length of the list.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

= redis_llen(A1,"abc")

3

= redis_llen(A1,"mylist")

Related functions:

redis()

redis_lrange()[1171][1172]

Decription:

Get a range of members in a list with indexes within the given offset values start and stop.

Syntax:

redis_lrange(con,key,start,stop)

Note:

External library function. Both index parameters start and stop start from 0. That is to say, 0 represents the first member in the list, 1 the second member, and so on. The indexes can also be negative. -1 represents the last member in the list, -2 the second-to-last member, and so on.

A start or stop value that is beyond the range of the indexes of the list members won’t result in an error report. If the start value is outside the range of the indexes, the function won’t return a list. If the stop value is outside the range of the indexes, the Redis database will automatically set its value as the ending index of the list members. An error report will pop up if the data type of the parameter key isn’t list.

Parameters:

con

Database connection string

key

List name

start

Starting index

stop

Ending index

Return value:

A list containing members within the given values.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_lrange(A1,"fp-language",0,1)

3

=redis_lrange(A1,"fp-language",0,2)

4

=redis_lrange(A1,"fp-language",2,3)

redis_pool()[1173][1174]

Description:

Connect to Redis database in buffer pool mode.

Syntax:

redis_pool(hostAndPort,password[,connectionTimeout,database,clientName;poolConfig])

Note:

External library function. The parameter poolConfig involves the following values:

1. testOnReturn(boolean)  #Whether connection objects will be validated before being returned.

2. blockWhenExhausted(boolean) #Whether to block when the connection is exhausted; default is true which blocks until timeout; a false value throws an exception.

3. evictionPolicyClassName(String) #Set the name of the eviction policy class name; default is DefaultEvictionPolicy (implement the eviction policy when the connection time exceeds the maximum idle time or the number of connections is greater than the maximum number of idle connections).

4. jmxEnabled(boolean)  #Whether to enable JMX functionality; default is true.

5. jmxNamePrefix(String)  #Set the MBean name, which is "pool" by default.

6. lifo(boolean)  #Whether to use the last-in-first-out order; default is true.

7. maxWaitMillis(long) #Set the maximum amount of time (in miliseconds) before an exeption is thrown (BlockWhenExhausted needs to be true); with value set to be less than 0, block until the connection is established; default is -1.

8. minEvictableIdleTimeMillis(long)  #Set the minimum amount of time that a connection can be idle before being tested for eviction; default is 1800000 milliseconds (30 minutes).

  9. numTestsPerEvictionRun(int)  #Set the maximum number of connections to test during idle eviction runs; a negative value is 1/abs(n); defaut is 3.

10. softMinEvictableIdleTimeMillis(long)  #Set the minimum amount of time an object may sit idle before it is eligible for eviction; enable an eviction when idle time > this value & number of idle connections > number of idle connections, without referencing the value of minEvictableIdleTimeMillis (which is the default eviction policy).

11. testOnBorrow(boolean)  #Whether connection objects borrowed from the pool will be validated before being returned; default is true.

12. testWhileIdle(boolean)  #Return whether object sitting idle in the pool will be validated; default is false.

13. timeBetweenEvictionRunsMillis(long)  #Set the amount of time (in miliseconds) between runs of the idle object evictor threads; won’t run the evictor threads if the value is negative; default is -1.

Parameters:

hostAndPort

The Redis database’s IP and port number, which is a string in the format of ip:port.

password

The Redis database’s authentication password.

connectionTimeout

Timeout value when trying to connect to the database (in seconds); can be omitted.

database

Database indexes, which within the range of 0~15; can be omitted.

clientName

Client name; can be omitted.

poolConfig

Connection property configuration, which is a string in the format of “key:value[,key1:value1,…]”; can be omitted.

Return value:

Cursor

Example:

 

A

1

=redis_pool("192.168.0.76:6379","test1234",1000,0,"abc";MaxIdle:1000,BlockWhenExhausted:true)

redis_scard()[1175][1176]

Description:

Get the the number of members in a set.

Syntax:

redis_scard(con,key)

Note:

This external library function returns 0 if the parameter key isn’t supplied.

Parameters:

con

Database connection string

key

Set name

Return value:

The number of members in the set.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_scard(A1,"fruit")

redis_sdiff()[1177][1178]

Description:

Get members of the difference set of all the given sets.

Syntax:

redis_sdiff(con,key[,key1,key2,...])

Note:

This external library function allows multiple sets represented by parameter keys; a nonexistent key is treated as an empty set.

Parameters:

con

Database connection string

key

Set name

Return value:

A list of all members in the difference set.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_srandmember(A1,"fruit",5)

3

=redis_srandmember(A1,"tool",5)

4

=redis_sdiff(A1,"fruit","tool")

5

=redis_sdiff(A1,"tool","fruit")

redis_select()[1179][1180]

Description:

Change the selected database for the current connection; the database index is a number that starts from 0.

Syntax:

redis_select(con,index

Note:

This external library function uses the number 0 database by default.

Parameters:

con

Database connection string

index

Index number

Return value:

OK

Example

 

A

B

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_select(A1,1)

redis_sentinel()[1181][1182]

Description:

    Connect to distributed Redis cluster.

Syntax:

redis_sentinel(master,hostAndPort[;hostAndPort2;…],password[,connectionTimeout;poolConfig])

Note:

External library function. The parameter poolConfig involves the following values:

1. testOnReturn(boolean)  #Whether connection objects will be validated before being returned.

2. blockWhenExhausted(boolean)  #Whether to block when the connection is exhausted; default is true which blocks until timeout; a false value throws an exception.

3. evictionPolicyClassName(String)  #Set the name of the eviction policy class name; default is DefaultEvictionPolicy (implement the eviction policy when the connection time exceeds the maximum idle time or the number of connections is greater than the maximum number of idle connections).

4. jmxEnabled(boolean)  #Whether to enable JMX functionality; default is true.

5. jmxNamePrefix(String)  #Set the MBean name, which is "pool" by default.

6. lifo(boolean)  #Whether to use the last-in-first-out order; default is true.

7. maxWaitMillis(long)  #Set the maximum amount of time (in miliseconds) before an exeption is thrown (BlockWhenExhausted needs to be true); with value set to be less than 0, block until the connection is established; default is -1.

8. minEvictableIdleTimeMillis(long)  #Set the minimum amount of time that a connection can be idle before being tested for eviction; default is 1800000 milliseconds (30 minutes).

  9. numTestsPerEvictionRun(int)  #Set the maximum number of connections to test during idle eviction runs; a negative value is 1/abs(n); defaut is 3.

10. softMinEvictableIdleTimeMillis(long)  #Set the minimum amount of time an object may sit idle before it is eligible for eviction; enable an eviction when idle time > this value & number of idle connections > number of idle connections, without referencing the value of minEvictableIdleTimeMillis (which is the default eviction policy).

11. testOnBorrow(boolean)  #Whether connection objects borrowed from the pool will be validated before being returned; default is true.

12. testWhileIdle(boolean)  #Return whether object sitting idle in the pool will be validated; default is false.

13. timeBetweenEvictionRunsMillis(long)  #Set the amount of time (in miliseconds) between runs of the idle object evictor threads; won’t run the evictor threads if the value is negative; default is -1.

Parameters:

master

Master node name.

hostAndPort

The Redis database’s IP and port number, which is a string in the format of ip:port.

password

The Redis database’s authentication password.

connectionTimeout

Timeout value when trying to connect to the database (in seconds); can be omitted.

poolConfig

Connection property configuration, which is a string in the format of “key:value[,key1:value1,…]”; can be omitted.

Return value:

Cursor

Example:

 

A

1

=redis_sentinel("master","192.168.0.76:63791";"192.168.0.76:63792","test1234",;BlockWhenExhausted:true,TestOnReturn:true)

redis_shared()[1183][1184]

Description:

Connect to a Redis database in shared pool mode.

Syntax:

redis_shared(hostAndPort:password[,hostAndPort1:password1,…][:connectionTimeout:soTimeout;pattern])

Note:

This external library function connects to a Redis database in shared pool mode.

Parameters:

hostAndPort

The Redis database’s IP and port number, which is a string in the format of ip:port.

password

The Redis database’s authentication password.

connectionTimeout

Timeout value when trying to connect to the database (in seconds); can be omitted.

soTimeout

Timeout value when trying to read data(in seconds).

pattern

Key pattern by which the user-defined sharding algorithm is implemented; can be omitted.

Return value:

Cursor

Example:

 

A

1

=redis_shared("192.168.0.76:6379":"test1234","192.168.0.76:6380":"test1234":1000:10;idel:true,master:100)

redis_sharedpool()[1185][1186]

Description:

    Connect to a Redis database in a mode of both buffer pool and shared pool.

Syntax:

redis_sharedpool(hostAndPort:password[:connectionTimeout:soTimeout][,hostAndPort1:password1:connectionTimeout:soTimeout,…][; pattern;poolConfig])

Note:

External library function. The connection doesn’t support the following functions:

redis_get(), 

redis_sdiff(), 

redis_sinter(), 

redis_sunion(), 

redis_select(), 

redis_keys() 

 

The parameter poolConfig involves the following values:

1. testOnReturn(boolean)  #Whether connection objects will be validated before being returned.

2. blockWhenExhausted(boolean)  #Whether to block when the connection is exhausted; default is true which blocks until timeout; a false value throws an exception.

3. evictionPolicyClassName(String)  #Set the name of the eviction policy class name; default is DefaultEvictionPolicy (implement the eviction policy when the connection time exceeds the maximum idle time or the number of connections is greater than the maximum number of idle connections).

4. jmxEnabled(boolean)  #Whether to enable JMX functionality; default is true.

5. jmxNamePrefix(String)  #Set the MBean name, which is "pool" by default.

6. lifo(boolean)  #Whether to use the last-in-first-out order; default is true.

7. maxWaitMillis(long)  #Set the maximum amount of time (in miliseconds) before an exeption is thrown (BlockWhenExhausted needs to be true); with value set to be less than 0, block until the connection is established; default is -1.

8. minEvictableIdleTimeMillis(long)  #Set the minimum amount of time that a connection can be idle before being tested for eviction; default is 1800000 milliseconds (30 minutes).

  9. numTestsPerEvictionRun(int)  #Set the maximum number of connections to test during idle eviction runs; a negative value is 1/abs(n); defaut is 3.

10. softMinEvictableIdleTimeMillis(long)  #Set the minimum amount of time an object may sit idle before it is eligible for eviction; enable an eviction when idle time > this value & number of idle connections > number of idle connections, without referencing the value of minEvictableIdleTimeMillis (which is the default eviction policy).

11. testOnBorrow(boolean)  #Whether connection objects borrowed from the pool will be validated before being returned; default is true.

12. testWhileIdle(boolean)  #Return whether object sitting idle in the pool will be validated; default is false.

13. timeBetweenEvictionRunsMillis(long)  #Set the amount of time (in miliseconds) between runs of the idle object evictor threads; won’t run the evictor threads if the value is negative; default is -1.

Parameters:

hostAndPort

The Redis database’s IP and port number, which is a string in the format of ip:port.

password

The Redis database’s authentication password.

connectionTimeout

Timeout value when trying to connect to the database (in seconds); can be omitted.

soTimeout

Timeout value when trying to read data(in seconds).

pattern

Key pattern by which the user-defined sharding algorithm is implemented; can be omitted.

poolConfig

Connection property configuration, which is a string in the format of “key:value[,key1:value1,…]”; can be omitted.

Return value:

Cursor

Example:

 

A

1

=redis_sharedpool("192.168.0.76:6379”:"test1234"::100,"192.168.0.76":6380:"test1234":1000:100;;idel:true)

redis_sinter()[1187][1188]

Decription:

Get members of the intersection of all the given sets.

Syntax:

redis_sinter(con,key[,key1,key2,...])

Note:

External library function. A nonexistent set represented by the parameter key is treated as an empty set. If there is an empty set among the given sets, the function returns an empty set.

Parameters

con

Database connection string

key

Set name

Return value

A list of all members in the intersection.

Example

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

= redis_srandmember(A1,"fruit",5)

3

=redis_srandmember(A1,"tool",5)

4

=redis_sinter(A1,"tool","fruit")

redis_sismember()[1189][1190]

Description:

Determine if a given value is a member of a set.

Syntax:

redis_sismember(con,key,member)

Note:

External library function. If the parameter member is a member of the set key, return true; if the parameter member isn’t a member of the set key, or if the parameter key isn’t supplied, return false.

Parameters:

con

Database connection string

key

Set name

member

Set element

Return value

Boolean value

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_sismember(A1,"fruit","banana")

3

=redis_sismember(A1,"fruit","aaa")

redis_smembers()[1191][1192]

Description:

Get all members of a set.

Syntax:

redis_smembers(con,key)

Note:

External lirary function. A nonexistent key is treated as an empty set.

Parameters:

con

Database connection string

key

Set name

Return value:

All members of the set.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_smembers(A1,"language")

redis_srandmember()[1193][1194]

Description:

    Get one or multiple random members from a set.

Syntax:

redis_srandmember(con,key[,count])

Note:

External library function. If parameter count isn’t supplied, return a random member from the set. When the parameret count is supplied: If the value of parameter count is positive and less than the number of the set, return an arrry containing unique members and whose length is count. If the value of count is equal to or greater than the number of the set, return the whole set. If the value of parameter count is negative, return an array that could contain duplicate members and whose length is the absolute value of the count.

Parameters:

con

Database connection string

key

Set name

count

The number of returned members; can be omitted.

Return value:

A table sequence

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_srandmember(A1,"fruit")

3

=redis_srandmember(A1,"fruit",2)

 

4

 

=redis_srandmember(A1,"fruit",3)

5

=redis_srandmember(A1,"fruit",10)

6

 

=redis_srandmember(A1,"fruit",-3)

7

=redis_srandmember(A1,"fruit",-5)

redis_strlen()[1195][1196]

Description:

Get the length of the string value stored in the key.

Syntax:

redis_strlen(con,key)

Note:

This external library function returns 0 if the parameter key isn’t supplied.

Parameters:

con

Database connection string

key

Key name

Return value:

The length of the string value.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

 2

=redis_strlen(A1,"name")

3

=redis_strlen(A1,"age")

redis_sunion()[1197][1198]

Description:

Get the members of the union of all the given sets.

Syntax:

redis_sunion(con,key[,key1,key2,...])

Note:

External library function. A nonexistent key is treated as an empty set.

Parameters:

con

Database connection string

key

Set name

Return value:

A list of all members of the union set.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_srandmember(A1,"fruit",5)

3

=redis_srandmember(A1,"tool",5)

4

=redis_sunion(A1,"tool","fruit")

redis_type()[1199][1200]

Description:

Get the data type of the value stored in the key.

Syntax:

redis_type(con,key)

Note:

This external library function returns value in the following data types:

None (key isn’t supplied)

String

List

Set

Zset

Hash

Parameters:

con

Database connection string

key

Key name

Return value:

Data type of the key value.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_type(A1,"weather")

3

=redis_type(A1,"db")

4

=redis_type(A1,"page_rank")

redis_zcard()[1201][1202]

Description:

Get the number of members in a sorted set.

Syntax:

redis_zcard(con,key)

Note:

External library function. If the parameter key is supplied and the data type of its value is the sorted set, return the number of members in the sorted set.If the parameter key isn’t supplied, return 0.

Parameters:

con

Database connection string

key

Sorted set name

Return value:

Integer

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

 2

=redis_zcard(A1,"salary")

redis_zcount()[1203][1204]

Description:

Count the number of members in a sorted set with scores between a given interval.

Syntax:

redis_zcount(con,key,min,max)

Note:

External library function. By default members whose scores are equal to the parameter min or parameter max are included.

Parameters:

con

Database connection string

key

Sorted set name

min

The starting score

max

The ending score

Return value:

Integer

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES")

3

=redis_zcount(A1,"salary",1000,11000)

4

=redis_zcount(A1,"salary",1000,12000)

redis_zrange()[1205][1206]

Description:

Return a range of members in a sorted set, by index.

Syntax:

redis_zrange(key,start,stop[,withscores])

Note:

This external library function returns members along with their scores if the parameter withscores is supplied; return members only without the parameter.

By default the returned members is in a ascending order; use @z option to arrange them in a descending order. Arrange members with the same score by lexicographical range.

Both index parameters start and stop start from 0. That is to say, 0 represents the first member in the list, 1 the second member, and so on. The indexes can also be negative. -1 represents the last member in the list, -2 the second-to-last member, and so on.

Options:

@z    Arrange members in a descending order.

Parameters:

con

Database connection string

start

Starting index

stop

Ending index

withscores

Also return the scores; can be omitted.

Return value:

A table sequence containing a range of members of the sorted set, by index.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrange(A1,"page_rank",0,2)

3

=redis_zrange@z(A1,"page_rank",0,2,"WITHSCORES")

4

=redis_zrange@z(A1,"page_rank",-2,-1,"WITHSCORES")

redis_zrangebyscore()[1207][1208]

Description:

Return a range of members in sorted set, by score.

Syntax:

 redis_zrangebyscore(con,key,min,max[,offset,n,withscores])

Note:

This external library function gets members with scores between the given values from the parameter min and the parameter max (min and max are inclusive). The desired members are arranged by score in ascending order (from low to high).

The interval defined by min and max in the expression is by default a closed interval. Use a double quotation and the left parenthesis to represent an open interval, like the expression redis_zrangebyscore(A1,"salary","(5000",40000,"WITHSCORES") which returns a range of members in the sorted set salary with scores between 5000 inclusive and 40000.

The function returns members along with their scores if the parameter withscores is supplied; return members only without the parameter.

Arrange members with the same score by lexicographical range.

Parameters:

con

Database connection string

key

Sorted set name

min

The smallest score; can be –inf, meaning infinitely small

max

The greatest score; can be +inf, meaning inifinitely large

offset

Offset interval; can be omitted along with the parameter n

n

Offset value; can be omitted along with the parameter offset

withscores

Also return the scores; can be omitted

Return value:

A table sequence

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES")

3

=redis_zrangebyscore(A1,"salary","-inf","+inf",0,2,"WITHSCORES")

4

=redis_zrangebyscore(A1,"salary",5000,40000,"WITHSCORES")

5

=redis_zrangebyscore(A1,"salary","(5000",40000,"WITHSCORES")

6

=redis_zrangebyscore(A1,"salary","-inf","+inf")

7

=redis_zrangebyscore(A1,"salary","-inf",10000,"WITHSCORES")

redis_zrank()[1209][1210]

Description:

Determine the ranking of a member in a sorted set.

Syntax:

redis_zrank(con,key,member

Note:

External library function. By default the members in a sorted set is arranged in an ascending order; use @z option to arrange them in a descending order. 

The rankings start with 0, meaning the ranking of the member with the smallest score is 0.

If the given member doesn’t belong to the sorted set, return an empty table.

Options:

@z    Arrange sorted set members in descending order.

Parameters:

con

Database connection string

key

Sorted set name

member

Sorted set member

Return value:

Table sequence

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES")

3

=redis_zrank(A1,"salary","jack")

4

=redis_zrank@z(A1,"salary","jack")

redis_zscore()[1211][1212]

Description:

Get the score associated with the given member in a sorted set.

Syntax:

redis_zscore(con,key,member)

Note:

This external library function returns an empty table if the given member doesn’t belong to the sorted set, or if the key doesn’t exist.

Parameters:

con

Database connection string

key

Sorted set name

member

Sorted set member

Return value

Sequence

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_zrangebyscore(A1,"salary","-inf","+inf","WITHSCORES")

3

=redis_zscore(A1,"salary","jack")

regex()[1213][1214]

Here’s how to use regex() function.

s.regex()[1215][1216]

Description:

Match a string with the regular expression.

Syntax:

s.regex(rs)

Note:

The function matches string s with the regular expression rs, and returns an array of sections of matching data. If they don’t match, then return null.

Parameters:

s

A string

rs

Regular expression

Options:

@c

Case insensitive

@u

Use Unicode to match

Return value:

An array of sections of data

Example:

 

A

 

1

4,23,a,test

 

2

a,D

 

3

W,F

 

4

=A1.regex("(\\d),([0-9]*),([a-z]),([a-z]*)")

5

=A2.regex@c("([a-z]),([a-z])")

With @c option, it is case insensitive

6

=A2.regex("([a-z]),([a-z])")

Return null because they don’t match

7

=A3.regex@u("(\\u0057),(\\u0046)")

[W,F] Use unicode to match

Related functions:

A.regex()

cs.regex()

A.regex()[1217][1218]

Description:

Match members in a string sequence with the regular expression.

Syntax:

A.regex(rs,Fi)

If no extracting item is specified in rs, match field Fi of the string with rs based on data type. Then return the new record sequence after record sequence A is filtered. Use the current record to match with rs if omitting Fi

A.regex(rs;Fi,…)

If one or more extracting items are specified in rs, split the string members of sequence A according to them, and return the results as a table sequence whose fields are Fi

Note:

The function matches the members of string type in the sequence A with the regular expression rs. The results will be merged into a table sequence whose fields are Fi for returning.

Parameters:

A

A sequence or a record sequence whose members are strings

rs

Regular expressions. The extracting items are specified sub-regular expressions which are separated from each other by separators and each is surrounded with the parentheses. They will match the fields in sequence. For example, "(.*),(a.*)" are two extracting items separated by a comma.

Fi

Resulting field names of string type

Options:

@c

Case insensitive

@u

Use Unicode to match

Return value:

A table sequence

Example:

 

A

 

1

=demo.query("select NAME,SURNAME from EMPLOYEE")

 

2

=A1.(~.array().concat@c())

 

Convert to a sequence of strings

3

=A2.regex("A.*")

By default, use current record to match with rs if omitting Fi

4

=A2.regex("(V.*),(.*)";name,surname)

Match members of A2 with the regular expressions and return a table sequence

5

=file("D:\\a.txt").import@ts()

6

=A5.(#1).regex@c("(.*),(a.*)";id,name)

Match names that start with a or A

7

=file("D:\\c.txt":"UTF-8").import@ts()

 

8

=A7.(~.array().concat@c())

 

9

=A8.regex@u("(\\u9500\\u552e\\u90e8),(.*)";SalesDep,EmployeeName)

Use Unicode to match the Sales Dep.

10

=A1.regex("V.*",NAME)

Without an extracting item, match the regular expression rs with the string type Fi field

Related functions:

s.regex()

cs.regex()

cs.regex()[1219][1220]

Description:

Match the string members of in the cursor with the regular expression.

Syntax:

cs.regex(rs,Fi,…)

Note:

The function matches the string members in cursor cs with regular expression rs, returns the original cursor whose fields are Fi. It supports multicursors.

Parameters:

cs

A cursor whose members are strings

rs

Regular expression

Fi

Resulting field name

Options:

@c

Case insensitive

@u

Use Unicode to match

Return value:

The original cursor with new fields

Example:

 

A

 

1

=file("D:\\a.txt").import@ts().(~.array().concat@c())

a.txt is a table sequence whose fields are separated by commas

2

=A1.cursor()

 

3

=A1.cursor()

 

4

=A2.regex("(.*),(A.*)";id,name).fetch()

Match employees whose names start with A

5

=A3.regex@c("(.*),(A.*)";id,name).fetch()

 Match employees whose names start with a or A

6

=file("D:\\c.txt":"UTF-8").import@ts().(~.array().concat@c())

 

7

=A6.cursor()

 

8

=A7.regex@u("(\\u9500\\u552e\\u90e8),(.*)";销售部,员工姓名).fetch()

Use Unicode to match the Sales Dep.

Related functions:

s.regex()

A.regex()

 

register()[1221][1222]

Description:

Register a dfx  file as a function to be called.

Syntax:

register(f,dfx)

Note:

The function registers a dfx file as function f to call it in a cellset script. The format is f(…). This is equivalent to call@r(dfx,…), in which … is a parameter in the dfx file. A function name can only be registered once.

Parameters:

f

Function name

dfx

dfx file path, which can be an absolute path or a relative path; a relative path is relative to the main directory

Return value:

     Result of executing the dfx file

Example:

       Below is emp.dfx:

 

A

 

1

=connect("demo")

 

2

=A1.query("select * from employee where DEPT=?",arg1)

 

3

return A2

 

 

 

A

 

1

=register("df1","D:/emp.dfx")

Register emp.dfx as df1 function

2

=df1("HR")

Call the registered function

rename()[1223][1224]

Here’s how to use rename() function.

T.rename()[1225][1226]

Description:

Rename the fields in a table sequence/composite table.

Syntax:

T.rename (F, F')

Note:

The function renames F field as F', or renames a composite table’s index.

Parameters:

F

Field name/index name

F'

The modified field name; when omitted, the original field names will be deleted and replaced by _1, _2…

T

Table sequence/Composite table

Return value:

Table sequence T with modified field names

Example:

 

A

 

1

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

 

2

=A1.rename(EID:ID)

 

3

=file("D:\\emp1.ctx")

 

4

=A3.create()

Open a composite table

5

=A4.rename(EID:EID2)

Rename EID field EID2

6

=A5.cursor().fetch()

7

=A18.rename(test_index:index)

Rename index test_index index

cs.rename()[1227][1228]

Description:

Rename a field of a cursor.

Syntax:

cs.rename(F:F',…)

Note:

The function renames F field in cursor cs F', or renames the index of a composite table file.

Parameters:

F

Field name/index name

F'

New name of the field; If omitted, delete the original names and name the fields _1,2...

cs

A cursor

Return value:

A cursor with new field name(s)

Example:

 

A

 

1

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

Return a cursor

2

=A1.rename(EID,NAME,GENDER).fetch()

Since parameter is omitted, delete the original field names and name them _1, _2, _3

3

=A1.rename(EID:ID).fetch()

Rename EID field ID

4

=A1.rename(EID:ID,GENDER:SEX,DEPT).fetch()

Rename EID field ID and GENDER field SEX

replace()[1229][1230]

Description:

Replace a specified substring of a source string.

Syntax:

replace (src,a,b)

Note:

The function replaces the substring a of string src with another string b.

Parameters:

src

Source string

a

The substring of a source string

b

The string with which the specified string will be replaced

Options:

@q

 A quoted specified string won’t be replaced

Return value:

A string after the replacement

Example:

replace("123321","2","two")

1two33two1

replace("abc'abc'def","a","China")

Chinabc'Chinabc'def

replace@q("abc'abc'def","a","China")

Chinabc'abc'def

report_config()[1231][1232]

Description:

Read information from the configuration file.

Syntax:

report_config(filePath, funfile)

Note:

This external library function reads information from the configuration file, including the main directory and the path of the reporting tool license file, and loads the license file for authentication.

Parameters:

filePath

A file path, which is either a relative path or an absolute path, or a class path; for a relative path, its base directory is the esProc installation directory

funfile

The path of the configuration file of a user-defined function, which is either a relative path or an absolute path, or a class path; for a relative path, its base directory is the esProc installation directory

Example:

>report_config("config\\raqsoftConfig.xml")

A relative path

>report_config("D:\\esProc\\config\\raqsoftConfig.xml")

An absolute path

>report_config("config\\raqsoftConfig.xml","config\\customFunctions.properties")

Both filePath and funfile are relative to the main directory

>report_config("config\\raqsoftConfig.xml","customFunctions.properties")

filePath is relative to the main directory but funfile is in the class path

report_exportHtml()[1233][1234]

Description:

Export a report as a HTML file or an MHT file.

Syntax:

report_exportHtml(rpt, filePath)

Note:

By default, this external library function exports a report into the HTML format; it outputs an MHT file when @x option is present. A report file that isn’t computed will be exported as a template.

Parameters:

rpt

A report object

filePath

The exported file path, which is either a relative path or an absolute path; for a relative path, its base directory is the content of <home> in the configuration file.

Options:

@x

Export the report file into an MHT format; the default format of the exported file is HTMl.

Return value:

An exported file path

Example:

 

A

 

1

>report_config("config\\raqsoftConfig.xml")

 

2

=report_open("D:\\test.rpx")

 

3

=report_run(A2)

 

4

=report_exportHtml(A2,"D:\\test")

Export as test.html

5

=report_exportHtml@x(A2,"D:\\test.mht")

Export as test.mht

6

=report_exportHtml(A2,"test")

With a relative path parameter, the exported file path is D:\test.html if the path set for <home> in the configuration file is “D:\”

Related functions:

report_config()

report_open()

report_run()

report_exportPdf()[1235][1236]

Description:

Export a report as a PDF file.

Syntax:

report_exportPdf(rpt, filePath)

Note:

This external library function exports a report file into a PDF format. A report file that isn’t computed will be exported as a template.

Parameters:

rpt

A report object

filePath

The exported file path, which is either a relative path or an absolute path; for a relative path, its base directory is the content of <home> in the configuration file.

Return value:

An exported file path

Example:

 

A

 

1

>report_config("config\\raqsoftConfig.xml")

 

2

=report_open("D:\\test.rpx")

 

3

=report_run(A2)

 

4

=report_exportPdf(A2,"D:\\test.pdf")

Export as test.pdf

5

=report_exportPdf(A2,"test.pdf")

With a relative path parameter, the exported file path is D:\test.pdf if the path set for <home> in the configuration file is “D:\”

Related functions:

report_config()

report_open()

report_run()

report_exportXls()[1237][1238]

Description:

Export a report as an xls file or an xlsx file.

Syntax:

report_exportXls(rpt, filePath)

Note:

By default, this external library function exports a report as an xls file; it outputs an xlsx file when @x option is present. A report file that isn’t computed will be exported as a template.

Parameters:

rpt

A report object

filePath

The exported file path, which is either a relative path or an absolute path; for a relative path, its base directory is the content of <home> in the configuration file.

Options:

@x

Export the report as an xlsx file

Return value:

An exported file path

Example:

 

A

 

1

>report_config("config\\raqsoftConfig.xml")

 

2

=report_open("D:\\test.rpx")

 

3

=report_run(A2)

 

4

=report_exportXls(A2,"D: \\test.xls")

Export as test.xls

5

=report_exportXls@x(A2,"D:\\test.xlsx")

Export as test.xlsx

6

=report_exportXls(A2,"test.xls")

With a relative path parameter, the exported file path is D:\test.xls if the path set for <home> in the configuration file is “D:\”

Related functions:

report_config()

report_open()

report_run()

report_open()[1239][1240]

Description:

Read a report file.

Syntax:

report_open(filePath)

Note:

This external library function reads a report file and returns the report object rpt.

Parameters:

filePath

The report file path, which is either a relative path or an absolute path; for a relative path, its base directory is the content of <home> in the configuration file.

Return value:

A report object

Example:

 

A

 

1

>report_config("config\\raqsoftConfig.xml")

 

2

=report_open("D:\\test.rpx")

Read the report file test.rpx

3

=report_open("test1.rpx")

With a relative path parameter, the report file path is the one set for <home> in the configuration file

Related functions:

report_config()

report_run()[1241][1242]

Description:

Compute a report file.

Syntax:

report_run(rpt, paramValue:paramName,....)

Note:

This external library function performs computation over a report file.

Parameters:

rpt

A report object

paramValue

Report parameter value; can be omitted

paramName

Report parameter name; if it is omitted, write the report parameter values in its original order. It is illegal to write only some report parameter names while omitting others; the colon (;) following the parameter should always be rertained.

Options:

@c

Compute the report file, which is also the default operation when options are absent

@p

Paginate the report

Return value:

The report file path

Example:

 

A

 

1

>report_config("config\\raqsoftConfig.xml")

 

2

=report_open("D:\\test.rpx")

 

3

=report_run(A2)

Compute the report file test.rpx that doesn’t have any parameters

4

=report_open("D:\\test1.rpx")

The report file test1.rpx has 3 parameters

5

=report_run(A2,"abc":"arg1",12:"arg2","2016-01-02":"arg3")

Compute a report file having several parameters

6

=report_run(C3,"abc":,12:,"2016-01-02":)

As the report parameter names are omitted, the parameter values are set in its original order, with the colon retained

7

=report_open("D:\\test2.rpx")

 

8

=repot_run@p(A2)

Pagination without computation

9

=repot_run@cp(A2)

Computation as well as pagination

Related functions:

report_config()

report_open()

reset()[1243][1244]

Here’s how to use reset() function.

cs.reset()[1245][1246]

Description:

Reset a cursor by moving it back to the beginning.

Syntax:

cs.reset()

Note:

The function resets a cursor by moving it back to the beginning when it traverses data to the end.

Parameters:

cs

A cursor

Return value:

The cursor itself

Example:

 

A

 

1

=demo.cursor("select * from scores")

Return retrieved data as a cursor

2

=A1.fetch()

Fetch data from the cursor

3

=A1.fetch()

Return null because A1’s cursor has come to the end of the data

4

=A1.reset()

Move the cursor back to the beginning

5

=A1.fetch()

Fetch data out of the cursor; returned result is the same as A2

Related functions:

cs.skip(0)

f.reset()[1247][1248]

Description:

Copy a composite table file to another composite table file.

Syntax:

f.reset(f’,p,pw:pr)

 

Note:

 The function copies encrypted composite table file f, whose write password is p, to another composite table file f’, whose write password is pwand read password is pr, without copying the index. If parameter f’ is absent, re-arrange f , re-create an index for it, and resize the length of its column segments according to the data amount. If parameters p,pw:pr are absent, the to-be-copied composite table is unencrypted and the new composite table is also unencrypted; if parameter p is absent but parameters pw:pr are present, the to-be-copied composite table is unencrypted but the new composite table is encrypted; if parameter p is present but parameters pw:pr are absent, the to-be-copied composite table is encrypted but the new composite table is unencrypted.

Parameters:

f

f’

A composite table file

The new composite table file

p

The write password of the copied composite table

pw

The write password of the new composite table; when it is absent, the read password must be omitted

pr

The read password of the new composite table; can be omitted; when the write password is present, this read password can be omitted

Options:

@u

Write the file as an uncompressed one; perform the write as usual if the parameter is omitted

@z

Write the file as a compressed one; won’t perform compression if the option is absent

@r

Write the file by row; perform the write as usual if the parameter is omitted

@c

Write the file by column

@q

A quick reset that doesn’t change the way of segmention, the way of storage, and the password of the original composite table file but that only merges the newly-added data to the column data; doesn’t work with parameter f’

@n

Generate an empty same-structure composite table file

@m

Combine contents of all the other files into the first one when parameter f is a file group and empty (but don’t delete) those other files

Return value:

Boolean value

Example:

 

A

 

1

=file("D:\\test1.ctx")

Open an existing composite table file

2

=A1.reset(file("D:\\e1.ctx"))

Copy the composite table to e1.ctx

3

=A1.reset@z(file("D:\\e2.ctx"))

Copy the composite table as a segmented file

4

=A1.reset@c(file("D:\\e3.ctx"))

Copy the composite table as a file stored by column

5

=A1.reset@u(file("D:\\e4.ctx"))

Copy the composite table as an unsegmented file

6

=A1.reset()

Clear test1.ctx and re-create index for it

7

=A1.reset@r(file("D:\\e5.ctx"))

Copy the composite table as a file stored by row

8

=file("D:\\test6.ctx")

An encrypted composite table, whose write password is !@*123

9

=A1.reset(file("D:\\test7.ctx"),"!@*123","11":"12")

Copy the encrypted composite table file test6 into test7.ctx; the new write password is 11 and the new read password is 12

10

=file("D:\\emp12.ctx")

 

11

=A10.create()

Create a composite table file; below is the base table:

12

=create(EID,NAME).record([4,"Emily"])

13

=A11.delete(A12)

Delete A12’s record from the composite table

14

=A11.close()

Close the composite table

15

=A10.reset@q()

A quick reset of the composite table file

16

=A1.reset(file("D:\\e6.ctx"))

With @n option, the function generates an empty same-structure composite table file

17

=file(["D:\\emp10.ctx","D:\\emp13.ctx"])

A file group

18

=A17.reset@m(file(["D:\\empp3.ctx","D:\\empp4.ctx"]))

With @m option, the function combines all files into the first file and empty the other files

 

T.reset()[1249][1250]

Description:

Clear the members of a table sequence.

Syntax:

T.reset()

Note:

The function clears members from table sequence T, but reserves the data structure.

Parameters:

T

A table sequence

Return value:

The empty table sequence T.

Example:

 

A

 

1

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

2

=A1.reset()

result[1251][1252]

Here’s how to use result() function.

ch.result()[1253][1254]

Description:

Get result of an operation performed in a channel.

Syntax:

ch.result()

Note:

The function gets from channel ch the result of performing an operation.

Parameters:

ch

Channel

Return value:

Channel

Example:

 

A

 

1

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

 

2

=channel()

Create a channel

3

=A2.select(ORDERID>100)

Attach ch.select() operation to A2’s channel

4

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in the channel

5

=A1.push(A2)

Push data in A1’s sequence into A2’s channel

6

=A2.result()

Get result from the channel

return xi[1255][1256]

Description:

Return the result xi,…. of executing a routine or a subroutine. Then the main program will terminate the execution to free up the resource.

Syntax:

return xi

Note:

With return, program will return the result xi. The program will by default return the last calculation cell value if no return/end statement appears when it is executed.Generally speaking, the returned result is a table sequence, a pure record sequence, or a cursor. Table sequence and pure record sequence are used as the esProc data set for a report, and cursor is used for the parallel program.

Example:

 

A

 

1

=file("D://abc.txt")

 

2

=A1.cursor()

Get a cursor with retrieved data

3

return A2

A3 returns the cursor in A2. When using this esProc file in a parallel program, only the cursor created on the basis of binary file object sequence will be returned for the use in main program.

rgb()[1257][1258]

Description:

Convert the red, green, blue, and transparency values to the corresponding color value.

Syntax:

rgb( redIntExp, greenIntExp, blueIntExp{, alphaIntExp} )

Note:

The value of redIntExp, greenIntExp, blueIntExp, alphaIntExp should be between 0-255.

Parameters:

redIntExp

The integer expression indicating the red, of which the value is between 0-255

greenIntExp

The integer expression indicating the green, of which the value is between 0-255

blueIntExp

The integer expression indicating the blue, of which the value is between 0-255

alphaIntExp

The integer expression indicating the transparency, of which the value is between 0-255. The 0 represents total transparency and the 255 indicates total opaqueness. The other values respectively represent various levels of transparency . The default value is 255.

Return value:

A 64-bit long integer

Example:

rgb(123,123,123)

-8684677

rgb(123,123,123,123)

2071690107

rgb(123,123,123,255)

-8684677

rgb(123,123,123,0)

8092539

right()[1259][1260]

Description:

Get a substring of a string ending at the rightmost side.

Syntax:

right(s,n)

Note:

Get the substring with the length of n ending at the rightmost side of string s. If n<0, the substring’s length is the sum of source string’s length and the value of n.

Parameters:

s

Source string from which you get the substring

n

The length of the substring

Return value:

String

Example:

right("abced",2)

"ed"

right("abced",-2)

"ced"

Related functions:

left()

mid()

rollback()[1261][1262]

Here’s how to use rollback() function.

db.rollback()[1263][1264]

Description:

Roll back a database transaction.

Syntax:

db.rollback (spn)

Note:

The function rolls back the transaction to the specified savepoint. Rollback all transactions when the parameter is omitted.

Parameters:

db

Database connection

spn

Savepoint name

Example:

 

A

B

 

1

=file("D://files//student.txt")

 

2

=A1.import@t()

 

3

=connect@e("demo")

Establish a connection and automatically control the commit and rollback operations

4

>A3.execute@k(A2,"update STUDENTS2 set NAME=?,GENDER=?,AGE=? where ID=?",NAME,GENDER,AGE,ID)

The transaction is not committed

5

=A3.error()

 

Get the error code generated from the execution of the previous SQL statement

6

if A5==0

>A3.commit()

Commit if there is not an error

7

else

>A3.rollback()

Roll back if there is an error

8

>A3.close()

 

Close the connection

Related functions:

db.close()

db.error()

db.commit()

connect()

f.rollback()[1265][1266]

Description:

Restore a composite table file to the previous state when update error happens.

Syntax:

f.rollback()

Restore the unencrypted composite table file

f.rollback(p)

Restore the encrypted composite table file; parameter p is the write password

Note:

The function restores a composite table file’s entity table to the previous state when an error happens during adding, deleting, and modifying data.

Parameters:

f

A composite table file

p

Write password

Return value:

Boolean

Example:

 

A

 

1

=file("D:/ckv.ctx")

There is an eror about ckv.ctx in executing T.update(P), so error is reported when f.create() is used: Error about ckv.ctx, call f.rollback() to restore.

2

=A1.rollback()

Restore composite table file ckv.ctx to the state before update is performed

3

=file("D:/ckv1.ctx")

Same as A1

4

=A2.rollback("!@#123")

Restore the encrypted composite table file ckv1.ctx to the state before update is performed

 

round()[1267][1268]

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.

Parameters:

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 functions:

ceil()

floor()

row()[1269][1270]

Here’s how to use row() function.

k.row()[1271][1272]

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.

Parameters:

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

=A4.keys(ORDERID,SELLERID)

Set multiple keys

6

=[1,17].row(A4)

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

Related functions:

A.find()

k.row()[1273][1274]

Description:

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

Syntax:

k.row(T)

Note:

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

Parameters:

k

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

T

A memory table

Return value:

A record

Example:

 

A

 

1

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

Return a cursor

2

=A1.memory()

Return a memory table

3

=A2.keys(EID)

Set EID as 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 memory table

6

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

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

run()[1275][1276]

Here’s how to use run() function.

r.run(xi,…)[1277][1278]

Description:

Compute an expression against a record and return the modified record.

Syntax:

r.run(xi,…)

Note:

The function computes the expression x against record r and return the modified record. Usually it is used to change the field values of r, for example, when x is col1=col2+1, it will change the field value of col1.

Parameters:

r

A record

xi

An expression, which is generally a field name or a legal expression composed of field names, and in which "~" references the current record.

Return value:

The modified record.

Example:

 

A

 

1

=[[12,23]].new(~(1):col1,~(2):col2)

 

2

=A1(1).run(col1=col2+1)

3

=A1(1).run(col1=col2+1,col2=col1+col2)

Note:

Difference between r.(x) and r.run(x): r.(x) computes the value of expression x and returns it; r.run(x) modifies r through the computation of x, and returns the modified r.

Related functions:

A.run(x1,x2,…xi)

P.run(xi:Fi,…)

P.run(xi:Fi,…)[1279][1280]

Description:

Compute expressions against each member of a record sequence.

Syntax:

P.run(xi:Fi,…)

Note:

The function computes expression xi for each record in record sequence/table sequence P, assign the results to Fi field and return P that has been modified. The expression xi uses "~" to reference the current member of P.

Parameters:

P

A record sequence/table sequence

xi

The new value of Fi field

Fi

A field of A

Return value:

The table sequence P that has been modified

Example:

 

A

 

1

=demo.query("select DEPT,NAME,BIRTHDAY from EMPLOYEE")

2

=A1.derive(age(BIRTHDAY):Age)

3

=A2.run(Age+10:Age)

Related functions:

r.run()

A.run(x1,x2,…xi)

A.run(x1,x2,…xi)[1281][1282]

Description:

Compute one or more expressions against each member in a sequence/record sequence and return a sequence composed of values of the expression.

Syntax:

A.run(x)

Compute one expression only.

A.run(x1,x2,…xi)

Compute multiple expressions.

Note:

The function computes expressions xi with each member in sequence/record sequence A and return the modified A. For example, when x is col1=col2+1, it will change the field value of col1. "~" in x is used to reference the current member in A.

Parameters:

A

A sequence/ record sequence.

x

An expression, which is generally a field name or a legal expression that is composed of field names, and in which "~" is used to reference the current record.

Options:

    @m  Use parallel algorithm to handle data-intensive or computation-intensive tasks; no definite order for the records in the result set.

Return value:

The modified sequence/record sequence A

Example:

        Use run function to modify the member values.

 

A

 

1

=[1,2,3,4,5]

 

2

=A1.run(~=~*~)

[1,4,9,16,25], use "~" to reference the current member.

Use run function to switch from EID to Name

 

A

 

1

=demo.query("select * from EMPLOYEE").keys(EID)

 

2

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

3

=A2.run(MANAGER=A1.select@1(EID==A2.MANAGER).NAME)

4

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

 

 

5

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

 

 

6

=A5.run@m(MANAGER=A4.select@1(EID==A5.MANAGER).NAME)

 

Use @m option to increase performance of big data handling.

 

Use run function to link tables

 

A

 

1

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

 

2

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

 

3

=A2.run(MANAGER=A1.select@1(EID== A2.MANAGER))

4

=A2.MANAGER.STATE

California. When the field value is a record, the dot operator is used to reference a member within the record.

Note:

Difference between A.(x) and A.run(x):

A.(x) evaluates expression x and returns a sequence composed of the values of this expression;

A.run(x) is modifies sequence/record sequence A through the computation of x and returns A which has been modified

Related functions:

r.run()

P.run(xi:Fi,…)

ch.run()[1283][1284]

Description:

Compute an expression against each of the records in a channel and return the channel with new field values.

Syntax:

ch.run (xi:Fi,…)

Note:

The function computes expression xi against each of the records in channel ch, assigns the results to Fi field and returns the original channel with new field values.  This is an attached computation.

Parameters:

ch

Channel

xi

New values of Fi field

Fi

Field name in the given channel

Return value:

Channel

Example:

 

A

 

1

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

 

2

=channel()

Create a channel

3

=A2.run(SALARY+1000:SALARY)

Attach a ch.run() operation to A2’s channel to evaluate the expression SALARY+1000, and return the original channel with the new field values

4

=A2.fetch()

Attach ch.fetch() function that get the final result set to A2’s channel to fetch and store the existing data in the channel

5

=A1.push(A2)

Push data in A1’s sequence into A2’s channel

6

=A2.result()

cs.run()[1285][1286]

Description:

Compute one or more expressions against each of the records in a cursor.

Syntax:

cs.run (xi:Fi,…)

Note:

The function computes expression xi over each record in the cursor, assigns each result to Fi field, and returns the modified cursor cs. It supports multicursors.

Parameters:

cs

Cursor

xi

An expression

Fi

A field of cs

Return value:

        The modified original cursor

Example:

 

A

 

1

=connect("demo").cursor("select * from EMPLOYEE")

 

2

=A1.run(SALARY+1000:SALARY)

 

3

=A2.fetch()

4

=connect("demo").cursor("select DEPT,NAME,BIRTHDAY,1 as AGE from EMPLOYEE")

 

5

=A4.run(age(BIRTHDAY):AGE)

 

6

=A5.run(AGE-20:AGE)

 

7

=A6.fetch()

Related functions:

A.run(xi:Fi,…)

rvs()[1287][1288]

Here’s how to use rvs() function.

A.rvs()[1289][1290]

Description:

Generate a new sequence by reversing the members in a sequence.

Syntax:

A.rvs()

Note:

The function generates a new sequence by reversing the members in sequence A to make the last member the first member, and second-to-last one the second one, and so forth.

Parameters:

A

A sequence

Return value:

The reversed sequence A

Example:

 

A

 

1

=[1,2,3,4].rvs()

[4,3,2,1]

2

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

3

=A2.rvs()

Related functions:

A.psort()

A.sort()

A.swap(p,q)

sap_client ()[1291][1292]

Description:

Connect to an SAP server.

Syntax:

sap_client@f(filename)

sap_client@f(filename:charset)

sap_client@f(FileObject) 

sap_client(user, passwd, hostname, sysnc, client, lang)

Note:

This external library function creates a connection to an SAP server.

Parameters:

filename

Connection configuration file

charset

Character set of the connection configuration file

fileObject

Connection configuration file object handle

user

SAP user name

passwd

SAP password

hostname

SAP server’s IP

sysnc

System number

client

Client number

lang

Language

Return value:

SAP connection handle

Example:

 

A

 

1

=sap_client@f ("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

2

=sap_client@f("C:/sap/ABAP_AS_WITH_POOL.jcoDestination":"UTF-8")

SAP server connection

3

=file("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

 

4

=sap_client@f(A3)

Connect to an SAP server

via configuration file handle

5

=sap_client("TEST","UN513031","192.168.0.188","00","000",”E")

SAP server connection

sap_close()[1293][1294]

Description:

Exit an SAP server connection.

Syntax:

sap_close(client)

Note:

This external library function closes the connection to an SAP server.

Parameters:

client

SAP connection file handle

Example:

 

A

 

1

=sap_client@f ("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

2

=sap_close(A1)

Exit the SAP server connection

sap_cursor ()[1295][1296]

Description:

Return the list of table-valued result set as a cursor.

Syntax:

sap_ cursor (client,functionName,tableName)

Note:

This external library function returns the list of table-valued result set as a cursor.

Parameters:

client

SAP server connection handle

functionName

The to-be-called function

tableName

Table name

Return value:

A list table cursor

Example:

 

A

 

1

=sap_client@f ("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

2

=sap_cursor(A1, "Z_TEST1","IT_ROOM")

Return the table-valued list as a cursor

3

=A2.fetch(n)

Fetch n rows of data from the table-valued list

sap_execute ()[1297][1298]

Description:

Get a function object according to the import parameter(s).

Syntax:

sap_execute(client,functionName[, paramName:ParamValue,.....])

Note:

This external library function specified by parameter functionName can have no parameter, or one or multiple parameters. The number of function parameters is dertermined by the number of import or export statements for implementing the sap function; the function parameter part will be omitted if there are no such statements.

Parameters:

client

SAP server connection handle

functionName

The to-be-called function

paramName

Function parameter name

paramValue

Function parameter value

Return value:

A function object

Example:

 

A

 

1

=sap_client@f("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

2

=sap_execute(A1, "Z_TEST1","ROOMID":"001")

Execute the specified function that has an import

parameter

sap_getparam ()[1299][1300]

Description:

Get data records according to the import parameter(s).

Syntax:

sap_getparam(excutefunction, paramName)

Note:

With a to-be-executed function that has parameters, this external library function gets data records according to the import parameter(s).

Parameters:

excutefunction

The execute function handle

paramName

Function parameter name

Return value:

Data records

Example:

 

A

 

1

=sap_client@f ("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

 

2

=sap_execute(A1, "Z_TEST1",”ROOMID”:”001”)

Execut the sap function

3

=sap_getparam(A2,"RETURN")

 

sap_table ()[1301][1302]

Description:

Return a list according to the import table-valued parameter.

Syntax:

sap_table(excutefunction, tableName)

Note:

This external library function returns a list according to the import table-valued parameter.

Parameters:

excutefunction

The execute function handle

tableName

Table name

Return value:

Table-valued list

Example:

 

A

 

1

=sap_client@f ("C:/sap/ABAP_AS_WITH_POOL.jcoDestination")

SAP server connection

2

=sap_execute(A1, "Z_TEST1")

Execute the sap_function that hasn’t parameters

3

=sap_table(A2, "IT_ROOM")

Return a table-valued list

savepoint()[1303][1304]

Here’s how to use savepoint() function.

db.savepoint()[1305][1306]

Description:

Set the savepoint to which you can later rollback.

Syntax:

db.savepoint(spn)

Note:

The function creates a savepoint named spn. The name must not be omitted and repeated

Parameters:

db

Database connection

spn

Savepoint name

Return value:

   Boolean

Example:

 

A

 

1

=connect("demo")

 

2

=A1.savepoint("num1")

Set a savepoint named "num1"

 

second()[1307][1308]

Description:

Get the second from a specified datetime value.

Syntax:

second(datetimeExp)

Note:

The function gets the second from the datetime value datetimeExp.

Parameters:

datetimeExp

Expression whose result is a datetime vlaue

Return value:

An integer

Example:

second(datetime("19800227","yyyyMMdd"))

0

second("1972-11-08 10:20:30")

30

second(datetime("2006-01-15 13:20:45"))

45

Related functions:

year()

month()

day()       

hour()

minute()

millisecond()

 

segp()[1309][1310]

Description:

Return the member in a sequence corresponding to a certain interval number.

Syntax:

A.segp(x,y)

Note:

The expression finds the interval number where parameter y falls in ordered sequence A and returns the member matching the interval number. By default the intervals between members of the sequence are left-closed and right-open. Expression parameter x is calculated over each member of sequence A.

If parameter y isn’t a member of sequence A, return null if members of the sequence are ordered ascendingly and if y is less than the smallest member, or if members of the sequence are ordered descendingly and if y is greater than the largest member. The function will return the largest member value if members of the sequence are ordered ascendingly and if parameter y is greater than and equal to the largest member value; or return the smallest member value if members of the sequence are ordered descendingly and if parameter y is less than and equal to the smallest member value.

Parameters:

A

A sequence

x

A field expression or a legal expression made up of field names, in which “~” can be used to reference the current record and which can be absent

y

An expression

Options:

@r

Use left-open and right-closed intervals

Return value:

A member of the specified sequence

Example:

       

A

 

1

[2,22,122,222,2222]

 

2

=A1.segp(1)

Return null

3

=A1.segp(100)

22; the intervals between members of the sequence are [2,22), [22,122),

[122,222), [222,2222) and [2222,∞); 100 falls in interval [22,122), the second interval, so the function returns the second member

4

=A1.segp(3000)

2222

5

=A1.segp(~+~,200)

22

6

=A1.segp(~+~,244)

122

7

=A1.segp@r(~+~,244)

22; left-open and right-closed intervals with@r option

select()[1311][1312]

Here’s how to use select() function.

A.select()[1313][1314]

Description:

Return members of a sequence which satisfy a condition.

Syntax:

A.select(x)

 

A.select(x1:y1, x2:y2, ......xi:yi)

The simplified syntax of multiple-condition query using "&&", which is equal to A.select(x1== y1 && x2== y2 &&...... xi==yi). In the case of the multiple-condition query with @b option, cmp() is not needed and you can just write A.select@b(x1:y1, x2:y2, ......xi:yi)

 

Note:

The function computes expression x against each member of the sequence A, and returns a new sequence composed of those members which make x return true.When there are no parameters, return all the members. If the name of a to-be-referenced column of the sequence is the same as a cell name, the sequence name should be attached before the column name in the expression.

Parameters:

A

A sequence.

x

A boolean expression, which may be null. when using @b option, x should be an expression whose return value is a number.

xi:yi

xi is an expression, and yi is a comparing value.

Options:

@1

Return the first member that fulfills the condition.

@z

Search the members from back to front

@b

Use binary search when A is an ordered sequence. If A is not an ordered one, then this option should not be used, or it may bring about the incorrect result. When the option works with A.select(x1:y1, x2:y2, ......xi:yi) to find out members that make x in cmp(x,y) return the value 0, you can just write A.select@b(x1:y1, x2:y2, ......xi:yi) without cmp().

@m

Use parallel algorithm to handle data-intensive or computation-intensive tasks; no definite order for the records in the result set; it can’t be used with @1bz options.

Return value:

A new sequence composed of members which make the expression x return true

Example:

 

A

 

1

[2,5,4,3,2,1,4,1,3]

 

2

=A1.select(~>3)

[5,4,4]

3

=A1.select@1(~>3)

[5]

4

=A1.select@z(~>3)

[4,4,5]

5

=[1,2,3,4,5,6].select@b(~-4)

[4]

6

=demo.query("select * from EMPLOYEE order by EID")

 

7

=A6.select(EID==9)

 

8

=A6.select@b(EID-9)

The expression x needs to be converted to a number with @b.

9

=A6.select(EID:9)

 

10

=A6.select@b(EID:9)

It’s no need to execute the conversion by using the colon when @b exists.

11

=A6.select()

Return all members as there are no parameters.

12

=A6.select@m(EID==9)

Use @m option to increase performance of big data handling.

13

=to(3).new(~:ID,~*~:A1)

14

=A13.select(A13.A1==4)

.Related functions:

A.pselect()

 

T.select()[1315][1316]

Description:

Return members of a table sequence/memory table which satisfy a condition.

Syntax:

T.select(x)

 

Note:

The function computes expression x against each member of table sequence/memory table T, and returns a new table sequence/memory table composed of those members which make x return true

Options:

@i

Reuse T’s index, which may disrupt the order of the result set

Parameters:

T

A table sequence/memory table

x

Filtering expression; can be null

Return value:

A table sequence/memory table

Example:

 

A

 

1

=demo.query("select * from DEPT").keys@i(DEPTID)

Create an index

2

=A1.select@i(FATHER:12)

Reuse A1’s index

ch.select()[1317][1318]

Description:

Return a channel with records that meet the given condition.

Syntax:

ch.select(x)

Note:

The function attaches a filtering operation to a channel and then returns it. It calculates expression x against each of the records in channel ch, and returns the channel containing records that make values of x true. When the parameter x is omitted, return the original channel with all records. This is an attached computation.

Parameters:

ch

Channel

x

Boolean expression

Return value:

        The original channel with records that meet the given condition

Example:

 

A

 

1

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

 

2

=channel()

Create a channel

3

=A2.select(ORDERID>100)

Attach a ch.select() operation to A2’s channel to get records meeting the condition ORDERID>100 and return the channel with these eligible records

4

=A2.fetch()

Fetch and store the existing data in the channel

5

=A1.push(A2)

Push data in A1’s sequence into A2’s channel

6

=A2.result()

Get result from the channel

ch.select(x,ch’)[1319][1320]

Description:

Send records in a channel that can’t meet the given condition into another channel.

Syntax:

ch.select(x,ch’)

Note:

The function calculates expression x against each of the records in channel ch, and sends those records over which the value of x is false into channel ch’.

Parameters:

ch

Channel

x

A boolean expression

ch’

Channel

Return value:

        Channel ch’

Example:

 

A

 

1

=demo.cursor("select EID,NAME,SALARY from EMPLOYEE " )

 

2

=channel()

Create a channel

3

=channel()

Create a channel

4

=A1.push(A2)

Push data in A1’s cursor into A2’s channel

5

=A2.select(EID<5,A3)

Push records in A2’s channel that can’t meet the condition EID<5 into A3’s channel

6

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data in A2’s channel

7

=A3.fetch()

Attach ch.fetch() function that gets the final result set to A3’s channel to fetch and store the existing data in A3’s channel

8

=A1.skip()

 

9

=A2.result()

10

=A3.result()

cs.select()[1321][1322]

Description:

Return a cursor with records meeting the given condition.

Syntax:

cs.select(x)

Note:

The function calculates expression x against each of the records in cursor cs and returns a cursor containing records that can make the value of x true. When parameter x is omitted, return the original cursor with all records. The function supports multicursors.

Parameters:

cs

A cursor

x

A boolean value

Return value:

        The original cursor with eligible records

Example:

 

A

 

1

=demo.cursor("select * from SCORES")

 

2

=A1.select(STUDENTID>10)

Select the records where STUDENTID is greater than 10 from the SCORE table

3

=A2.fetch()

cs.select(x,ch’)[1323][1324]

Description:

Send records in a cursor that can’t meet the given condition into a channel.

Syntax:

cs.select(x,ch’)

Note:

The function calculates expression x against each of the records in cursor cs, and sends those records over which the value of x is false into channel ch’.

Parameters:

cs

Cursor

x

A boolean value

ch’

Channel

Return value:

        Channel ch’

Example:

 

A

 

1

=demo.cursor("select EID,NAME,SALARY from EMPLOYEE" )

 

2

=channel()

Create a channel

3

=A1.select(EID<5,A2)

Push records that don’t meet the condition EID<5 into A2’s channel

4

=A2.fetch()

Fetch and store the existing data in the channel

5

=A1.fetch()

6

=A2.result()

Get result from the channel

cs.select(x;f)[1325][1326]

Description:

Write the records that unsatisfy the specified expression into a bin file.

Syntax:

cs.select(x;f)

Note:

The function computes expression x over each record of cursor cs and writes the records that unsatisfy expression x into the bin file f.

Parameters:

cs

Cursor

x

Boolean expression

f

bin file

Return value:

       The original cursor

Example:

 

A

 

1

=demo.cursor("select * from dept")

 

2

=file("dept.btx")

 

3

=A1.select(DEPTID<5;A2)

Write the records that cannot meet the condition DEPTID<5 into bin file dept.btx

4

=A3.fetch()

 

seq()[1327][1328]

Description:

An interative loop for numbering records in which a certain field contains same values.

Syntax:

seq(Gi,…)

Note:

The function performs a loop operation to number records with the same Gi field value from 1. As the value of field changes, number the records from 1 again.

Parameters:

Gi

Field name

Options:

@n

The option can increase the numbering efficiency, but can only be used when the specified expression returns a positive integer; support using sequence numbers

Return value:

Cursor

Example:

 

A

 

1

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

 

2

=A1.derive(seq(CLASS):F1)

3

=A1.derive(seq(CLASS,STUDENTID):F1)

Note

shift()[1329][1330]

Here’s how to use shift() function.

shift()[1331][1332]

Description:

Perform a shift operation.

Syntax:

shift(x,s)

Note:

Shift left if s<0; shift right if s>0.

Parameters:

x

The expression based on which you perform the shift operation

s

An integer

Options:

@s

When shifting right, shift a sign into the leftmost position and shif a zero to this position by default

Return value:

An integer

Example:

shift(13,2)

3

A.shift()[1333][1334]

Description:

Get a shuffled sequence.

Syntax:

A.shift(i,s)

Note:

The function traverses members of sequence A. During the traversal, if the sequence number of the current member is greater than or equal to parameter i and, at the same time, less than or equal to [A.len()-s], return the sth member after the current one; otherwise, return the current member. A.len() is the length of sequence A. If the sum of i and s is greater than A.len(), the sequence won’t be shuffled.

Parameters:

i

The starting position, which is a positive integer; 1 is the default value

s

The offset value, which is a positive integer; 1 is the default value

Return value:

A sequence

Example:

 

A

 

1

[1,2,3,4,5,6,7,8,9,10]

 

2

=A1.shift(4,3)

3

=to(10).new(~:id,~*~:value)

 

4

=A3.shift(3,2)

Before shifting:

After shifting:

sign()[1335][1336]

Description:

Judge whether the parameter is a positive number, a negative number or 0.

Syntax:

sign(number)

Note:

If number is a positive value, return 1; If it is a negative value, return -1; If it is 0, return 0.

Parameters:

number

Data for which you want to judge whether it is positive or negative

Return value:

Integer

Example:

sign(-10)

-1

sign(30)

1

sign(0)

0

sin()[1337][1338]

Description:

Compute the sine value.

Syntax:

sin(number)

Note:

The parameter number is in radians.

Parameters:

number

Radians for which you want to compute the sine

Return value:

float type

Example:

sin(pi())

1.2246467991473532E-16

sin(pi(2))

-2.4492935982947064E-16

sin(pi()/2)

1.0

Related functions:

cos()

tan()

sinh()[1339][1340]

Description:

Return the hyperbolic sine.

Syntax:

sinh(number)

Note:

The parameter number is any real number.

Parameters:

number

The real number for which you want to find the hyperbolic sine

Return value:

The hyperbolic sine

Example:

sinh(1)

1.1752011936438014

size()[1341][1342]

Here’s how to use size() function.

f.size()[1343][1344]

Description:

Get the length of a file.

Syntax:

f.size()

Note:

The function gets the size of the file f and returns the number of bytes.

Parameters:

f

A file

Return value:

   A number

Example:

 

A

 

1

=file("E://student.dfx").size()

Export”11195

Related functions:

f.exists()

f.date()

movefile()

sizeof()[1345][1346]

Description:

Calculate the memory space an object occupies.

Syntax:

sizeof(x)

Note:

The function calculates the memory space an object occupies. The unit of the returned value is byte (B). Start esProc designer under installation directory\esProc\bin\ startup.bat directory to execute the function; the start of JVM will need loading proxy class.

Parameters:

x

An object

Return value:

A numeric value

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE order by STATE")

Return a cursor object

2

=sizeof(A1)

Calculate the memory space the cursor object occupies

 

skip()[1347][1348]

Here’s how to use skip() function.

cs.skip()[1349][1350]

Description:

Skip records while fetching records from a database cursor.

Syntax:

cs.skip(n;x)

Note:

The function skips n records or till x… has changed, and returns the number of records actually skipped. If all parameters are absent, return the number of remaining records and close the cursor.

Parameters:

cs

A cursor

n

An integer

x

Grouping expression, by which cs is sorted. With x, n will be ignored.

Return value:

        Number of records skipped

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE order by STATE")

Return a cursor for retrieving data, sorted by STATE

2

=A1.skip(50;STATE)

Ignore parameter n as parameter x is present. Till the STATE has changed. The number of records actually skipped is 4

3

=A1.fetch()

Return the remaining records in the cursor

4

=demo.cursor("select * from EMPLOYEE order by STATE")

 

5

=A4.skip()

As the parameters are not supplied, scan the data once by skipping 500 records

Related functions:

cs.fetch()

db.cursor()

 

sleep()[1351][1352]

Description:

Make esProc program sleep.

Syntax:

sleep(n)

Note:

The function makes esProc program sleep for n milliseconds.

Parameters:

n

Millisecond

Example:

sleep(10000)

Suspend esProc program for 10000 millisecond before resuming execution

sort()[1353][1354]

Here’s how to use sort() function.

A.sort()[1355][1356]

Description:

Generate a new sequence by sorting the members of a sequence.

Syntax:

A.sort( x;loc)

A.sort(xi,..... ;loc)

Note:

The function generates a new sequence by sorting the members of sequence A according to expression x and in the order of the language loc. If omitting loc, then sort them by comparing their unicode values.

Parameters:

A

A sequence

x

An expression, according to which the members of sequence A will be sorted ascendingly.

xi

An expression, which is a member of sequence A and which will be sorted in ascending order. If there are multiple expressions, they can be written as a compound expression in the form of xi,.., which will be sorted sequentially in ascending order by default. Perform the sort in descending order with -xi, and sort sequence A itself if xi is omitted.

loc

Language name

 

Values for loc:

ja_JP

Japanese

Japan

es_PE

Spanish

Peru

en

English

 

ja_JP_JP

Japanese

Japan

es_PA

Spanish

Panama

sr_BA

Serbian

Bosnia and Herzegovina

mk

Macedonian

 

es_GT

Spanish

Guatemala

ar_AE

Arabic

United Arab Emirates

no_NO

Norwegian

Norway

sq_AL

Albanian

Albania

bg

Bulgarian

 

ar_IQ

Arabic

Iraq

ar_YE

Arabic

Yemen

hu

Hungarian

 

pt_PT

Portuguese

Portugal

el_CY

Greek

Cyprus

ar_QA

Arabic

Qatar

mk_MK

Macedonian

Macedonia

sv

Swedish

 

de_CH

German

Switzerland

en_US

English

United States

fi_FI

Finnish

Finland

is

Icelandic

 

cs

Czech     

 

en_MT

English

Malta

sl_SI

Slovenian

Slovenia

sk_SK

Slovak

Slovakia

it

Italian

 

tr_TR

Turkish

Turkey

zh

Chinese

 

th

Thai

 

ar_SA

Arabic

Saudi Arabia

no

Norwegian

 

en_GB

English

United Kingdom

sr_CS

Serbian

Serbia and Montenegro

lt

Lithuanian

 

ro

Romanian

 

en_NZ

English

New Zealand

no_NO_NY

Norwegian Norway

Nynorsk

lt_LT

Lithuanian

Lithuania

es_NI

Spanish

Nicaragua

nl

Dutch     

 

ga_IE

Irish

Ireland

fr_BE

French

Belgium

es_ES

Spanish

Spain

ar_LB

Arabic

Lebanon

ko

Korean

 

fr_CA

French

Canada

et_EE

Estonian

Estonia

ar_KW

Arabic

Kuwait

sr_RS

Serbian

Serbia

es_US

Spanish

United States

es_MX

Spanish

Mexico

ar_SD

Arabic

Sudan

in_ID

Indonesian

Indonesia

ru

Russian

 

lv

Latvian

 

es_UY

Spanish

Uruguay

lv_LV

Latvian

Latvia

iw

Hebrew

 

pt_BR

Portuguese

Brazil

ar_SY

Arabic

Syria

hr

Croatian

 

et

Estonian

 

es_DO

Spanish

Dominican Republic

fr_CH

French

Switzerland

hi_IN

Hindi

India

es_VE

Spanish

Venezuela

ar_BH

Arabic

Bahrain

en_PH

English

Philippines

ar_TN

Arabic

Tunisia

fi

Finnish

 

de_AT

German

Austria

es

Spanish

 

nl_NL

Dutch

Netherlands

es_EC

Spanish

Ecuador

zh_TW

Chinese

Taiwan

ar_JO

Arabic

Jordan

be

Belarusian

 

is_IS

Icelandic

Iceland

es_CO

Spanish

Colombia

es_CR

Spanish

Costa Rica

es_CL

Spanish

Chile

ar_EG

Arabic

Egypt

en_ZA

English

South Africa

th_TH

Thai

Thailand

el_GR

Greek

Greece

it_IT

Italian

Italy

ca

Catalan

 

hu_HU

Hungarian

Hungary

fr

French

 

en_IE

English

Ireland

uk_UA

Ukrainian

Ukraine

pl_PL

Polish

Poland

fr_LU

French

Luxembourg

nl_BE

Dutch

Belgium

en_IN

English

India

ca_ES

Catalan

Spain

ar_MA

Arabic

Morocco

es_BO

Spanish

Bolivia

en_AU

English

Australia

sr

Serbian

 

zh_SG

Chinese

Singapore

pt

Portuguese

 

uk

Ukrainian

 

es_SV

Spanish

El Salvador

ru_RU

Russian

Russia

ko_KR

Korean

South Korea

vi

Vietnamese

 

ar_DZ

Arabic

Algeria

vi_VN

Vietnamese

Vietnam

sr_ME

Serbian

Montenegro

sq

Albanian

 

ar_LY

Arabic

Libya

ar

Arabic

 

zh_CN

Chinese

China

be_BY

Belarusian

Belarus

zh_HK

Chinese

Hong Kong

ja

Japanese

 

iw_IL

Hebrew

Israel

bg_BG

Bulgarian

Bulgaria

in

Indonesian

 

mt_MT

Maltese

Malta

es_PY

Spanish

Paraguay

sl

Slovenian

 

fr_FR

French

France

cs_CZ

Czech

Czech Republic

it_CH

Italian

Switzerland

ro_RO

Romanian

Romania

es_PR

Spanish

Puerto Rico

en_CA

English

Canada

de_DE

German

Germany

ga

Irish

 

de_LU

German

Luxembourg

de

German

 

es_AR

Spanish

Argentina

sk

Slovak

 

ms_MY

Malay

Malaysia

hr_HR

Croatian

Croatia

en_SG

English

Singapore

da

Danish

 

mt

Maltese

 

pl

Polish

 

ar_OM

Arabic

Oman

tr

Turkish

 

th_TH_TH

Thai

Thailand  TH

el

Greek

 

ms

Malay

 

sv_SE

Swedish

Sweden

da_DK

Danish

Denmark

es_HN

Spanish

Honduras

Options:

@u

Create multi-level sorting based on specified fields and according to the original order in which records first appear.

@m

Use parallel algorithm to enhance performance to handle data-intensive and computation-intensive tasks.

@z

Sorting in descending order

@n

The option can increase the numbering efficiency, but can only be used when the specified expression returns a positive integer; support using sequence numbers

@0

Put a null-value member or ecords with null values at the end

Return value:

A sorted sequence

Example:

 

A

 

1

=[2,1,3,8,6,5]

 

2

=A1.sort()

[1,2,3,5,6,8]

3

=["s","e","a","d"].sort(;"en")

[a,d,e,s]

Sort the sequence by the English language specified by “en”

4

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

 

5

=A4.sort(DEPT,-BIRTHDAY)

First sort the sequence by DEPT in ascending order, and then sort it by BIRTHDAY in descending order.

6

=file("D:/txt/test1.txt").import@t()

 

 

7

=A6.sort@u(f1,f2,f3)

Create multi-level soting according to the fields f1, f2 and f3 in the original order.

8

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

 

9

=A8.sort@m(DEPT,-BIRTHDAY)

Use @m option to increase performance of big data handling.

10

=A1.sort@z()

[8,6,5,3,2,1]

11

=[2,1,3,,8,6,5]

 

12

=A11.sort()

[null,1,2,3,5,6,8]

13

=A12.sort@0()

[1,2,3,5,6,8,null]

Related functions:

A.psort()

A.swap(p,q)

A.rvs()

sortx()[1357][1358]

Here’s how to use sortx() function.

ch.sortx()[1359][1360]

Description:

Sort records in a channel.

Syntax:

ch.sortx(x,…)

Note:

The function sorts records in channel ch by expression x,… and returns the sorted records as a channel. This is a function for directly getting a result set from the channel.

Parameters:

ch

Channel

x

An expression, according to which the records in a given channel is sorted in acending order

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,NAME,DEPT,SALARY from EMPLOYEE order by EID desc")

Return a cursor with desired records

2

=channel()

Create a channel

3

=A2.sortx(SALARY,EID)

Sort records in the channel by SALARY field and EID field

4

=A1.push(A2)

Push data in A1’s cursor into the channel

5

=A1.fetch()

Fetch data from A1’s cursor

6

=A2.result()

Return result as a cursor

7

=A6.fetch()

cs.sortx()[1361][1362]

Description:

Sort data of a cursor.

Syntax:

cs.sortx(x,…;n)

 

Note:

The function sorts cursor cs by expression x, and returns result as a cursor.

Parameters:

cs

A cursor

x

An expression to sort members of cursor cs in ascending order

n

Number of buffer rows; its value will be n times of the default if it is less than 1; by default esProc will uto-compute the value

Options:

   @0   Put records with null values at the end; @0 and @n can’t work together.

@n

It can only be used to make the calculation faster when the value of expression x is a positive integer. In this case, parameter n is treated as a grouping expression over which group of records can be directly numbered. For each group, records will be sorted in the memory. @0 and @n can’t work together.

Return value:

        A cursor

Example:

 

A

 

1

=demo.cursor("select NAME,BIRTHDAY,HIREDATE from Employee")

Return retrieved data as a cursor

2

=A1.sortx(BIRTHDAY)

Sort the cursor’s BIRTHDAY field

3

=A2.fetch()

Retrieve data from cursor A2

4

=demo.cursor("select * from DEPT")

Return retrieved data as a cursor

5

=A4.sortx@0(FATHER).fetch()

Sort records in the cursor by FATHER field and put the one with null value at the end

 Related functions:

cs.fetch()

db.cursor()

 

cs.sortx()[1363][1364]

Description:

Sort a cluster cursor.

Syntax:

cs.sortx(x,…;n)

 

Note:

The function sorts cluster cursor cs by expression x and returns a clustrer cursor.

Options:

@c

Won’t merge result sets returned by the nodes but return a cluster cursor segmented in the same way

Parameters:

cs

A cluster cursor

x

An expression by which records in a specified cluster cursor are sorted in ascending order

 

n

Number of buffer rows

Return value:

A cluster cursor

Example:

 

A

 

1

[192.168.0.110:8281,192.168.18.143:8281]

 

2

=file@0("emp.ctx", A1)

emp.ctx is a distributed composite table file

3

=A2.create()

Open a cluster composite table file

4

=A3.cursor()

Return a cluster cursor

5

=A4.sortx(EID)

Sort A4’s cluster cursor by EID and return result also as a cluster cursor

spark_client()[1365][1366]

Description:

Create a Spark database connection.

Syntax:

spark_client(hdfsUrl,thriftUrl,dbname)

Note:

This external library function connects to a Spark database.The format of the parameter hdfsUrl is hdfs://ip:port, which represents the HDFS file’s IP and port number. The format of the parameter thriftUrl is thrift://ip:port, which represents the Thrift file’s IP and port number. The parameter dbname is database name.

Parameters:

hdfsUrl

HDFS file connection information

thriftUrl

Thrift file connection information

dbname

A database name.

Return value:

Database connection

Example:

 

A

 

1

=spark_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","aa")

Connect to the spark database

Related functions:

spark_close()

spark_cursor()

spark_query()

spark_close()[1367][1368]

Description:

Close a Spark database connection.

Syntax:

spark_close()

Note:

This external library function closes connection to a Spark database.

Example:

 

A

 

1

=spark_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","aa")

 

2

=spark_close()

Close connection to the spark database

Related functions:

spark_client()

spark_cursor()

spark_query()

spark_cursor()[1369][1370]

Description:

Query a Spark database, and return the result as a cursor.

Syntax:

spark_cursor(con,sql)

Note:

    This external library function executes a SQL query on a Spark database and returns the result as a cursor. The parameter con is database connection.

Parameters:

con

Database connection string.

sql

A SQL query statement, like select * from table.

Return value:

Cursor

Example:

 

A

 

1

spark_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","aa")

Connect to the spark database

2

=spark_cursor(A1,"select * from tablename")

 

3

=spark_close()

 

Related functions:

spark_close()

spark_client()

spark_query()

spark_query()[1371][1372]

Description:

Query a Spark database, and return the result as a sequence.

Syntax:

spark_query(con,sql)

Note:

This external library function executes a certain SQL query on a Spark database, and returns the query result as a table sequence. The parameter con represents database connection.

Parameter:

con

Database connection string.

sql

A SQL query statement, like select * from table.

Return value:

Table sequence

Example:

 

A

 

1

=spark_client("hdfs://192.168.0.8:9000","thrift://192.168.0.8:9083","aa")

Connect to the spark database

2

=spark_query(A1,"select * from tablename")

 

3

=spark_close()

 

Related functions:

spark_close()

spark_cursor()

spark_client()

split()[1373][1374]

Here’s how to use split() function.

s.split()[1375][1376]

Description:

Split a string into a sequence using the delimiter.

Syntax:

s.split(d)

Note:

The function splits string s with delimiter d to form a sequence and returns it.

Parameters:

s

A string to be splitted

d

The delimiter; support splitting a string into multiple characters; if omitted, split the string into a sequence of single characters.

Options:

@p

Parse members into corresponding data types after the splitting. That is to say, numbers shall be handled as numeric values, members enclosed by [] shall be recognized as sequences, dates like 2001-01-01 shall be treated as date type data, and so on. The parsing of the sign [] also involves the same handling of a sub-sequence. Parentheses matching will be handled.

@1

Split string into two parts by the first d found.

@b

Won’t handle quotation marks matching and parentheses matching.

@t

Perform trim operation to remove blank characters from both ends of each string member, and split the original string according to continuous blank characters when d is omitted.

@c

Split the string using the comma.

@r

Treat parameter d as a regular expression

Return value:

A sequence of strings

Example:

 

A

 

1

="1,[a,b],(2,c),'5,6'"

2

=A1.split@c()

 

Comma is used to split the string

3

=A1.split@c1()

Split the string according to the first dilimiter

4

=A1.split@cb()

Use comma as the delimiter and won’t handle quotation marks matching and parentheses matching

5

="a:b:c".split(":")

Use colon as the dilimiter

6

=A1.split@cp()

Use comma as the delimiter and parse each split member into its proper data type

7

="1,[a,b],(2,c),    abc     ,'5,6'".split@ct()

Remove blank characters from both ends of "abc"

8

="1,[a,b],(2,c),    abc     ,'5,6'".split@t()

Split the string according to continuous blank characters since d is omitted

9

=A1.split()

Split the string into a sequence of single characters since d is omitted

10

="a:;b:;c".split(":;")

["a","b","c"]

11

="a1b2c".split@r("(\\d)")

sqlparse()[1377][1378]

Description:

Split a SQL query into a sequence.

Syntax:

sql.sqlparse(part)

Note:

The function splits away each statement/clause in a SQL query to generate and returns a sequence. Members of the sequence are ordered like this: SELECT statement, FROM clause (including the JOIN), WHERE clause, GROUP BY statement, HAVING clause and ORDER BY statement. If there is a part parameter, use it to replace the corresponding syntax unit in the original SQL query and return a new SQL.

Parameters:

sql

A SQL query

part

A SQL string for replacing a statement/clause in the original SQL query; need to work with a certain option

Options:

@s

SELECT statement

@f

FROM clause, including the JOIN

@w

WHERE clause

@g

GROUP BY statement

@h

HAVING clause

@o

ORDER BY statement

@a

Split each statement/clause into smaller parts; separate WHERE and HAVING clauses according to AND

Return value:

A sequence or a SQL query

Example:

       

A

 

1

select emp.EID,emp.NAME,emp.BIRTHDAY,emp.SALARY,dep.DEPT,dep.MANAGER

from EMPLOYEE emp

left join DEPARTMENT dep

on emp.DEPT=dep.DEPT

where emp.EID<100 and  dep.DEPT='R&D'

order by  emp.SALARY ,emp.EID

 

2

=A1.sqlparse()

Split each statement/clause away from a SQL query to create a sequence; by default the returned syntax units include SELECT statement, FROM clause, WHERE clause, GROUP BY statement, HAVING clause and ORDER BY statement; return a non-SQL syntax unit as null

3

=A1.sqlparse@s()

Split a SQL query to return its SELECT part

4

=A1.sqlparse@f()

Split a SQL query to return its FROM part

5

=A1.sqlparse@w()

Split a SQL query to return its WHERE part

6

=A1.sqlparse@o()

Split a SQL query to return its ORDER BY part

7

=A1.sqlparse@a()

Re-split a syntax part if it contains multiple syntax units

8

SELECT  STUDENTID,sum(SCORE)  FROM SCORES group by studentid  having sum(score)>460

 

9

=A8.sqlparse@g()

Split a SQL query to return its GROUP BY part

10

=A8.sqlparse@h()

Split a SQL query to return its HAVING part

11

select * from dept

 

12

=A11.sqlparse()

13

=A11.sqlparse@s("deptid")

Replace the SELECT part: * with parameter part: deptid

14

=A11.sqlparse@f("sales")

 

Replace the SELECT part: dept with parameter part: sales

15

select  EID,NAME,GENDER  from ( select * from EMPLOYEE where salary>10000)

Use the SQL string of the subquery in the FROM clause

16

=A15.sqlparse()

17

SELECT P.LastName, P.FirstName, O.OrderNo

FROM Persons P

INNER JOIN Orders O

ON P.Id_P = O.Id_P

ORDER BY P.LastName

 

18

=A17.sqlparse()

The FROM clause contains a JOIN

sqltranslate()[1379][1380]

Description:

Translate standard SQL functions into functions a specified database defines.

Syntax:

sql.sqltranslate(dbtype)

Note:

The function translates standard SQL functions into functions a specified database defines. esProc supports translation into these databases (followed by their numbers):

ORACLE:1

SQLSVR:2

DB2:9

MYSQL:10

HSQL:13

TERADATA:14                 

POSTGRES:15

Standard SQL functions and corresponding functions defined in certain databases:

String functions

Standard SQL functions

Description

oracle

sql server

db2

mysql

teradata

hsql

PostgresSQL

LOWER(str)

Convert into lower case

 

 

 

 

 

 

 

UPPER(str)

Convert into upper case

 

 

 

 

 

 

 

LTRIM(str)

Delete whitespaces on the leftmost side

 

 

 

 

 

 

 

RTRIM(str)

Delete whitespaces on the rightmost side

 

 

 

 

 

 

 

TRIM(str)

Delete whitespaces on both sides

TRIM(str)

LTRIM(RTRIM(str))

LTRIM(RTRIM(str))

TRIM(str)

TRIM(str)

 

LTRIM(RTRIM(str))

SUBSTR(str,start,len)
SUBSTR(str,start)

Return a substring

SUBSTR(str,start,len)
SUBSTR(str,start)

SUBSTRING(str,start,len)
SUBSTRING(str,start,len(str)-start+1)

SUBSTR(str,start,len)
SUBSTR(str,start)

SUBSTR(str,start,len)
SUBSTR(str,start)

SUBSTR(str,start,len)
SUBSTR(str,start)

SUBSTR(str,start,len)
SUBSTR(str,start)

SUBSTR(str,start,len)
SUBSTR(str,start)

LEN(str)

Return the length of a string

LENGTH(str)

LEN(str)

LENGTH(str)

LENGTH(str)

CHAR_LENGTH(str)

CHAR_LENGTH(str)

CHAR_LENGTH(str)

INDEXOF(sub,str[,start])

Return the position of a substring

INSTR(str,sub[,start])

CHARINDEX(sub,str[,start])

LOCATE(sub,str[,start])

LOCATE(sub,str[,start])

INDEX(str,sub)
Return n/a if there are 3 parameters

LOCATE(sub,str[,start])

INDEX(str,sub)
Return n/a if there are 3 parameters

LEFT(str,len)

Return the substring in the left of a specified string

SUBSTR(str,1,len)

LEFT(str,len)

LEFT(str,len)

LEFT(str,len)

SUBSTR(str,1,len)

LEFT(str,len)

SUBSTR(str,1,len)

RIGHT(str,len)

Return the substring in the right of a specified string

CASE WHEN len=0 THEN '' WHEN LENGTH(str)>len THEN SUBSTR(str,-len) ELSE str END

RIGHT(str,len)

RIGHT(str,len)

RIGHT(str,len)

CASE WHEN len=0 then '' WHEN CHAR_LENGTH(str)>len THEN SUBSTR(str,CHAR_LENGTH(str)-len,len) ELSE str END

RIGHT(str,len)

CASE WHEN len=0 then '' WHEN CHAR_LENGTH(str)>len THEN SUBSTR(str,CHAR_LENGTH(str)-len,len) ELSE str END

CONCAT(str1,str2)

Concatenate two strings

CONCAT(str1,str2)

str1+str2

CONCAT(str1,str2)

CONCAT(str1,str2)

str1||str2

str1||str2

str1||str2

REPLACE(str,sub,rplc)

Replace a substring by another string

 

 

 

 

OREPLACE(str,sub,rplc)

 

 

Numeric functions

Standard functions

Description

oracle

sql server

db2

mysql

teradata

hsql

PostgresSQL

ABS(x)

Return absolute value

 

 

 

 

 

 

 

ACOS(x)

Return arc cosine

 

 

 

 

 

 

 

ASIN(x)

Return arc sine

 

 

 

 

 

 

 

ATAN(x)

Return arc tangent

 

 

 

 

 

 

 

ATAN2(x,y)

Return arc tangent

ATAN2(x,y)

ATN2(x,y)

ATAN2(x,y)

ATAN2(x,y)

 

 

 

CEIL(x)

Return the smallest integer that is not less than x

CEIL(x)

CEILING(x)

CEIL(x)/CEILING(x)

CEIL(x)/CEILING(x)

CEIL(x)

 

CEIL(x)

COS(x)

Return cosine value

 

 

 

 

 

 

 

EXP(x)

Return the base of e to the power of x

 

 

 

 

 

 

 

FLOOR(x)

Return the biggest integer that not greater than x

 

 

 

 

 

 

 

LN(x)

Return the natural logarithm

LN(x)

LOG(x)

LN(x)/LOG(x)

LN(x)/LOG(x)

LN(x)

 

 

LOG10(x)

Return the logarithm with base 10

LOG(10,x)

LOG10(x)

LOG10(x)

LOG10(x)

LOG(x)

LOG10(x)

LOG(x)

MOD(x,m)

Return the remainder of x divided by m

MOD(x,m)

x%m

MOD(x,m)

x%m

x MOD m

 

x%m

POWER(x,y)

Return the value of x raised to the power of y

 

 

 

 

 

 

 

ROUND(x,n)

Return x rounded to n digits from the decimal point

 

 

 

 

 

 

 

SIGN(x)

Return the sign for x

 

 

 

 

 

 

 

SIN(x)

Return the sine value

 

 

 

 

 

 

 

SQRT(x)

Return the square root of x

 

 

 

 

 

 

 

TAN(x)

Return the tangent value

 

 

 

 

 

 

 

TRUNC(x,n)

Return x truncated to n decimal places

TRUNC(x,n)

CONVERT(BIGINT,x*POWER(10,n))/POWER(10.0,n)

TRUNC(x,n)

TRUNCATE(x,n)

TRUNC(x,n)

 

 

RAND(seed)

Return a random number

DBMS_RANDOM.VALUE(0, seed)
//Return random numbers between 0 and seed

RAND(seed)// Return a random number between 0 and 1

RAND(seed)// Return a random number between 0 and 1

RAND(seed)

RANDOM(0,seed)
// Return a random integer between 0 an seed

RAND(seed)
//Return a random number between 0 and 1

RANDOM()

 

Date functions

Standard functions

Description

oracle

sql server

db2

mysql

teradata

hsql

PostgresSQL

YEAR(d)

Return the year

EXTRACT(YEAR FROM d)

YEAR(d)

YEAR(d)

YEAR(d)

EXTRACT(YEAR FROM d)/TD_YEAR_OF_CALENDAR(d)

YEAR(d)

EXTRACT(YEAR FROM d)

MONTH(d)

Return the month

EXTRACT(MONTH FROM d)

MONTH(d)

MONTH(d)

MONTH(d)

EXTRACT(MONTH FROM d)/TD_MONTH_OF_YEAR(d)

MONTH(d)

EXTRACT(MONTH FROM d)

DAY(d)

Return the day of the month

EXTRACT(DAY FROM d)

DAY(d)

DAY(d)

DAY(d)

EXTRACT(DAY FROM d)/TD_DAY_OF_MONTH(d)

DAY(d)

EXTRACT(DAY FROM d)

HOUR(d)

Return the hour

EXTRACT(HOUR FROM d)

DATEPART(HH, d)

HOUR(d)

HOUR(d)

EXTRACT(HOUR FROM d)

HOUR(d)

EXTRACT(HOUR FROM d)

MINUTE(d)

Return the minute from d

EXTRACT(MINUTE FROM d)

DATEPART(MI,d)

MINUTE(d)

MINUTE(d)

EXTRACT(MINUTE FROM d)

MINUTE(d)

EXTRACT(MINUTE FROM d)

SECOND(d)

Return the second

EXTRACT(SECOND FROM d)

DATEPART(SS,d)

SECOND(d)

SECOND(d)

CAST(EXTRACT(SECOND FROM d) AS INT)

SECOND(d)

EXTRACT(SECOND FROM d)

QUARTER(d)

Return the quarter from d

FLOOR((EXTRACT(MONTH FROM d)+2)/3)

DATEPART(QQ,d)

QUARTER(d)

QUARTER(d)

TD_QUARTER_OF_YEAR(d)

QUARTER(d)

EXTRACT(QUARTER FROM d)

TODAY()

Return the date

SYSDATE

GETDATE()
/CONVERT(DATETIME,CONVERT(CHAR, GETDATE(),101),101)//Remove the hour, minute and second

CURRENT DATE

CURDATE()

DATE

TODAY

CURRENT_DATE

NOW()

Return the current time

SYSTIMESTAMP

GETDATE()/CURRENT_TIMESTAMP

CURRENT TIMESTAMP

NOW()

CURRENT_TIMESTAMP

NOW

NOW()

ADDYEARS(d,n)

Add years

d+NUMTOYMINTERVAL(n,'YEAR')

DATEADD(YY,n,d)

d+n YEARS

d+INTERVAL n YEAR

ADD_MONTHS(d, n*12)

DATEADD('yy', n, d)/d+n YEAR

 

ADDMONTHS(d, n)

Add months

d+NUMTOYMINTERVAL(n,'MONTH')

DATEADD(MM,n,d)

d+n MONTHS

d+INTERVAL n MONTH

ADD_MONTHS(d, n)

DATEADD('mm', n, d)/d+n MONTH

 

ADDDAYS(d, n)

Add days

d+NUMTODSINTERVAL(n,'DAY')

DATEADD(DD,n,d)

d+n DAYS

d+INTERVAL n DAY

d+CAST(n AS INTERVAL DAY)

DATEADD('dd', n, d)/d+n DAY

 

ADDHOURS(d, n)

Add hours

d+NUMTODSINTERVAL(n,'HOUR')

DATEADD(HH,n,d)

d+n HOURS

d+INTERVAL n HOUR

d+CAST(n AS INTERVAL HOUR)

DATEADD('hh', n, d)/d+n HOUR

 

ADDMINUTES(d, n)

Add minutes

d+NUMTODSINTERVAL(n,'MINUTE')

DATEADD(MI,n,d)

d+n MINUTES

d+INTERVAL n MINUTE

d+CAST(n AS INTERVAL MINUTE)

DATEADD('mi', n, d)/d+n MINUTE

 

ADDSECONDS(d, n)

Add seconds

d+NUMTODSINTERVAL(n,'SECOND')

DATEADD(SS,n,d)

d+n SECONDS

d+INTERVAL n SECOND

d+CAST(n AS INTERVAL SECOND)

DATEADD('ss', n, d)/d+n SECOND

 

DAYOFYEAR(d)

Return the day of year

TO_NUMBER(TO_CHAR(d,'DDD'))

DATEPART(DY,d)

DAYOFYEAR(d)

DAYOFYEAR(d)

TD_DAY_OF_YEAR(d)

DAYOFYEAR(d)

EXTRACT(DOY FROM d)

WEEKOFYEAR(d)

Return the calendar week of the date

TO_NUMBER(TO_CHAR(d,'WW'))

DATEPART(WW,d)

WEEK(d)

WEEK(d)

TD_WEEK_OF_YEAR(d)

WEEK(d)

EXTRACT(WEEK FROM d)

 

Conversion functions

Standard functions

Description

oracle

sql server

db2

mysql

teradata

hsql

PostgresSQL

ASCII(str)

Return numeric value of left-most character

 

 

 

 

 

 

 

CHR(n)

Return the chracter for integer n

CHR(n)

CHAR(n)

CHR(n)

CHAR(n)

 

CHAR(n)

 

INT(x)

Return an integer for string or number x

CAST(x AS INT)

CAST(x AS INT)

INT(x)

CAST(x AS SIGNED)

CAST(x AS INT)

CAST(x AS INT)

 

DECIMAL(x,len,scale)

Return the numeric value for a string or number

CAST(x AS DECIMAL(len,scale))

CAST(x AS DECIMAL(len,scale))

DECIMAL(x,len,scale)

CAST(x AS DECIMAL(len,scale))

CAST(x AS DECIAML(len,scale))

CAST(x AS DECIAML(len,scale))

 

TIMESTAMP(str)

Convert the format string of yyyy-mm-dd hh24:mi:ss into datetime

TO_DATE(str,'YYYY-MM-DD HH24:MI:SS')

CONVERT(DATETIME,str,120)

TO_DATE(str,'YYYY-MM-DD HH24:MI:SS')

TIMESTAMP(str)

TO_TIMESTAMP(str,'YYYY-MM-DD HH24:MI:SS')

TIMESTAMP(str)

 

NUMTOCHAR(d)

Return a string for number d

TO_CHAR(d)

CAST(d AS VARCHAR)

CHAR(d)

CAST(d AS CHAR)

TO_CHAR(d)

CONVERT(d, SQL_VARCHAR)

CAST(d AS TEXT)

DATETOCHAR(date)

Convert date into a string in the format of  yyyy-mm-dd hh24:mi:ss

TO_CHAR(date,'YYYY-MM-DD HH24:MI:SS')

CONVERT(CHAR,date,120)

TO_CHAR(date,'YYYY-MM-DD HH:MI:SS')

DATE_FORMAT(d,
 '%Y-%m-%d %H:%i:%S)

TO_CHAR(d,'YYYY-MM-DD HH24:MI:SS')

TO_CHAR(d, 'YYYY-MM-DD HH24:MI:SS')

TO_CHAR(d,'YYYY-MM-DD HH24:MI:SS')

CAST(x, y)

Convert x to data type y (note: y can’t be written as ?)

CAST(x as y)

CAST(x as y)

CAST(x as y)

CAST(x as y)

CAST(x as y)

CAST(x as y)

 

NULLIF(x1,x2)

Return null if x1=x2, otherwise return x1

 

 

 

 

 

 

 

DATE(str)

Convert the format string of yyyy-mm-dd into a date

TO_DATE(DATES,'YYYY-MM-DD')

CONVERT(varchar(100), DATES, 23)

DATE(DATES)

DATE_FORMAT(DATES,'%Y-%m-%d')

CAST(DATES AS DATE FORMAT 'YYYY-MM-DD')

 

 

Other functions

Standard functions

Description

oracle

sql server

db2

mysql

teradata

hsql

PostgresSQL

CASE(when1,then1,

…[,else])

Return the corresponding then part if when is true, otherwise return the else part

CASE WHEN when1 THEN then1 … ELSE else END

CASE WHEN when1 THEN then1 … ELSE else END

CASE WHEN when1 THEN then1 … ELSE else END

CASE WHEN when1 THEN then1 … ELSE else END

 

CASE WHEN when1 THEN then1 … ELSE else END

 

COALESCE(x1,…)

Return the first non-null parameter

 

 

 

 

 

 

 

CONCAT(s1,s2,…)

Concatenate multiple strings

s1||s2||…

s1+s2+…

s1||s2||…

CONCAT(s1,s2,…)

s1||s2||…

s1||s2||…

s1||s2||…

 

Parameters:

sql

A SQL statement

dbtype

Database type

Return value:

A SQL statement

Example:

       

A

 

1

SELECT ID,WEEKOFYEAR(DATES),CUSTOMER,AREA FROM CLUE

Use a standard SQL function

WEEKOFYEAR(d) : Find the calendar week of the year

2

=A1.sqltranslate("ORACLE")

Return the following SQL statement:

SELECT ID,TO_NUMBER(TO_CHAR(DATES,'WW')),CUSTOMER,AREA FROM CLUE

 

3

=A1.sqltranslate("SQLSVR")

Return the following SQL statement:

SELECT ID,DATEPART(WW,DATES),CUSTOMER,AREA FROM CLUE

4

=A1.sqltranslate("DB2")

Return the following SQL statement:

SELECT ID,WEEK(DATES),CUSTOMER,AREA FROM CLUE

5

=A1.sqltranslate("MYSQL")

Return the following SQL statement:

SELECT ID,WEEK(DATES),CUSTOMER,AREA FROM CLUE

6

=A1.sqltranslate("HSQL")

Return the following SQL statement:

SELECT ID,WEEK(DATES),CUSTOMER,AREA FROM CLUE

7

=A1.sqltranslate("TERADATA")

Return the following SQL statement:

SELECT ID,TD_WEEK_OF_YEAR(DATES),CUSTOMER,AREA FROM CLUE

8

=A1.sqltranslate("POSTGRES")

Return the following SQL statement:

SELECT ID,EXTRACT(WEEK FROM DATES),CUSTOMER,AREA FROM CLUE

 

SQL+[1381][1382]

Description:

Based on SQL-92, SQL+ syntax adds a series of special-purpose identifiers to widen its data query skills.

A SQL+ query is like a familiar SQL statement. Yet while SQL statements handle database tables, SQL+ queries only manipulate bin files with btx extension, composite files with ctx extension and their memorized tables. They don’t support processing data from other sources.

There are two work modes for SQL+: Translate and Execute. The Translate mode translates SQL+ syntax into the scripting language SPL using the embedded tool on esProc main screen; the Execute mode runs a query to get the result set through JDBC or ODBC call.

General syntax:

first( F order by …)

Get the first of sorted records; can be used in GROUP BY as an aggregate function; get a record randomly if there isn’t ORDER BY.

last( F order by …)

Get the last of sorted records; can be used in GROUP BY as an aggregate function; get a record randomly if there isn’t ORDER BY.

median(F)

Calculate the median.

in

Conditional query.

exists

Check if a query returns data.

select

Can be used in a subquery.

where rownum=1

Get the first row.

where F=(select max(F) …)

Conditional query.

decode

Convert a query result to another data type.

/*+external*/ T

Identifier /*+external*/ indicates that file T can’t be wholly stored in the memory but it needs to be directly processed or via the cursor; without it T is a memory table.

/*+big*/ group by

Big data grouping which returns a cursor; doesn’t apply to a memory table.

group by

A common grouping operation without a special identifier.

/*+group*/ in

Perform grouping first when IN condition involves a join.

/*+group*/ exists

Perform grouping first when EXISTS condition involves a join.

/*+var(v)*/(…)

Define variable v.

(…)/*+var(v)*/

Ignore the content enclosed by the parentheses when using variable v; the variable can be defined once and then repeatedly used, or left unused.

[arg]

Compose an argument

Joins:

/*+primary*/ join

A join of homo-dimension tables or main table and sub table. Each table must be ordered by their associative field; otherwise the joining result set will be wrong. With a composite associative field, sort the table by the field order in the SQL statement. Use /*+ORDER*/ identifier to pre-sort data if necessary.

/*+foreign*/ join

A foreign-key-type join, where key values of the right table must be unique (The primary key constraint). The right table’s associative field must be ordered when it is an external table. With a composite associative field, sort the table by the field order in the SQL statement.

/*+foreign(fk)*/ join

A prejoin of two memory tables via foreigh key fk using A.join@k. A SQL+ statement references the joining result set directly. This prejoin can be automatically identified in OLAP mode.

/*+switch*/ join

A switch-type prejoin of two memory tables using A.switch. A SQL+ statement references the joining result set directly. This prejoin can be automatically identified in OLAP mode.

join  on

A common table join. There’s no requirement that data be ordered by associative fields when the right table in a full join connected by AND is a memory table. Both the left table and the right table must be ordered by the associative fields when the right table is an external table; otherwise the joining result set will be wrong. With a composite associative field, sort the table by the field order in the SQL statement. Use /*+ORDER*/ identifier to pre-sort data if necessary. There’s no restriction on order when tables are connected by OR or when it is a non-equi-join (You’d better not use these JOINs because they are very slow).

right join

A switch-over of positions of the two tables enables a left join.

External tables (BTX files & CTX files) and memory tables (table sequences):

1. Read a CTX file or a BTX file following FROM or JOIN into the memory when /*+EXTERNAL*/ identifier is absent. The identifier is useless when it works with a table sequence variable, which includes one generated from an intermediate calculation (such as GROUP BY) (as a table sequence result is preffered).

2. If there is /*+EXTERNAL*/ identifier in a subquery following FROM or JOIN, read a table file in the subquery into the memory. If there is such an identifier outside of the subquery, read the subquery’s cursor-type result set into the memory.

3. A GROUP BY operation returns a cursor if the to-be-grouped object is an external table and /*+BIG*/ identifier is present; a non-cursor result will be stored in the memory by default. The result set of a LIMIT operation that retrieves only part of the data is stored in the memory, too.

Without /*+ORDERED*/ identifier, tables in a merge operation (UNION, INTERSECT, MINUS) will all be imported in the memory. Any operation that minimizes the result set (such as whole-set aggregate and an operation where the filtering condition is equivalent to FALSE) will also be imported in the memory.

4. For a subquery in a SELECT statement or a WHERE clause and one following an EXISTS or IN condition: If the result is a constant, it can’t be stored in external memory. If the result (and the result of the main query) isn’t a constant, it can’t be stored in external memory when /*+PRIMARY*/ identifier is absent; but it can when the /*+PRIMARY*/ identifier is present.

5. A JOIN where one of the involved tables is an external table returns a cursor. One where all involved tables are memory tables returns a table sequence.

6. For a JOIN of composite tables (files with .ctx extension), it is the relationship of the primary key and the associated filed that determines whether we join them by the primary key or by the foreign key.

 

Parallel processing:

/*+parallel (n) */ T

This identifier enables a parallel retrieval of an external file (i.e. a multicursor), but does not apply to a table sequence. It applies to a bin file that is generated through @z.

You’d better not use the identifier with a JOIN.

If you really need to speed up a JOIN by using this identifier to retrieve an external file, first translate a SQL+ statement into an SPL query and then adjust SPL for your specific case. For example, joinx needs a synchronous segmentation if it uses a multicursor; and xjoinx forbids a parallel retrieval.

 

Subqueries that return non-constant results:

/*+group*/

By default, when the main query and the subquery are associated through a foreign key, values of the subquery’s associative field must be unique (Primary key constraint). But EXISTS condition and IN condition allow duplicates among associative field values (non-primary-key-constraint) theoretically, then you can use /*+GROUP*/ identifier to put primary key constraint on the subquery’s associative field values.

/*+var(v)*/

In a query where there are multiple same subqueries (whose names are v), this identifier enables the reuse of one subquery result in SPL to reduce the amount of computational work (The working range is within the main query). A subquery must be able to be wholly stored in the memory to be reusable. The actual order of executing subqueries could be different from the defined order but the result will be the same. The identifier applies to a subquery whose result is a constant.

ROWNUM = 1

About the keyword ROWNUM, SQL+ supports ROWNUM = 1 only. Make sure each record of a subquery makes same result (No distinct value in the result set) before using ROWNUM=1 in the subquery.

/*+PRIMARY*/

This identifier means that the main query and the subquery have the relationship of the main table and the sub table or two homo-dimension tables. Its SPL counterpart handles them with joinx(). It requires that both the main query and the subquery are ordered by associative fields when the subquery result can’t be wholly stored in the memory. It doesn’t require an order by the associative fields when the subquery can be completely stored in the memory. By default the main query and the subquery are associated through the foreign key and the SPL counterpart handles them with T.find(), with the requirement that the subquery should all be imported into the memory and that its associative field values must be unique (Primary key constraint).

 

Ordered data sets:

/*+ordered*/

This identifier enables handling data by order (positions) to considerably speed up computation. Do not confuse it with the sorting identifier /*+ORDER*/.

/*+ordered*/ group

Order-based grouping. It requires that to-be-handled data should be ordered by grouping expression (GROUP BY). When there are multiple grouping expressions, sort data by their order.

/*+ordered*/ distinct

Order-baed distinct. It requires that to-be-handled data should be ordered by query expression (SELECT expression). When there are multiple grouping expressions, sort data by their order.

count(/*+ordered*/ distinct)

Order-based distinct count. It requires that to-be-handled data should be ordered by the expression over which COUNT is performed.

/*+ordered*/  union

Order-based union. It requires that each of the same-structure tables to be handled should be ordered by the original field order. Can handle external tables.

/*+ordered*/  intersect

Order-based intersect. It requires that each of the same-structure tables to be handled should be ordered by the original field order. Can handle external tables.

/*+ordered*/  minus

Order-based minus. It requires that each of the same-structure tables to be handled should be ordered by the original field order. Can handle external tables.

 

Optimization:

where /*+cursor*/ (…) and …

Add the condition in parentheses when creating the cursor. The syntax only applies to an external table with ctx extension. It forces an advance execution of the conditional filtering defined in WHERE (conditions must be connected by AND; OR isn’t allowed). One /*+CURSOR*/ covers one filtering condition (a filtering condition works within an AND operator or until the end of a clause). Multiple conditions for one cursor need to be enclosed by parentheses.

where /*+index*/

Index-based filtering. The syntax only applies to an external table with ctx extension. Make sure an eligible index file has been there for the ctx file.

group by …,/*+redundant*/…

The syntax indicates that the grouping expression after /*+REDUNDANT*/ is redundant (which means you can get same result only with grouping field before it). In the actual execution, the redundant grouping expression is useless and the program gets the field value of a random record in the current group to list).

 

Note:

1. Sometimes ORACLE treats string data and numerical data equally and allows an automatical switch-over between them (Such as string0and number 0). But they are strictly different in SQL+. Be careful with the SQL+ syntax when performing data check.

2. In ORACLE, an empty string represented by ‘’ is equivalent to NULL, but they are not in SQL+. Be careful with the SQL+ syntax when performing data check.

3. SQL+ supports translation of non-table data. Translated field names will be the ones that appear for the first time in the original data. Make sure the cases are correct and consistent.

4. SPL is case-sensitive. SQL+ Translate mode equalizes uppercase and lowercase in field names and table names, but it can’t equally treat string constants in uppercase and lowercase (except for LIKE). Make sure the case in string constants are correct and consistent.

Example:

       Note: The following are examples of a SQL+ statement and its corresponding SPL script

 

select GENDER,first(NAME order by SALARY) from emp.btx group by GENDER

 

 

A

1

=file("D:/emp.btx").cursor@b(GENDER,SALARY,NAME).fetch()

2

=A1.groups(GENDER:GENDER;top@1(1,SALARY,NAME):_2)

 

select last(NAME order by SALARY) from emp.ctx

 

 

A

1

=file("D:/emp.ctx").create().cursor(SALARY,NAME).fetch()

2

=A1.groups(;top@1(-1,SALARY,NAME):_1)

 

        select median(SALARY) from emp.btx where EID<10

 

 

A

1

=file("D:/emp.btx").cursor@b(SALARY,EID).fetch()

2

=A1.select(EID<10&&EID!=null)

3

=A2.groups(;median(,SALARY):_1)

 

select median(SALARY) from emp.ctx where EID<10

 

 

A

1

=file("D:/emp.ctx").create().cursor(SALARY,EID;EID<10&&EID!=null).fetch()

2

=A1.groups(;median(,SALARY):_1)

 

select e.NAME, e.GENDER, d.DEPT, d.MANAGER from emp.btx e join Dep.btx d on d.DEPT = e.DEPT and d.MANAGER =4

 

 

A

1

=file("D:/emp.btx").cursor@b(DEPT,NAME,GENDER).fetch()

2

=file("D:/Dep.btx").cursor@b(DEPT,MANAGER).fetch()

3

=join(A1:L,DEPT,4;A2:R,DEPT,MANAGER)

4

>$2=A3.new(L.DEPT:e_DEPT,L.NAME:e_NAME,L.GENDER:e_GENDER,R.DEPT:d_DEPT,R.MANAGER:d_MANAGER)

5

=$2.new(e_NAME:e_NAME,e_GENDER:e_GENDER,d_DEPT:d_DEPT,d_MANAGER:d_MANAGER)

 

select * from emp.btx emp where emp.DEPT in (select DEPT from Dep.btx dep where dep.manager = 5 and dep.DEPT = emp.DEPT)

                       

 

A

1

=file("D:/emp.btx").cursor@b().fetch()

2

=file("D:/Dep.btx").cursor@b(DEPT,MANAGER).fetch()

3

=A2.select(MANAGER==5&&MANAGER!=null)

4

>$9=A3.new(DEPT:$7,DEPT:DEPT)

5

>$9=if(ift($9),$9,create($7,DEPT).insert@r(0:$9))

6

>$9=$9.keys(DEPT).index()

7

>$8=A1.derive([].insert(0,$9.find(~.DEPT).(#1)):$7)

8

=$8.select($7.contain(DEPT)&&DEPT!=null)

9

=A8.new(EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY)

 

        select T1.CustomerName, T2.CityName from Customer.ctx T1 join City.ctx T2 on T1.CityID=T2.CityID where exists (select 1 from VIPCustomer.ctx where ID = T1.ID)

 

 

A

 

1

=file("D:/Customer.ctx").create().cursor(ID,CustomerName,CityID).fetch()

 

2

>$9=file("D:/VIPCustomer.ctx").create().cursor(ID).fetch()

 

3

func

 

4

 

=$9

5

 

=B4.select(ID==A3.(#1)&&ID!=null)

6

 

=B5.new(1:_1)

7

 

return B6.(#1).ifn()

8

>$7=A1.derive(func(A3,~):$6)

 

9

=$7.select($6!=null)

 

10

=A9.new(CustomerName:CustomerName,ID:ID,CityID:CityID)

 

11

=file("D:/City.ctx").create().cursor(CityID,CityName).fetch()

 

12

=join(A10:L,CityID;A11:R,CityID)

 

13

>$10=A12.new(L.CustomerName:T1_CustomerName,L.ID:T1_ID,L.CityID:T1_CityID,R.CityID:T2_CityID,R.CityName:T2_CityName)

 

14

=$10.new(T1_CustomerName:T1_CustomerName,T2_CityName:T2_CityName)

 

 

        select d.DEPT, (select count(EID) from emp.btx e where e.DEPT= d.DEPT group by DEPT) con from Dep.btx d

 

 

A

1

=file("D:/Dep.btx").cursor@b(DEPT).fetch()

2

=file("D:/emp.btx").cursor@b(EID,DEPT).fetch()

3

=A2.groups(DEPT:group_1;count(EID):count_1)

4

>$13=A3.new(count_1:$11,group_1:DEPT)

5

>$13=if(ift($13),$13,create($11,DEPT).insert@r(0:$13))

6

>$13=$13.keys(DEPT).index()

7

>$12=A1.derive($13.find(~.DEPT).(#1):$11)

8

=$12.new(DEPT:DEPT,$11:con)

 

select DEPT , MANAGER from Dep.btx where rownum =1

 

 

A

1

=file("D:/Dep.btx").cursor@b(DEPT,MANAGER).fetch()

2

=A1.to(1)

 

select * from emp.btx where salary = (select max(salary) from emp.btx)

 

 

A

1

=file("D:/emp.btx").cursor@b().fetch()

2

=A1.groups(;top(-1;SALARY):top_1).#1

 

select NAME, decode(GENDER,'2','F','1','M') from st.btx

 

 

A

1

=file("D:/st.btx").cursor@b(NAME,GENDER).fetch()

2

=A1.new(NAME:NAME,case(GENDER,"2":"F","1":"M"):_2)

 

select DEPT,sum(SALARY) from emp.btx group by DEPT

 

 

A

1

=file("D:/emp.btx").cursor@b(DEPT,SALARY).fetch()

2

=A1.groups(DEPT:DEPT;sum(SALARY):_2)

 

select * from /*+parallel (4) */ Persons_z.btx

 

A

1

=file("D:/Persons_z.btx").cursor@b().fetch()

 

select * from /*+external*/ emp.btx

 

 

A

1

=file("D:/emp.btx").cursor@b()

 

select o.OrderNo ,p.City from Orders.btx o /*+primary*/ join Persons.btx p on p.Id_P = o.Id_P

 

 

A

1

=file("D:/Orders.btx").cursor@b(OrderNo,Id_P).fetch()

2

=file("D:/Persons.btx").cursor@b(Id_P,City).fetch()

3

=join@m(A1:L,Id_P;A2:R,Id_P)

4

>$15=A3.new(L.OrderNo:o_OrderNo,L.Id_P:o_Id_P,R.Id_P:p_Id_P,R.City:p_City)

5

=$15.new(o_OrderNo:o_OrderNo,p_City:p_City)

 

select o.OrderNo ,p.City from Orders.btx o /*+foreign*/ join Persons.btx p on p.Id_P = o.Id_P

 

 

A

1

=file("D:/Orders.btx").cursor@b(OrderNo,Id_P).fetch()

2

=file("D:/Persons.btx").cursor@b(Id_P,City).fetch()

3

=if(ift(A2),A2,create(Id_P,City).insert@r(0:A2))

4

=A3.keys(Id_P).index()

5

>$16=A1.new(OrderNo:o_OrderNo,Id_P:o_Id_P).join@i(o_Id_P,A4:Id_P,Id_P:p_Id_P,City:p_City)

6

=$16.new(o_OrderNo:o_OrderNo,p_City:p_City)

 

select o.OrderNo ,p.City from o /*+foreign(fk)*/ join p on p.Id_P = o.Id_P

 

 

A

B

 

1

=file("Orders.btx").cursor@b().fetch()

=file("Persons.btx").cursor@b().fetch()

Expressions in A1, B1, A2 are edited manually

2

>o=A1.join(Id_P,B1:Id_P,~:fk)

 

3

>$2=o.new(OrderNo:o_OrderNo,Id_P:o_Id_P,fk.Id_P:p_Id_P,fk.City:p_City)

 

Queries in A3 and A4 are converted from SQL+ statements

4

=$2.new(o_OrderNo:o_OrderNo,p_City:p_City)

 

 

select o.OrderNo ,p.City from o /*+switch*/ join p on p.Id_P = o.Id_P

 

 

A

B

 

1

=file("Orders.ctx").create().cursor().fetch()

=file("Persons.ctx").create().cursor().fetch()

Expressions in A1, B1, A2 are edited manually

2

>o=A1.switch(Id_P,B1:Id_P)

 

3

>$3=o.new(OrderNo:o_OrderNo,Id_P.Id_P:o_Id_P,Id_P.Id_P:p_Id_P,Id_P.City:p_City)

 

Queries in A3 and A4 are converted from SQL+ statements

4

=$3.new(o_OrderNo:o_OrderNo,p_City:p_City)

 

 

select * from /*+external*/ emp.ctx where /*+cursor*/ (EID<10)

 

 

A

1

=file("D:/emp.ctx").create().cursor(;(EID<10)&&EID!=null)

 

select * from D:/emp_index.ctx where /*+index*/ DEPT='HR'

 

 

A

 

1

=file("D:/emp_index.ctx").create().icursor(;DEPT=="HR").fetch()

emp_index.ctx is a composite table file having an index over DEPT field

 

select GENDER,DEPT,NAME,EID from emp.btx group by GENDER,/*+redundant*/ DEPT

       

 

A

1

=file("D:/emp.btx").cursor@b(GENDER,DEPT,NAME,EID).fetch()

2

=A1.groups(GENDER:GENDER;DEPT:DEPT,NAME:NAME,EID:EID)

 

select GENDER ,avg(SALARY) from /*+external*/ emp.btx /*+big*/ group by GENDER

 

 

A

1

=file("D:/emp.btx").cursor@b(GENDER,SALARY)

2

=A1.groupx(GENDER:GENDER;avg(SALARY):_2)

 

        select /*+ordered*/ distinct DEPT from emp.btx

       

 

A

1

=file("D:/emp.btx").cursor@b(DEPT).fetch()

2

=A1.groups@o(DEPT;)

       

select count(/*+ordered*/ distinct state) from emp.btx

       

 

A

1

=file("D:/emp.btx").cursor@b(STATE).fetch()

2

=A1.groups(;iterate(ranki(STATE)):_1)

       

        select * from emp.btx emp where emp.DEPT /*+group*/ in (select DEPT from Dep.btx dep where dep.manager = 5 and dep.DEPT = emp.DEPT)

               

 

A

1

=file("D:/emp.btx").cursor@b().fetch()

2

=file("D:/Dep.btx").cursor@b(DEPT,MANAGER).fetch()

3

>$22=A3.new(DEPT:$20,DEPT:DEPT)

4

>$22=if(ift($22),$22,create($20,DEPT).insert@r(0:$22))

5

>$22=$22.group(DEPT:DEPT;~.(#1):$20).keys(DEPT).index()

6

>$21=A1.derive($22.find(~.DEPT).(#2):$20)

7

=$21.select($20.contain(DEPT)&&DEPT!=null)

8

=A8.new(EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY)

9

>$22=A3.new(DEPT:$20,DEPT:DEPT)

 

        select T1.CustomerName, T2.CityName from Customer.ctx T1 join City.ctx T2 on T1.CityID=T2.CityID where /*+group*/ exists (select 1 from VIPCustomer.ctx where ID = T1.ID)

       

 

A

B

1

=file("D:/Customer.ctx").create().cursor(ID,CustomerName,CityID).fetch()

 

2

=file("D:/VIPCustomer.ctx").create().cursor(ID).fetch()

 

3

func

 

4

 

=$26

5

 

=B4.select(ID==A3.(#1)&&ID!=null)

6

 

=B5.new(1:_1)

7

 

return B6.(#1).ifn()

8

>$24=A1.derive(func(A3,~):$23)

 

9

=$24.select($23!=null)

 

10

=A9.new(CustomerName:CustomerName,ID:ID,CityID:CityID)

 

11

=file("D:/City.ctx").create().cursor(CityID,CityName).fetch()

 

12

=join(A10:L,CityID;A11:R,CityID)

 

13

>$27=A12.new(L.CustomerName:T1_CustomerName,L.ID:T1_ID,L.CityID:T1_CityID,R.CityID:T2_CityID,R.CityName:T2_CityName)

 

14

=$27.new(T1_CustomerName:T1_CustomerName,T2_CityName:T2_CityName)

 

 

select d.DEPT, /*+var(v)*/ (select count(EID) from emp.btx e where e.DEPT= d.DEPT group by DEPT) con from Dep.btx d

 

       

A

1

=file("D:/Dep.btx").cursor@b(DEPT).fetch()

2

=file("D:/emp.btx").cursor@b(EID,DEPT).fetch()

3

=A2.groups(DEPT:group_1;count(EID):count_1)

4

>v=A3.new(count_1:$28,group_1:DEPT)

5

>v=if(ift(v),v,create($28,DEPT).insert@r(0:v))

6

>v=v.keys(DEPT).index()

7

>$29=A1.derive(v.find(~.DEPT).(#1):$28)

8

=$29.new(DEPT:DEPT,$28:con)

 

select T1.ID CustomerName, /*+var(v)*/ (select VIPLevel from VIPCustomer.ctx where ID=T1.ID) Level from Customer.ctx T1 where exists (select VIPLevel from VIPCustomer.ctx where ID=T1.ID) /*+var(v)*/

 

 

A

B

1

=file("D:/Customer.ctx").create().cursor(ID).fetch()

 

2

=file("D:/VIPCustomer.ctx").create().cursor(VIPLevel,ID).fetch()

 

3

func

 

4

 

=v

5

 

=B4.select(ID==A3.(#1)&&ID!=null)

6

 

=B5.new(VIPLevel:VIPLevel)

7

 

return B6.(#1).ifn()

8

>$32=A1.derive(func(A3,~):$30)

 

9

>$34=$32.derive(func(A3,~):$31)

 

10

=$34.select($30!=null)

 

11

=A10.new(ID:CustomerName,$31:Level)

 

 

        SELECT * FROM /*+external*/ Emp_China.btx /*+ordered*/ union SELECT * FROM /*+external*/ Emp_USA.btx

       

 

A

1

=file("D:/Emp_China.btx").cursor@b()

2

=file("D:/Emp_USA.btx").cursor@b()

3

=[A1,A2].mergex@u(E_ID,E_Name)

 

        SELECT * FROM /*+external*/ Emp_China.btx /*+ordered*/ intersect SELECT * FROM /*+external*/ Emp_USA.btx

       

 

A

1

=file("D:/Emp_China.btx").cursor@b()

2

=file("D:/Emp_USA.btx").cursor@b()

3

=[A1,A2].mergex@i(E_ID,E_Name)

 

        SELECT * FROM /*+external*/ Emp_China.ctx /*+ordered*/ minus SELECT * FROM /*+external*/ Emp_USA.ctx

 

         

A

1

=file("D:/Emp_China.ctx").create().cursor()

2

=file("D:/Emp_USA.ctx").create().cursor()

3

=[A1,A2].mergex@d(E_ID,E_Name)

 

SELECT NAME FROM emp.ctx where SALARY = [arg1]

 

          

A

1

=file("D:/emp.ctx").create().cursor(NAME,SALARY;SALARY==arg1&&SALARY!=null).fetch()

2

=A1.new(NAME:NAME)

 

 

substr()[1383][1384]

Description:

Find a substring and return the string after the substring.

Syntax:

substr(s1,s2)

Note:

The function finds string s2 in string s1 starting from the leftmost character and returns the string after s2; return null if there is nothing after s2.

Parameters:

s1

A string

s2

A string

Options:

@l

Return the string before s2; return null if there is nothing before s2

@q

Skip the quoted string

Return value:

A string

Example:

=substr("abcdef","cd")

ef

=substr@l("abcdef","cd")

ab

=substr@q("ab\'cdef\'","cd")

No return value

stax_close ()[1385][1386]

Description:

Close connection to the Cassandra database.

Syntax:

stax_close (staxClient)

Note:

The function closes connection to the Cassandra database.

Parameters:

staxClient

Cassandra database connection

Example:

 

A

 

1

=stax_connect("127.0.0.1";keyspace:"mycas")

Create a Cassandra database connection

2

= stax_close(A1)

Close the Cassandra database connection

 

stax_connect ()[1387][1388]

Description:

Create connection to the Cassandra database.

Syntax:

stax_connect(nodes[:port] [,user:pwd ][;[keyspace:xx][,compressor][,initializer])     

Note:

The username and password are not required if the Cassandra database is started under the PasswordAuthenticator mode; but required if the Cassandra database is started under the authorizer: AllowAllAuthorizer mode. The Java class specified in the parameter initializer should be a complete class path.

Parameters:

nodes

The to-be-connected database’s IP address

port

Port number; can be omitted

user:pwd

User name and password; can be omitted

keyspace:xx

The keyspace name; can be omitted

compressor

The compression algorithm; can be omitted

initializer

The Java class for client-side initialization; can be omitted

Return value:

The database connection

Example:

 

A

 

1

=stax_connect("127.0.0.1";keyspace:"mycas")

Cassandra database connection under the authorizer: AllowAllAuthorizer mode

2

=stax_connect("127.0.0.1","cassandra":"cassandra"; keyspace:"mycas")

Cassandra database connection under the PasswordAuthenticator mode

 

stax_query ()[1389][1390]

Description:

Query a Cassandra database and return the query result as a table sequence.

Syntax:

stax_query (staxClient, cql, [arg1], [arg2], ...)

Note:

The function performs the query cql over a Cassandra database and returns the query result as a table sequence. The parameter staxClient is the database connection.

Parameters:

staxClient

Database connection handle

cql

The query statement

args

Parameter values; can be omitted

Return value:

A table sequence

Example:

 

A

 

1

=stax_connect("127.0.0.1";keyspace:"mycas")

Create a Cassandra database connection

2

=stax_query(A3,"select * from mycas.user where id=?",1)

Execute query over the Cassandra database

sqrt()[1391][1392]

Description:

Find the square root of a number.

Syntax:

sqrt(x,n)

Note:

The function computes x1/n. Find the square root, which is √x, if parameter n is absent.

Parameter:

x

n

Data for which you want to find the square root

The n

Return value:

Numeric value

Example:

sqrt(100)

10.0

sqrt(99)

sqrt(16,4)

9.9498743710662

2.0

step()[1393][1394]

Here’s how to use step() function.

A.step()[1395][1396]

Description:

Create a sequence by getting members from a sequence according to the specified starting position and a step.

Syntax:

A.step(m,ki,…)

Note:

The function finds the members whose sequence numbers are ki, ki+m, ki+2m,…from A to compose a new sequence.

Parameters:

m

A positive integer used to specify the step

ki

The starting sequence number, 1<=ki. The default is 1 

A

A sequence whose length is n

Return value:

A new sequence whose length is m

Example:

 

A

 

1

[1,2,3,4,5,6,7,8,9,10]

 

2

=A1.step(2,1)

[1,3,5,7,9] Get members at the odd positions.

3

=A1.step(3,1,2)

[1,2,4,5,7,8,10] Get two every other one.

4

=A1.step(2)

Start from the first member when ki,… is absent

string()[1397][1398]

Here’s how to use string() function.

string(expression{, format})[1399][1400]

Description:

Convert the data type of an object to the string type.

Syntax:

string(expression{, format})

Note:

The function converts the data type of an object to the string type and formats the string.The format string format must match the data type of the result of expression, or the result of string(expression{, format}) will be incorrect.

Parameters:

expression

The constant object or the expression to be converted to a string.

format

A format string used to format the result of expression

Options:

@q

Enclosed the string expression in double quotes and ignore parameter format

@e

Escape the undisplayable character. Represent the tab, carriage return, line break in the string expression with the escape characters. Add an escape character before the single quotes, double quotes or an escape character if there is any in the string. Ignore parameter format

@u

With the use of @e option, if there is a character of large charaset in the string expression, convert the character to a Unicode character

Return value:

String

Example:

 

A

 

1

=string(123)

123

2

=string(date("2009-02-23")," MMM dd, yyyy")

Feb 23, 2009

3

=string(3456.78,"$#,##0.00")

$3,456.78

4

=string(5/6,"0.00%")

83.33%

5

a      b

Separate a and b with tab

6

=string@q(A5)

"a    b" Double quoted the given character string a      b, and display the escape character

7

=string@e(A6)

\"a\tb\" Do not display the character tab after the string is escaped; and add escape character to the double quotes

8

 中国

 

9

=string@u(A8)

\u4E2D\u56FD

Related functions:

float()

int()

long()

number()

decimal()

sum()[1401][1402]

Here’s how to use sum() function.

A.sum(x)[1403][1404]

Description:

Compute x with each member of the sequence and compute the sum of the members of the new sequence.

Syntax:

A.sum(x)

Equivalent to A.(x).sum()

Note:

    The function loops through members of sequence A to compute expression x and returns the sum of members of the resulting sequence.

Parameters:

A

A sequence

x

Generally an expression of a single field name, or a legal expression composed of multiple field names. The computed result of the expression is numeric data type.

Return value:

A numeric value

Special Note:

    Take a null value as zero

Example:

 

A

 

1

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

 

2

=A1.sum(SALARY)

Sum up the salaries of all employees

3

=A1.(SALARY+100).sum()

Add 100 to the salary of each employee and then sum up all the employees’ salaries

Related functions:

       A.sum()

A.sum()[1405][1406]

Description:

Compute the sum of members of a sequence.

Syntax:

A.sum()

Equivalent to sum(x1,…,xn)

Note:

    The function computes the sum of members in sequence A; skip those members that are not numerical values.

Parameters:

A

A sequence

Return value:

The sum of all members in sequence A

Special Note:

    Take a null value as zero

Example:

 

A

 

1

=[1,2,3,4].sum()

10

2

=[2,null,3,4].sum()

9  Take the null value as zero

3

=[2, 3,4,"2323ads"].sum()

9  Ignore the non-numerical members

 

4

=sum(1,2,3,4)

10

Related functions:

A.count()

A.avg()

A.min()

A.max()

 

A.sum(x)

swap()[1407][1408]

Here’s how to use swap() function.

A.swap()[1409][1410]

Description:

Generate a new sequence by swapping the positions of two intervals in a sequence specified by two integer sequences.

Syntax:

A.swap(p,q)

Note:

This function swaps positions between two intervals in sequence A that are respectively specified by two integer sequences that do not overlap each other.

Parameters:

A

A sequence

p

An integer sequence composed of positive integers, for example [1,2,3 ], i.e. to (1,3)

q

An integer sequence composed of positive integers that doesn’t have intersection with p, for example [ 4,5,6], i.e. to(4,6)

Return value:

A new sequence after swapping

Example:

 

A

 

1

[a,b,c,d,e,f,g.h.i.j.k]

 

2

=A1.swap(to(1,3),to(4,6))

[d,e,f,a,b,c,g.h.i.j.k]

3

=A1.swap(to(1,4),to(4,6))

Error message appears because the two intervals in A3 overlap each other

Note:

The two intervals to be swapped in a sequence should not overlap each other.

switch()[1411][1412]

Here’s how to use switch() function.

A.switch(Fi,Ai:x;…)[1413][1414]

Description:

Switch the values of the reference field between the corresponding key values and the referenced records, or, sometimes switch between them in a reverse direction.

Syntax:

A.switch(Fi, Ai:x;…)

Note:

The function enables Fi to switch between the corresponding primary key values and the referenced records of Ai; the key value refers to the primary key value of the referenced record in Ai.Take the Attendance table as an example. The employeeID field may store either the corresponding primary key values of employeeID or the referenced records in Employee table. So, the switch() function can be used to switch between the two objects.Use the index table of the foreign key if any, and create one if unavailable.

Parameters:

A

A sequence.

Fi

The key of A. When Ai:x;… is omitted, Fi stores the records of the referenced table Ai. They can be replaced by Ai’s primary key values through the function.

Fi, Ai

When Ai is available, Fi is the reference field of A, which stores corresponding primary key values. The function is used to switch them to the referenced records. The matching condition is that Fi is equal to the primary key value of Ai. Use null to represent a missing record.

Fi, Ai:x

When both parameter Ai and the primary key x are available, get the first record from Ai in which value x is equal to Fi and make it the value of Fi field. If x is #, locate the records directly through the sequence numbers.

Options: (Available for Fi, Ai and Fi, Ai:x)

@i

Delete the records where no value corresponding to F is found during the matching

@d

Perform the inverse operation of @i, which obtains the records that have no value corresponding to F; with the option do not populate F with nulls

@1

If the specified F field value of a specified record in sequence A doesn’t exist in sequence B, generate a record of the same structure as one in B with F field as the primary key

Return value:

The record sequence after going through a reference value switch.

Example:

 

A

 

1

=demo.query("select * from DEPARTMENT").keys(DEPT)

 

2

=demo.query("select * from EMPLOYEE where EID < 10")

 

3

=demo.query("select * from DEPARTMENT" ).cursor().memory().keys(DEPT)

Return a memory table

4

>A2.switch(DEPT,A1:DEPT)

5

>A2.switch(DEPT,A3:DEPT)

A3 is a memory table; the result is the same as above

6

>A2.switch(DEPT)

Switch records of A2 corresponding to "DEPT " to field values

7

>A2.switch@i(DEPT,A1)

Delete this record if no value corresponding to DEPT is found

8

>A2.switch@d(DEPT,A1)

Obtain records that have no values corresponding to DEPT

9

>A1.delete(6)

 

10

=A2.switch(DEPT,A9:DEPT)

11

=A2.switch@1(DEPT,A9:DEPT)

Related functions:

cs.switch()

ch.switch(Fi,Ai:x;…)[1415][1416]

Description:

Switch the values of a reference field in a channel between the corresponding primary key values and the referenced records, or, sometimes switch between them in a reverse direction.

Syntax:

ch.switch(Fi,Ai:x;…)

Note:

Based on a channel, the function enables Fi to switch between the corresponding primary key values and the referenced records of Ai; the key values refer to the primary key values of the referenced records in Ai. This is an attached computation.

Parameters:

ch

Channel

Fi

The reference field of A. When Ai:x;… is omitted, Fi stores the records of the referenced table Ai . They can be replaced by Ai’s primary key values through the function.

Fi, Ai

When Ai is available, Fi is the reference field of A, which stores corresponding primary key values. The function is used to switch them to the referenced records in Ai.The matching condition is that Fi is equal to the primary key value of Ai.

Fi, Ai:x

When both Ai and x are available, get the first record from Ai in which value x is equal to Fi and make it the value of Fi field.

Options:

@i

If no value corresponding to F is found, then remove this record.

@d

Perform the inverse operation of @i, which obtains the records that have no value corresponding to F.

@1

If the F field value of a record in channel ch doesn’t exist in Ai , then generate a record of the same structure as Ai with expression x being the primay key

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select EID,SURNAME,DEPT,STATE from  EMPLOYEE")

 

2

=demo.query("select STATEID,NAME from STATES").keys(STATEID)

3

=channel()

Create a channel

4

=A1.push(A3)

Push data in A1’s cursor into A3’s channel

5

=A3.switch(STATE,A2:NAME)

Get the first record in A2’s table where NAME field value is equal to STATE field value and use is as the referencing record to replace the corresponding STATE value in the channel; the key value after switching is the referencing field’s primary key, i.e. STATEID

6

=A5.fetch()

Attach ch.fetch() function that gets the final result set to A3’s channel to fetch and store the existing data in the channel

7

=A1.fetch()

Fetch data from A1’s cursor

8

=A3.result()

Convert values of "STATE" field in A1 to the corresponding records in A2

9

=demo.cursor("select EID,SURNAME,DEPT,STATE from  EMPLOYEE where EID<20")

Return a cursor

10

=demo.query("select STATEID,NAME from STATES where STATEID<15").keys(NAME)

Return a table sequence whose primary key is NAME

11

=channel(A9)

Create a cursor in the channel and be ready to push A9’s cursor records into the channel

12

=A11.switch(STATE,A10)

Use A10’s primary key with parameter x being absent; the post-switch key is NAME

13

=A12.fetch()

 

14

=A9.skip()

 

15

=A11.result()

16

=demo.query("select EID,SURNAME,DEPT,STATE from  EMPLOYEE where EID<20")

 

17

=demo.query("select STATEID,NAME from STATES where STATEID<15").keys(NAME)

Same as A10

18

=channel()

Create a channel

19

=A18.switch@i(STATE,A17)

With @i option, delete a record that can’t match any STATE value in A17’s table sequence

20

=A18.fetch()

 

21

=A16.push(A18)

Push data in A16’s table sequence to the channel

22

=A18.result()

Get result set from the channel

23

=demo.query("select EID,SURNAME,DEPT,STATE from  EMPLOYEE where EID<20")

 

24

=demo.query("select STATEID,NAME from STATES where STATEID<15").keys(STATEID)

Same as A2

25

=channel()

Create a channel

26

=A25.switch@1(STATE,A24:NAME)

Find from A24’s table seqeunce the first record where the NAME (the key) value is the same as STATE (the key) value, use it as the reference record to replace the STATE value in the channel; the new key value after the replacement is the reference record’s primary key – STATEID. If there isn’t a matching STATEID, generate a record of the same structure as A24 and set primay key as NAME

27

=A25.fetch()

 

28

=A23.push(A25)

Push data in A23’s table seqeunce into the channel

29

=A25.result()

Fetch data from the channel

cs.switch(Fi,Ai:x;…)[1417][1418]

Description:

Replace values of a specified field in a cursor with the referencing field values of the corresponding record in another table.

Syntax:

cs.switch(Fi,Ai:x;…)

Note:

The function replaces a value of Fi field in cursor cs with the corresponding record in Ai by matching the Fi value with parameter x, which is the primary key or logical primary key of Ai. An Fi field value displays as empty when there’s no record in Ai that can match it.

Parameters:

cs

A cursor/A multicursor

Fi

A field of a cursor

Ai

A table sequence/A record sequence

x

The primary key or logical of Ai; the parameter can be omitted if Ai has the primary key

Options:

@i

If no value corresponding to F is found, then remove this record.

@d

Perform the inverse operation of @i, which obtains the records that have no value corresponding to F.

@1

If the F field value of a record in channel ch doesn’t exist in Ai , then generate a record of the same structure as Ai with expression x being the primay key

Return value:

The original cursor with switched field values

Example:

 

A

 

1

=demo.cursor("SELECT EMPLOYEE.EID,EMPLOYEE.DEPT,EMPLOYEE.NAME,

EMPLOYEE.SALARY FROM EMPLOYEE  where EID<11")

Return retrieved data as a cursor. Following is data in the cursor:

2

=demo.query("SELECT * FROM DEPARTMENT").keys(DEPT)

Return result as a table sequence where DEPT field is set as the key:

3

=A1.switch(DEPT,A2)

DEPT field is already set as the key of A2’s table sequence, so parameter x can be omitted; the operation transfers DEPT field values in A1 with primary key (the DEPT field) values of the corresponding records in A2

Click R&D value in the first row and the following record will be displayed:

4

=A3.fetch()

 

5

=demo.cursor("SELECT EMPLOYEE.EID,EMPLOYEE.DEPT,EMPLOYEE.NAME,EMPLOYEE.SALARY FROM EMPLOYEE  where EID<11")

Return retrieved data as a cursor. Following is data in the cursor:

6

=demo.query("SELECT * FROM DEPARTMENT where MANAGER<5")

Return result as a table sequence

7

=A5.switch(DEPT,A6:DEPT)

Match records in A5’s cursor with those in the table sequence by comparing the given field in the former and the latter’s specified key; for records that don’t have matchs in the table sequence, DEPT field values are left empty

8

=A7.fetch()

 

9

=demo.cursor("SELECT EMPLOYEE.EID,EMPLOYEE.DEPT,EMPLOYEE.NAME,EMPLOYEE.SALARY FROM EMPLOYEE  where EID<11")

Same as A5

10

=demo.query("SELECT * FROM DEPARTMENT where MANAGER<5")

Same as A6

11

=A9.switch@i(DEPT,A10:DEPT)

With @i option, any record that can’t find a match in the table sequence is deleted

12

=A11.fetch()

 

13

=demo.cursor("SELECT EMPLOYEE.EID,EMPLOYEE.DEPT,EMPLOYEE.NAME,EMPLOYEE.SALARY FROM EMPLOYEE  where EID<11")

Same as A5

14

=demo.query("SELECT * FROM DEPARTMENT where MANAGER<5")

Same as A6

15

=A13.switch@d(DEPT,A14:DEPT)

Contrary to @i option, @d option tells the function to return only the records that haven’t matches in the table sequence

16

=A15.fetch()

 

17

=demo.cursor("SELECT EMPLOYEE.EID,EMPLOYEE.DEPT,EMPLOYEE.NAME,EMPLOYEE.SALARY FROM EMPLOYEE  where EID<11")

Same as A5

18

=demo.query("SELECT * FROM DEPARTMENT where MANAGER<5")

Same as A6

19

=A17.switch@1(DEPT,A18:DEPT)

With @1 option, for a DEPT value in A17 that doesn’t exist in A18, the function generates a record of the same structure as A18; the primay key is set as DEPT

20

=A19.fetch()

Related functions:

A.switch()

cs.switch(Fi,Ai:x;…)[1419][1420]

Description:

Replace values of a specified field in a cluster cursor with the referencing field values of the corresponding record in another table.

Syntax:

cs.switch(Fi,Ai:x;…)

Note:

The function replaces a value of Fi field in cursor/multicursor/cluster cursor cs with the corresponding record in Ai by matching the Fi value with parameter x, which is the primary key or logical primary key of Ai. An Fi field value displays as empty when there’s no record in Ai that can match it.

Parameters:

cs

A cursor/multicursor/cluster cursor

Fi

A field in the cursor

Ai

A cluster memory table

x

The primary key or logical of Ai; the parameter can be omitted if Ai has the primary key

Options:

@c

With a distributed cluster memory table, the operation won’t involve a cross-node reference but it assumes that the referenced records are local

Return value:

The switched original cursor

Example:

 

A

 

1

=demo.cursor("SELECT * FROM DEPARTMENT")

Return a cursor

2

[192.168.0.110:8281,192.168.18.143:8281]

 

3

=file@0("emp_1.ctx", A2)

Get a distributed composite table file

4

=A3.create()

Open the composite table

5

=A4.cursor()

Return a cluster cursor

6

=A5.groups@c(DEPT:dept;sum(SALARY):totalSalary)

Return a cluster memory table

7

=A1.switch@c(DEPT,A6:dept)

Replace values of DEPT field of the cursor with the referencing field values and return the switched cursor

8

=A7.fetch()

Fetch data from the switched cursor:

sync()[1421][1422]

Description:

Synchronize the nodes.

Syntax:  

sync(hd:hs,p;zs)

Note:  

The function synchronzies file directories p in partition list zs on the nodes holding the processes specified by parameter hs onto the same directories in zs on the nodes holding the processes specified by parameter hd. The synchronization is performed according to the last time the files are updated, thus extra file will be deleted and time will be checked. If there are namesake files in the same partitions, synchronize hd by those with the latest update time. Perform the synchronization on the local machine if parameter hs and hd are absent; synchronize all files if parameter p is absent; and find the files under the nodes’ main directories if parameter zs is absent.

Parameters:

hd

A sequence of processes

hs

A sequence of processes

p

The file directories in the partition list on the nodes holding processes parameter hs specifies

zs

A data partition named after an integer. The parameter is a sequence when there are multiple partitions.

Example:

 

 

A

 

1

=sync(["192.168.1.100:8081","192.168.1.101:8283"]:"192.168.0.99:9281";1)

Synchronize data partition 1 on the node "192.168.0.99:9281" to the data partition 1 on both the nodes "192.168.0.100:8081" and "192.168.1.101:8283"

2

=sync(["192.168.1.100:8081","192.168.1.101:8283"]:"192.168.0.99:9281")

Synchronzie all data partitions on the node "192.168.0.99:9281" to the data partitions on both the nodes "192.168.0.100:8081" and "192.168.1.101:8283"

3

=sync(["192.168.1.100:8081","192.168.1.101:8283"]:"192.168.0.99:9281","f1")

Synchronize folder “f1” under the main directory on the node "192.168.0.99:9281" to the main directory on both the nodes "192.168.0.100:8081" and "192.168.1.101:8283"

4

=sync(["192.168.1.100:8081","192.168.1.101:8283"]:;1)

Synchronize data partition 1 on the local machine to data partition 1 on both the nodes "192.168.0.100:8081" and "192.168.1.101:8283"

5

=sync(:"192.168.0.99:9281";[1,2])

Syncronize data partitions 1 and 2 on the node "192.168.0.99:9281" to the same data partitions on the local machine

6

=sync(["192.168.1.100:8081","192.168.1.101:8283"]:"192.168.0.99:9281",”t1”;1)

Synchronize the folder “t1” in partition 1 on the node "192.168.0.99:9281" onto the corresponding folder in partition 1 on node “192.168.0.100:8081” and node “192.168.1.101:8283”

system()[1423][1424]

Description:

It is used to call the system command, and return the result once completed. For example, to open the bat and exe file.

Syntax:

system(cmd/sh)

Note:

It is presently only allowed to execute one cmd command each time. To execute multiple cmds , you will need to write them into a bat file, and use a cmd to call the bat file.

Parameters:

cmd

The standard format of cmd parameter is  “cmd /c +command”(Windows).

sh

The standard format of sh parameter is  “sh -c +command” (Linux).

Option:

@p

Proceed with the execution without pause

Return value:

Return the corresponding result

Example:

system("cmd /C D:\\MicroInsight\\esCalc\\bin\\startup-zh.bat")

system("cmd /C D:\\MicroInsight\\DataLogic\\bin\\DataLogic.exe")

system("sh -c /test.sh")

tan()[1425][1426]

Description:

Compute the tangent value.

Syntax:

tan(number)

Note:

The parameter number is in radians.

Parameters:

number

The radian value for which you want to compute the tangent value

Return value:

Float type

Example:

tan(pi()/2)

1.633123935319537E16

tan(pi(2))

-2.4492935982947064E-16

Related functions:

sin()

cos()

tanh()[1427][1428]

Description:

Return the hyperbolic tangent.

Syntax:

tanh(number)

Note:

The parameter number is a real number.

Parameters:

number

The real number for which you want to find the hyperbolic tangent

Example:

tanh(0.5)

0.46211715726000974

time()[1429][1430]

Here’s how to use time() function.

time(datetimeExp)[1431][1432]

Description:

Get the time part from the datetime value.

Syntax:  

time(datetimeExp)

Note:  

The function gets the time part from the datetime value datetimeExp. The result is accurate to millisecond by default. The format must be consistent with the time format in the configure information. By default, the configure information will not be displayed in millisecond.

Parameters:  

datetimeExp

Datetime data

Options:

@m

Accurate to minute

@s

Accurate to second

Return value:

Time value

Example:

time(now())

16:28:26400

time@s(now())

16:28:260

time@m(now())

16:28:000

Related functions:

date()

date(datetimeExp)

datetime(datetimeExp)

datetime()

time()

time()[1433][1434]

Description:

Convert the string or integer to time data.

Syntax:

time(stringExp{, format })

Convert the string stringExp to time data type according to the format specified by format. If there is no parameter format, format of stringExp must be in consistent with the time format in the configuration information

time(h,m,s)

Convert h,m,s of integer type to time data type

Note:

The function converts the string stringExp or integers h,m,s to time data.

Parameters:

stringExp

A string

format

A string specifying data format

h

Integer

m

Integer

s

Integer

Return value:

Time data

Example:

time("00:00:45")

00:00:45

time("00/00/45","hh/mm/ss")

00:00:45

time(12,13,00)

12:13:00

Related functions:

datetime()

date()

date(datetimeExp)

datetime(datetimeExp)

time(datetimeExp)

to()[1435][1436]

Here’s how to use to() function.

A.to()[1437][1438]

Description:

Get members of a sequence starting from a specified position to create a new sequence.

Syntax:

A.to(a)

From sequence A, generate a sequence composed of the first a members; when a<0, get members from the (A.len()+1+a)th one to the (A.len())th one

A.to(a,b)

From the sequence A, generate a sequence composed of the members from the ath to the bth. If omitting a, then start from the first member by default; if omitting b, get all members of A, that is A.len(), by default, and in this case the comma must not be omitted; if a>b, find the members backwards; members of the newly-generated sequence are ordered in an opposite direction relative to their original order

Note:

The function generates a sequence composed of the members from the ath to the bth according to sequence A. If omitting a, start from the first member by default; If omitting b, get members to the last one, that is A.len() by default.

Options:

@z(i,n)

Split a sequence into a number of segments (the number is n), and get and return the ith segment. If the number of members in the sequence can’t be evenly divided, the additional members will be returned along with the last segment

Parameters:

A

A sequence.

a

The integer specifying the starting position.

b

The integer specifying the ending position.

Return value:

A sequence

Example:

[1,5,2,6,8].to(2,3)

Return sequence [5,2]

[1,5,2,6,8].to(3,2)

Return sequence [2,5]

[1,5,2,6,8].to(2)

Return sequence [1,5]

[1,5,2,6,8].to(-2)

Return sequence [6,8]

[1,5,2,6,8,7].to@z(2,3)

Return sequence [2,6]

to(8).to@z(1,3)

Return sequence [1,2]

to(8).to@z(3,3)

Return sequence [5,6,7,8]

Related functions:

to()

to()[1439][1440]

Description:

Generate an integer sequence.

Syntax:

to(a,b)

Generate a sequence composed of continuous integers between a and b.

to(n)       

Generate a sequence composed of continuous integers from 1 to n.

Note:

The function generates a sequence composed of a set of continuous integers from a to b or from 1 to n.

Parameters:

a

The starting integer

b

The ending integer

n

n>0

Options:

@s

Generate a sequence composed of continuous b integers starting from a. If b is less than 0, generate the sequence backward sequentially in descending order.

Return value:

A continuous integer sequence

Example:

 

A

 

1

=to(3,7)

[3,4,5,6,7]

2

=to(5,3)

[5,4,3]

3

=to(-2,3)

[-2,-1,0,1,2,3]

4

=to(3,-2)

[3,2,1,0,-1,-2]

5

=to@s(3,4)

[3,4,5,6]

6

=to@s(3,-2)

[3,2]

7

=to(10)

[1,2,3,4,5,6,7,8,9,10]

Related functions:

A.to()

top()[1441][1442]

Here’s how to use top() function.

A.top()[1443][1444]

Description:

Get the n smallest members from a sequence.

Syntax:

A.top(n,x)      Return the value of x if the parameter is present

A.top(n;x,...)      Return corresponding records of if parameter x is present

A.top(n,y,x)     Loop members of sequence A to compute expression x, then loop the results to compute expression y, and finally return x’s results that correspond to the top n smallest values of y.

Note:

The function evaluates expression x with each member of the sequence A and returns the records corresponding to the n smallest values. n must not be omitted. The omission of x is equivalent to ~.

Parameters:

A

A sequence

n

An integer

y

An expression

x

An expression

Options:

@1

Return a single value if n is ±1; and null if n is 0

Return value:

Sequence

Example:

 

A

 

1

[a,c,e,g,f,d,b]

 

2

=A1.top(3,~)

3

=A1.top(3)

Same as A2, when x is omitted

4

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

 

5

=A4.top(10,SALARY)

 

Get the salaries of 10 employees who are the lowest paid

6

=A4.top(10;SALARY)

Get the records of 10 employees who are the lowest paid

7

[21,3,12,5]

 

8

=A6.top(3,~%10,~+6)

[11,27,18]

9

=A7.top(-1)

10

=A7.top@1(-1)

11

=A4.top(10;SALARY,EID)

Get top 10 employee records where SALARY is the lowest and EID is the smallest

Related functions:

A.pos()

A.sort()

A.pos(x)

A.psort()

A.ptop()

total()[1445][1446]

Here’s how to use total() function.

cs.total()[1447][1448]

Description:

Perform aggregatgion over records in a cursor.

Syntax:

cs.total(y,…)

Note:

The function performs aggregation over recods in a cursor. Parameter y is the aggregate function over cs. The function returns a single value when there is only one aggregate function; or returns multiple values in order for multiple aggregate functions.

Parameters:

cs

Cursor

y

Aggregate function, only support sum/count/max/min/top/avg/iterate; Parameter Gi should not be present when the function works with iterate(x,a;Gi,…) function

Return value:

    Numeric value or a sequence of numeric values

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=A1.total(sum(SCORE))

Return a single value

3

=A1.reset()

Move the cursor back to the beginning

4

=A1.total(sum(SCORE),count(SUBJECT),max(SCORE))

Return a sequence of values according to the order of the aggregate functions

ch.total()[1449][1450]

Description:

Perform aggregatgion over records in a channel.

Syntax:

ch.total(y,…)

Note:

The function performs aggregation over recods in a channel. Parameter y is the aggregate function over cs. The function returns a single value when there is only one aggregate function; or returns multiple values in order for multiple aggregate functions. This is an attached computation.

Parameters:

ch

Channel

y

Aggregate function, only support sum/count/max/min/top/avg/iterate; Parameter Gi should not be present when the function works with iterate(x,a;Gi,…) function

Return value:

Numeric value or a sequence of numeric values

Example:

 

A

 

1

=demo.cursor("select * from SCORES where CLASS = 'Class one'")

 

2

=channel()

Create a channel

3

=channel()

 

4

=A1.push(A2,A3)

Be ready to push A1’s data to channels A2 and A3 

5

=A2.total(sum(SCORE))

Perform an aggregation over records in channel A2

6

=A3.total(sum(SCORE),count(SUBJECT),max(SCORE))

Perform multiple aggregations over records in channel A3

7

=A1.fetch()

Fetch data from cursor A1 when operations in the channel begin to be executed and cursor data is pushed into the channel

8

=A2.result()

9

=A3.result()

 

trim()[1451][1452]

Description:

Remove the blank characters from both ends of a string.

Syntax:

trim(s)

Note:

The function removes the blank characters on both ends of string s.

Parameters:

s

Source string from which you want to remove the blank characters

Options:

@l

Remove the spaces on the left of the string s, with the parameter being letter l

@r

Remove the spaces on the right of the string s.

The default action is to remove the spaces on both ends.

@a

Remove all extra whitespaces. If there is one or continuous whitespaces within the string, retain only one whitespace; remove the whitespaces between a character and a word, but retain the whitespaces within the quotation marks.

Return value:

String

Example:

trim(" abc ")

"abc"

trim(" a bc ")

"a bc"

trim@l(" abc def ")

"abc def "

trim@l("def abc ")

"def abc "

trim@r(" abc def ")

" abc def"

trim@r("def abc ")

"def abc"

trim@a(" a bc ")

"a bc"

trim@a("a      bc")

"a bc"

trim@a("a\'      bc\' ")

"a'      bc'"

trim@a("abc  !")

"abc!"

true[1453][1454]

Description:

The logical constant true.

Syntax:

true

Note:

It can be used directly in the constant cell or expression.

Example:

 

A

B

 

1

=null

 

Assign null to A1

2

=A1==null

 

Judge if A1 is null

3

if A2==true

>a=4

If A2 is true, then assign 4 to a

4

else

>a=3

Otherwise assign 3 to a

Related functions:

null

false

union()[1455][1456]

Here’s how to use union() function.

A.union()[1457][1458]

Description:

Compute the union of members in a sequence whose members are sequences.

Synatax:

 A.union()

Note:

The function computes the union of members in sequence A whose members are sequences so as to get a sequence in which identical members won’t appear repeatedly. Duplicate members in the same sub-sequence will be retained. 

Parameters:

A

A sequence whose members are sequences

Return value:

A new sequence created through the union of members of sequence A

Example:

 

A

 

1

=[[1,2,3,4,5],[3,7,8]].union()

[1,2,3,4,5,7,8] “3” only appears once

2

=[[1,2,2],[3,4,4],4].union()

[1,2,2,3,4,4] The duplicate “4” is stripped out. Identical members in the same sub-sequence are not regarded as duplicate ones

3

=[[1,2,2],[2,2,2,3],2].union()

[1,2,2,2,3] There are three “2s” in the second sub-sequence, so the final result also include three “2s”

Related functions:

A.conj()

A.diff()

A.isect()

A.xunion()

A.union(x)[1459][1460]

Description:

Compute x with each member of the sequence whose members are sequences, and then perform union operation on members of the new sequence.

Synatax:

 A.union(x)

Note:

The function loops through sequence A, whose members are sequences, to compute expression x and then performs union operation on members of the resulting sequence.

Parameters:

A

A sequence whose members are sequences

x

An expression that returns a sequence

Return value:

A sequence created through the union of new members of sequence A

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

2

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

3

=[A1,A2].union(~.(NAME))

[Rebecca,Ashley,…] Common members of A1 and A2 only appear once, and identical members in the same sub-sequence are not regarded as duplicate ones

Related functions:

A.union()

update()[1461][1462]

Here’s how to use update() function.

db.update()[1463][1464]

Description:

Update database tables.

Syntax:

db.update(A:A',tbl,Fi:xi,…;P,…)

Update a database table based on a sequence/record sequence

db.update(cs,tbl,Fi:xi,…;P,…)

Update a database table based on a cursor

Note:

The function updates Fi field of the tbl table with the value of computing expression xi over the namesake field in sequence A. If both Fi and xi are omitted, use the namesake field of A and its values.

P, is the key of table tbl. First compare the database table tbl with A', the original sequence, according to the primary key if the latter parameter exists and generate a delete command to delete database records that exist in A' but don’t exist in A. When a primary key value exists in A but doesn’t exist in A', insert the corresponding record in A into the database table. If the primary key value exists in both A and A', compare the database record and the records in A and A' to see if there’s any change between the value of computing expression xi over Fi field in sequence A and the original Fi field value; and update the database table with the new value, if there is any.

When parameter A' is absent, the function supports only the insert and update operattions; no delete operation exists.

Parameters:

db

Database connection

A

A sequence /record sequence

cs

A cursor

A'

The original sequence/record sequence, whose data is considered consistent with the database table.

tbl

The name of a database table

Fi

A field in tbl

xi

An expression which will be computed based on A and its value will be the new value of Fi.

P

The key of tbl. If omitted, it will be retrieved from tbl; if the retrieval fails, then use A’s

Options:

@u

Compare primary keys between the database table and A' to generate an UPDATE statement; skip the comparison and directly upadate the database table with A if A' is absent.

@i

Compare primary keys between the database table with A'generate INSERT statement; skip the comparison and directly insert records into the database table with A if A' is absent.

@a

Clear the target table before the update is executed; empty the database table before executing db.update(A:A',tbl,Fi:xi,…;P,…).

@k

After the execution is completed, the transaction won't be committed. If this option is omitted, the transaction will be committed.

@1

The first field is an auto-increment field with no corresponding expression.

@d

Only perform delete operation and A' must be in place.

Return value:

        None

Example:

Transaction commits automatically after the update is completed

 

A

 

1

=demo.query("select * from EMPLOYEE").keys(EID)

 

2

=file("D:/employee1.txt").import@t()

3

>demo.update(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

EID is the key, which must be included in the update fields. A1 and A2 have the same field names. Compare the primary keys of the database table and those of A1 and A2 to delete records that are held by A1 but not held by A2; and to insert records that exist in A2 but don’t exist in A1. Finally compare the primary key values to upadate field values of A2’s database table by performing SALARY+10 on SALARY field of records whose field values have changed

4

>demo.update@u(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

With @u option, upadate only the field values of the records in A2 by performing SALARY+10 on SALARY field of records whose field values have changed

5

>demo.update@u(A2,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

Skip the comparison of primary key values and directly insert A2’s computed records to the database table if A' is absent

6

>demo.update@i(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

With @i option, only insert field values into records and perform SALARY+10 on SALARY field of all records

7

>demo.update@i(A2,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

Skip the comparison of primary key values and directly insert records into the database table with A if A' is absent

8

>demo.update@a(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

First empty the database table EMPLOYEE before executing db.update(A:A',tbl,Fi:xi,…;P,…).

Perform operation on records of the resulting database table whose EID is 512

9

=file("D:/data_user.txt").import@t()

10

=mysql.query("select * from user_test").keys(userid)

userid, which is the key of user test table in MySQL database, is a auto-incrementing field.

11

>mysql.update@1(A9:A10,user_test,USERNAME)

There’s no need for an  auto-incrementing field to be written down as an expression

12

>demo.update@k(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

Do not commit a transaction after the execution

13

>demo.update@d(A2:A1,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

Compare key values to delete records that exist in A1 but don’t exist in A2; perform operation on records of the updated database table whose EID is 1, 2 and 3

14

=file("D://data.txt").cursor@t()

 

15

>demo.update(A14,EMPLOYEE,EID,NAME,SURNAME,GENDER,STATE,BIRTHDAY,HIREDATE,DEPT,SALARY:SALARY+10;EID)

A14 is a cursor

T.update(P)[1465][1466]

Description:

Update records in an entity table.

Syntax:

T.update(P)

 

Note:

The function updates entity table T’s records by matching keys in T and record sequence P; P and T should have same structure. If a key value in P doesn’t exist in T, append or insert the corresponding record in T. Will auto-update T’s index, if there is one.

Parameters:

T

A composite table’s entity table

P

A table sequence/record sequence having same structure as T

Options:

@i

Update the records that can be inserted and ignore those whose values exist in the memory table

@u

Update the records that can be modified and ignore those whose values don’t exist in the memory table

@n

Return only the records that are updated and inserted

Return value:

  An entity table

Example: 

 

A

 

1

=file("D:\\emp8.ctx")

 

2

=A1.create(#EID,NAME;EID)

Create a composite table’s base table where EID field is the key by which records are segmented

3

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

 

4

=A2.append(A3)

 

5

=A2.attach(table3,SURNAME)

Add entity table table3 to the base table

6

=demo.cursor("select EID,SURNAME from employee where EID< 5")

 

7

=A5.append(A6)

 

8

=create(EID,NAME).record([1,"A",10,"B"])

Create a table sequence

9

=A2.update(A8)

In the base table, update the record where EID is 1 and append to it a record where EID is 10

10

=create(EID,SURNAME).record([2,"a",10,"b"])

Create a table sequence

11

=A5.update@i(A10)

In entity table table3, insert a record where EID is 10 but won’t update the record where EID is 2

 

T.update(P)[1467][1468]

Description:

Update records in a memory table.

Syntax:

T.update(P)

 

Note:

The function updates memory table T’s records by matching keys in T and record sequence P; P and T should have same structure. If a key value in P doesn’t exist in T, append or insert the corresponding record in T, in which the primary key always maintains its order. Will auto-update T’s index, if there is one.

Parameters:

T

A memory table

P

A table sequence/record sequence having same structure as T

Options:

@i

Only support insertion; ignore matching records

@u

Only support update; ignore mismatching records

@n

Return updated and inserted records

Return value:

A memory table

Example:

 

A

 

1

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

Return a cursor

2

=A1.memory()

Return a memory table

3

=A2.keys(EID)

Set EID as the memory table’s primary key

4

=create(EID,NAME,GENDER).record([1,"A","AA",10,"B","BB"])

Return a table sequence

5

=A2.update@u(A4)

Update only

6

=A2.update(A4)

Comment A5 before performing this execution; below is the result:

Handle updating and append a record

7

=A2.update@i(A4)

Comment A5 and A6 before performing this execution; below is the result:

Insert only

8

=A2.update@n(A4)

Comment A5, A6 and A7 before performing this execution; below is the result:

Return updated and inserted records

 

T.update(P)[1469][1470]

Description:

Update records in a cluster composite table.

Syntax:

T.update(P)

 

Note:

The function updates cluster composite table T’s records by matching keys in T and record sequence P; P and T should have same structure. If a key value in P doesn’t exist in T, append or insert the corresponding record in T. Will auto-update T’s index, if there is one. Suppport only the permanent distributed files and the update can happen to the patition in any node.

Parameters:

T

A cluster composite table

P

A table sequence/record sequence of the same structure as T

Example:

 

A

 

1

=file@0@z("emp10.ctx",["192.168.0.118:8281"])

 

2

=A1.create()

Open the distributed cluster composite table

3

=create(EID,NAME).record([1,"A","F",10,"B","M"])

Create a table sequence

 

4

=A2.update(A3)

Update the record where EID=1 and append a record where EID=10

upper()[1471][1472]

Description:

Convert all characters in a string to upper case.

Syntax:

upper(s)

Note:

The function converts all characters in a string to upper case.

Parameters:

s

Source string to be converted to upper case

Options:

@q

The quoted strings won’t be converted

Return value:

String

Example:

upper("ABCdef")

"ABCDEF"

upper("abcDEF")

"ABCDEF"

upper@q("\'abCD\'")

'abCD'

 

 

A

 

1

"ABcde"

 

2

=upper@q(A1)

"ABcde"

Related functions:

lower()

urlencode ()[1473][1474]

Description:

Encode a URL string.

Syntax:

urlencode(s,cs)

Note:

The function converts a URL string into an encoded one.

Parameters:

s

A URL string to be encoded

cs

Character set

Options:

@r

Decode, which is the inverse operation of the urlencode function

Return value:

String

Example:

 

A

 

1

=urlencode("http://localhost:8503/p1.dfx()","GBK")

2

=urlencode@r("http%3A%2F%2Flocalhost%3A8503%2Fp1.dfx%28%29","GBK")

 

v()[1475][1476]

Here’s how to use v() function.

v.v()[1477][1478]

Description:

Get the primary key value of the record pointed by a referencing field.

Syntax:

v.v()

Note:

If v is a record with a key set, the function will return its primary key value; if v is a record without a key set, the function will return a sequence composed of all its field values; if v isn’t a record, the function will return v itself.

This function is used to get the primary key value of the record pointed by a referencing field. Since a referencing field can switch between a referenced record and its key value through the switch() function, the v() function can be used to distinguish a record from a key value.

v may be a record, a sequence or a number.

Parameters:

v

A record, a sequence or a number.

Return value:

The primary key value of the record pointed by a referencing field

Example:

 

A

 

1

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

 

2

=A1(1).EID.v()

1; because the value of the EID field is a single number, the value itself is returned.

3

=A1(1).v()

[1, RebeccaMooreFCalifornia1974-11-202005-03-11R&D7000]; return a sequence composed of all field values of A1(1) because A1 doesn’t set a key

4

=demo.query("select * from DEPARTMENT ").keys(MANAGER)

 

5

=A1.switch(DEPT,A4:DEPT)

Switch the DEPT field into a referencing field pointing to the record of DEPARTMENT.

6

=A1(1).DEPT.v()

2; here, DEPT is a reference field whose value is record, therefore, the primary key value of the referenced record will be returned

7

=A4.keys(DEPT,MANAGER)

Set DEPT and MANAGER as the key of A4

8

=A1(1).DEPT.v()

[R&D,2]; return the key value of the record pointed by "DEPT"; since there are two key fields, a sequence of primary key value will be returned

Related functions:

r.key()

T.keys()

words()[1479][1480]

Here’s how to use words() function.

s.words()[1481][1482]

Description

Extract the English words from a string.

Syntax

s.words()

Note

The function returns a string sequence consisting of English words extracted from string s while other characters are ingnored.

Options

@d

Select the numbers out of the string s

@a

Select both the English words and the numbers out of the string s

@w

Extract all characters from a string; extract a string in Chinese /a sign as inidvidual characters and a string of English letters/a number as what they are

@i

Treat English letters in a row and continuous English letters plus numbers as a whole

Parameters

s

A string

Return value

A sequence of strings

Example

 

A

 

1

4,23,a,test?my_file 57

 

2

=A1.words()

Extract the English words form the string

3

=A1.words@d()

 

Extract numers form the string

4

=A1.words@a()

Extract English words and numers form the string

5

abc123好吗#?df34

 

6

=A5.words@w()

7

=A5.words@i()

Extract English letters in a row and continuous English letters plus numbers as a whole

8

4,-8,899,0,my,test

 

9

=A8.words@d()

A number string with the line sign “-” is parsed as a negative number

workday()[1483][1484]

Description:

Find a date which is the nth workday after the specified date.

Syntax:

workday (t,k,h)

Note:

The function finds a date which is the kth workday after the date t. The h is a sequence of holidays and/or workdays, whose members are weekend and/or workdays. The specified weekend will become workdays and vice versa.

Parameters:

t

Date

k

Integer

h

A sequence composed of values of date data type

Return value:

Date data

Example:

workday(date("2011-11-07"),25,[date("2011-12-03"),date("2011-12-31")])

2011-12-09

workday(date("2011-11-07"),25,[date("2011-11-30"),date("2011-12-31")])

2011-12-13

workdays()[1485][1486]

Description:

Return a sequence of workdays between two dates inclusive.

Syntax:

workdays(b,e,h)

Note:

The function gets a sequence of workdays between date b and date e inclusive. Members of h are either weekend or holidays. If there is an on-duty shift in a weekend day, take it as the weekday.

Parameters:

b

Date

e

Date

h

A sequence composed of values of date data type

Return value:

A sequence

Example:

 

A

 

1

=workdays(date("2015-04-02"),date("2015-04-08"),[date("2015-04-04"),date("2015-04-05"),date("2015-04-06")])

 

write()[1487][1488]

Here’s how to use write() function.

f.write()[1489][1490]

Description:

Write a string or a sequence into a file.

Syntax:

f.write(s)

 

f.write(A)

Write A, the sequence of strings to file f; each member occupies one row.

Note:

The original file will get overwritten, meaning the contents in the file f will be replaced with the string s or the string sequence A.

Parameters:

s

A string

f

A file

A

A string sequence

Options:

@a

Append data into a file, instead of overwriting it. If the file has contents before appending, then start a new line (with carriage return) to append.

@b

Write as a binary file without using the carriage return automatically.

@w

Use Windows-style \r\n line break; by default the line break is specified by OS.

Example: 

 

A

 

1

=file("D:/tmp.txt")

 

2

>A1.write("China")

3

>A1.write@a("Chinese")

4

=["China","America","England "]

 

5

>A1.write(A4)

6

>A1.write(string(now())+":start")

 

7

>A1.write@a(string(now())+":end")

8

>A1.write@a(string(now())+":startPrint")

9

>A1.write@a(string(now())+":endPrint")

10

=file("D:/test.txt")

A text file with binary data.

11

=file("D:/result.png")

 

12

=A10.read@b()

Read in test.txt in string format.

13

=A11.write@b(A12)

Generate result.png in binary format.

14

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

 

15

=file("D:/employee.txt").write@w(A14)

Use Windows-style \r\n line break.

Related functions:

f.read()

ws_call()[1491][1492]

Description:

Send a query request to the web service server to get the returned data.

Syntax:

ws_call(client,[service_name:service_port:]operation_name[,value1:paramName1,value2:paramName2…])

Note:

This external library function sends a query request to the web service server to get the returned data.

Parameters:

client

Web service client object

service_name

Service name; the parameter can be omitted when the WSDL URL contains only one service

service_port

Service port; the parameter can be omitted when the specified service has only one port

operation_name

Query operation name

value: paramName

Parameter value&Parameter name; multiple pairs are allowed. If the name part is omitted, names defined in WDSL message will be referenced in order

Return value:

A sequence

Example:

 

A

 

1

=ws_client("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl")

Access the weather forcast server

2

=ws_call(A1,"WeatherWebService":"WeatherWebServiceSoap":"getSupportProvince")

3

=ws_call(A1,"WeatherWebService":"WeatherWebServiceSoap":"getWeatherbyCityName","58367":"theCityName")

 

 

ws_client()[1493][1494]

Description:

Create a web service client.

Syntax:

ws_client(wsdl_url )

Note:

This external library function creates a web service client.

Parameters:

wsdl_url

The WSDL URL provided by the server

Return value:

A web service client object

Example:

 

A

 

1

=ws_client("http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl")

Access the weather forcast server

2

=ws_client("http://www.webxml.com.cn/webservices/DomesticAirline.asmx?wsdl")

Access the domestic flights schedule server

xjoin()[1495][1496]

Description

Perform a cross join on multiple record sequences.

Syntax

xjoin(Ai:Fi,xi;…)

Note

Perform cross join on sequences Ai unconditionally to create a new table sequence composed of Fi,… fields. Each Fi references a member of the corresponding original sequence Ai. The operation will filter members of Ai according to the criterion xi if it is supplied..

Parameters

Fi

Field names of the result table sequence

Ai

The sequences on which cross join is to be performed

xi

Filtering expression

Options:

@1

Perform left join (Note: here is the number 1). Use null to participate in the cross join if there is no matching members in sequence Ai

@x

If field values of the sequences to be joined are records, the joining values will be unfolded

Return value

A table sequence, each member of which references a member of every original record sequence.

Example

 

A

 

1

=create(Year).record([2000,2001])

 

2

=create(QuarterID, QuarterNmae).

record([1,"one",2,"two",3,"three",4,"four"])

 

3

=xjoin(A1:Year;A2:Quarter)

Perform the cross join directly

4

=create(Month).record(to(12))

 

5

=xjoin(A2:Quarter;A4:Month,Month>(Quarter.QuarterID-1)*3 &&

Month<=Quarter. QuarterID*3)

 

6

=create(Year).record([2000,2001])

7

=create(ID,Value).record([2001,"one",2002,"two",2003,"three",2004,"four"])

8

=xjoin(A6:f1;A7:f2,f1.Year==ID)

9

=xjoin@1(A6:f1;A7:f2,f1.Year==ID)

Perform left-join-type cross join according to the given filtering condition; use null if there isn’t members to match

10

=join(A5:Employee;A6:Familymembers)

 

11

=xjoin(A1:Year1;A2:Quarter1)

 

12

=xjoin(A3:Year2;A11:Quarter2)

13

=xjoin@x(A3;A11)

With @x option, the joining values are unfolded since field values of A3 and A11 are records

Note

Difference between join() and xjoin():

join() joins the sequences Ai according to the criterion that the value of related field/relational expression xi is equal to x1, so as to create a table sequence that has Fi,… as its fields. In this occasion, xi is the related field or the relational expression.

xjoin() cross joins the sequences Ai unconditionally to create a table sequence that has Fi,… as its fields. It will remove records that cannot satisfy criterion xi from each sequence of Ai according to the filtering criterion xi.

Related functions

join()

xjoinx()[1497][1498]

Description:

Perform cross join over single cursors or table sequences.

Syntax:

xjoinx(csi:Fi,xi,..;…)

Note:

Perform cross join on cursors/table sequences csi unconditionally to generate a new cursor composed of Fi,… fields. Each Fi references a member of the corresponding original cursor csi. The operation will filter members of csi according to the filtering criterion xi if it is supplied. Parameter csi is retraversable single cursors or table sequences.

ptions:

@1

Perform left join (Note: here is the number 1). Use null to participate in the cross join if there is no matching members in cursors csi

Parameters:

Fi

Names of fields of the result table sequence

csi

Single cursors or table sequences to be joined

xj

Filtering expression

Return value:

A cursor

Example:

 

A

 

1

=demo.cursor("select * from EMPLOYEE " )

 

2

=demo.cursor("select * from PERFORMANCE")

 

3

=xjoinx(A1:EmployeeID1;A2:EmployeeID2)

Perform cross join unconditionally

4

=A3.fetch()

5

=demo.cursor("select * from EMPLOYEE " )

 

6

=demo.cursor("select * from PERFORMANCE")

 

7

=xjoinx(A5:EmployeeID1;A6:EmployeeID2,EMPLOYEEID==EmployeeID1.EID)

Perform cross join according to the given filtering condition

 

8

=A7.fetch()

9

=demo.cursor("select * from EMPLOYEE " )

 

10

=demo.cursor("select * from PERFORMANCE")

 

11

=xjoinx@1(A9:EmployeeID1;A10:EmployeeID2,EMPLOYEEID==EmployeeID1.EID)

Left-join-type cross join

12

=A11.fetch()

Related functions:

xjoin()

xlscell()[1499][1500]

Description:

        Enter cell values to an Excel file object or read values from it.

Syntax:

xo.xlscell(a:b,s ;t)

Note:

The function enters values to Excel sheet s or read values from it. Parameter xo is an Excel file object read in the non-@r@w way.

When parameter t is present, enter string t , separated by the carrige return “\r”(which means the content will be entered into the next row), or tab“\t” (which means the content will be entered into the next column), starting from cell a, and save the entered data using the xlswrite() funtion.

If t is absent, read values from cell a to cell b and return them as a string; if parameter b is absent, read the value of cell a only when the counterpart parameter is a; and read values through to the last cell having a value when the counterpart parameter is a:.

Parameters:

xo

An Excel file object read in a non-@r@w way

a

Cell a

b

Cell b

s

Page number/page name; it is the first page when omitted

t

The to-be-populated string; can be omitted

Options:

@i

Insert a row after the row containing cell a and enter the specified data; by default there won’t be insertion and the existing data will be overwritten

Return value:

No return value or a string

Example:

 

A

 

1

=file("E2.xlsx").xlsopen()

Read the Excel file object

2

=A1.xlscell("A1":"C4",1)

Read data from cell A1 to cell C4 on sheet 1 in E2.xlsx, and return it as a string

3

=A1.xlscell("B2","s2")

Read data from cell B2 to the end on sheet s2 in E2.xlsx, and return it as a string

4

=A1.xlscell("A3","s2";"aa\rbb\tcc")

Enter string aa into cell A3 on sheet s2, enter string bb into cell A4 in the next row, and enter string cc into cell B3 in the next column

5

=A1.xlscell@i("A3",;"smile")

smile Insert a row after the one containing cell A4 on sheet 1, which becomes the 4th row, and then enter string smile in it

 

xlsclose()[1501][1502]

Description:

Close an Excel file object.

Syntax:

xo.xlsclose()

Note:

The function closes an Excel file object. Note that An Excel file object opened with @r@w options must be closed.

Parameters:

xo

An Excel object

Example:

 

A

 

1

=file("E1.xls").xlsopen@r()

Read an Excel file and return the file object

2

=A1.xlsclose()

Close an Excel file object

xlsexport()[1503][1504]

Here’s how to use xlsexport() function.

f.xlsexport()[1505][1506]

Description:

Write a table sequence or a cursor to an Excel file.

Syntax:

f.xlsexport(A,x:F,…;s;p)

Note:

The function writes table sequence/cursor A to Excel file f. Export all fields if no x is specified. The program will create the file f (cannot create path directory automatically) automatically.

 

If there isn’t a sheet s in f, the program will create one automatically. If sheet s already exists, it will receive the imported data in its format.

Options:

@t

Write the first record as the header into a file; when a namesake file with content already exists, the last non-empty row will be treated as the header row

@s

Import a whole big file (but shouldn’t be too big) with stream style

Parameters:

f

A file

A

Table sequence/cursor to be exported

x

Fields to be exported. If omitted, then export all fields which can be textualized in the record sequence A/cursor. The sign # is used to represent a field with a sequence number

F

Resulting field name; if omitted, then use the original field names

s

Sheet name or sheet number; when omitted, the exported data will be appended to the first sheet

p

The password for opening the exported Excel file

Example:

 

A

 

1

=demo.query("select EID,NAME,SURNAME from EMPLOYEE")

 

2

=file("D:\\EMPLOYEE1.xls").xlsexport(A1;"employee";"123")

Write data to an xls file with an opening password; the password is 123

3

=file("D:\\EMPLOYEE2.xls").xlsexport@t(A1;"employee")

 

With @t option, write the 1st row into the file as the header

4

=file("D:\\ EMPLOYEE4.xls").xlsexport@t(A1,EID,NAME:name;"employee")

Specify and export fields to the sheet of "employee"

5

=file("D:\\EMPLOYEE4.xl").xlsexport@t(A1;"employee")

Cannot determine the file extension, so export data as xls format to"EMPLOYEE4.xl" sheet

6

=demo.cursor("select EID,NAME,SURNAME from EMPLOYEE")

 

7

=file("D:\\EMPLOYEE5.xls").xlsexport(A6;"employee")

A6 is a cursor

8

=file("D:\\EMPLOYEE1.xls").xlsexport@t(A1)

Append the file content after the first page when sheet name isn’t supplied, with the last existing non-empty row overwritten as the header row

9

=file("D:\\big.txt").import@t()

There are millions of data rows in big.txt

10

=file("D:\\EMPLOYEE6.xlsx").xlsexport@st(A9;"employee")

Throw exception when @s option is absent

11

=file("D:\\EMPLOYEE7.xls").xlsexport(A1;#1,#2)

Export the first two columns

Related functions:

f.export()

f.xlsimport()

xo.xlsexport()[1507][1508]

Description:

Write a sequence into an Excel file object.

Syntax:

xo.xlsexport(A, x:Fi,..;s)

Note:

 

The function writes a sequence to sheet s or the sth sheet in an Excel file. Create sheet s if it doesn’t exist. Parameter xo is an Excel file object. Parameter A can be a cursor or a table sequence when xo is retrieved using @w option; A can only be a cursor when xo is retrieved using a non-@w way.

After the write action is finished, use xo.xlswrite() function to save the content written to the Excel sheet before you can view it.

Parameters:

xo

An Excel file object read in the non-@r way

A

A cursor/a table sequence

x

To-be-entered field names; all fields will be populated when omitted

Fi

The column alias; use the original name when omitted

s

Page name/page number

Options:

@t

Export headers; headers will overwrite the last row if there is data already

Example:

 

A

 

1

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

Return a table sequence

2

=file("E11.xlsx")

 

3

=A2.xlsopen()

Read E11.xlsx

4

=A3.xlsexport@t(A1)

Write A1’s table sequence into E11.xlsx

5

=A3.xlsexport@t(A1,CLASS:class,STUDENTID:sid;"Class")

Create a sheet named Class in E11.xlsx, rename CLASS field and STUDENTID field in A1’s table sequence and write them into sheet Class

6

=A2.xlswrite(A3)

Save the pupulated data in E11.xlsx using the xlswrite() function

xlsimport()[1509][1510]

Here’s how to use xlsimport() function.

f.xlsimport()[1511][1512]

Description:

Retrieve contents of an Excel file and return them as a table sequence.

Syntax:

f.xlsimport()

 

f.xlsimport(Fi,…;s,b:e;p)

Retrieve rows from b to e from Excel file f and return them as a table sequence. "e<0" represents the reciprocal number, and "Fi,…" are the to-be-retrieved fields; by default, all fields will be retrieved. s is the name or sequence number of a sheet.

Note:

The function retrieves all rows from Excel file f as records and returns them as a table sequence.

Parameters:

f

An Excel file

Fi

To-be-retrieved fields; by default all fields will be retrieved.The sign # is used to represent a field with a sequence number

s

Name or sequence number of a sheet; if omitted, use the first Excel sheet

b

The starting row; if omitted, retrieve rows from row one to row e will; in this case, ":" can be omitted

e

The ending row; if omitted, retrieve rows from row b to the last row; in this case, ":" cannot be omitted; if e is greater than the actual number of rows, use the actual number of rows. If both b and e are omitted, retrieve rows from the first one to the last one

p

The password for opening the Excel file

Options:

@t

Export the first row in f as the field names; if not supplied, then use _1, and _2,… as field names; with parameter b supplied, row b is treated as the header ro

@c

Return result as a cursor; support xlsx format only; in this case, parameter e should be greater than 0

Return value:

A table sequence whose records are rows of an Excel file

Example:

 

A

 

1

=file("D:\\EMPLOYEE1.xls").xlsimport()

2

=file("D:\\EMPLOYEE2.xls").xlsimport@t()

3

=file("D:\\EMPLOYEE1.xls").xlsimport(;"employee",3:6)

Retrieve data from a sheet named “employee” by specifying a starting row and an ending row

4

=file("D:\\EMPLOYEE2.xls").xlsimport@t(EID;"employee",3:6)

Retrieve a specified field from the "employee" sheet, with the starting and ending rows defined and with the first row being the headers

5

=file("D:\\EMPLOYEE2.xls").xlsimport@t(EID;"employee",:6)

With b omitted, retrieve rows from the first one which is treated as the headers; here ":" cannot be omitted

6

=file("D:\\EMPLOYEE2.xls").xlsimport(;"employee",490:)

With e omitted, retrieve rows till the end, with row 490 treated as the headers; here ":" can be omitted

7

=file("D:\\EMPLOYEE2.xls").xlsimport(;"employee",490:-5)

Retrieve from the 490th row to the 5th row counted from the last

8

=file("D:\\EMPLOYEE2.xls").xlsimport@t(EID;"employee")

With both b and e omitted, retrieve all rows while making the first row the headers

9

=file("D:\\EMPLOYEE4.xl").xlsimport()

Retrieve the "EMPLOYEE4.xl" file in xls format

10

=file("D:\\test.xlsx").xlsimport@c()

Return result as a cursor

11

=file("D:\\EMPLOYEE5.xls").xlsimport(#1,#2;2)

There are several sheets in EMPLOYEE5.xls; import the first columns of data from the second sheet

Related functions:

f.import()

f. xlsexport ()

xo.xlsimport()[1513][1514]

Description:

Retrieve a table sequence from an Excel file object.

Syntax:

xo.xlsimport(Fi,..;s,b:e)

Note:

The function retrieves data from row b to row e on sheet s or on the sth sheet in an Excel file, and returns a table sequence. When all parameters are absent, get the table sequence on the first sheet. xo is an Excel file object read in a non-@w way.

Parameters:

xo

An Excel file object read in non-@w way

Fi

Excel column name; retrieve all fields when omitted

s

Page name/page number

b

Row number; the first row by default

e

Row number; when e < 0, it is the row counted backwards; retrieve data to the last row when omitted

Options:

@t

The first row is the header row; when parameter b is present, the header row is row b

@c

Return the retrieved table sequence as a cursor; here the Excel file object must be read with @r option

Return value:

A table sequence

Example:

 

A

 

1

=file("E1.xls").xlsopen()

Read the E1.xls file and return it

2

=A1.xlsimport()

Read the table sequence on the first sheet as there are no parameters

3

=A1.xlsimport@t(ID,NAME;2)

Retrive columns whose names are ID and NAME on the second sheet, and make the first row as the header row

4

=A1.xlsimport(;"employee",10:20)

Retrieve data from row 10 to row 20 on the employee sheet

xlsopen()[1515][1516]

Description:

Read an Excel file and return an Excel file object.

Syntax:

f.xlsopen(p)

Note:

The function reads Excel file f and returns an Excel file object, which can saved as a read-only table sequence. The returned Excel file object include three properties: stname (page name), nrows (number of rows) and ncols ( number of columns). When f is large, use @r and @w options to retrieve data from it.

Parameters:

f

An Excel file

p

The password for opening an Excel file; can be omitted if no password is set for the to-be-opened file

Options:

@r

Read data in a stream style; support only xlsx files

@w

Write data in a stream style; doesn’t support returning the index and support only xlsx files; the option and @r option are mutually exclusive

Return value:

An Excel file object

Example:

 

A

 

1

=file("D:/ex1.xls")

 

2

=A1.xlsopen("123")

Read the xls file whose password is 123

3

=file("ex2.xlsx").xlsopen()

Read the xlsx file without a password

xlswrite()[1517][1518]

Description:

Save an Excel file object into an Excel file.

Syntax:

f.xlswrite(xo,p)

Note:

The function saves an Excel file object into the Excel file f.

Parameters:

f

Name of the Excel file into which data is written

xo

An Excel object read in non-@r@w way

p

The password for opening an Excel file; by default there isn’t one

Example:

 

A

 

1

=file("E1.xls").xlsopen()

Read the E1.xls file and return it

2

=file("T1.xlsx").xlswrite(A1)

Write the Excel file object into T1.xlsx

3

=file("T2.xls").xlswrite(A1,"123")

Write the Excel file object into T2.xlsx, and set a password, which is 123, for the latter

xml()[1519][1520]

Description:

Parse a string/a table sequence in an XML format.

Syntax:

xml(x,s)

Note:

If parameter x is an XML string, the function parses it into a table sequence to return; if x is a table sequence, the function parses it into an XML string and return.

Parameters:

x

An XML string/a table sequence

s

The to-be-retrieved level; use the slash / as the separator if there are multiple to-be-retrieved levels; retrieve data from the root if it is absent

Options:

@s

The options enables parsing an XML string in the format of K F=v F=v …>D</K> into records made up of fields K,F,… Three situations: If K’s value is D and D is multilevel XML data, the parsing result is a record sequence; if <K …./K>, D is parsed into null; if <K…></K>, D is parsed into an empty string.

Return value:

A table sequence/XML string

Example:

 

A

 

1

=demo.query("select EID,NAME,SURNAME from EMPLOYEE")

2

=xml(A1)

Return an XML string

3

<xml>

<row> <DEPTID>1</DEPTID> <DEPTNAME>sale</DEPTNAME> <FATHER>12</FATHER>

</row> <row> <DEPTID>10</DEPTID> <DEPTNAME>create</DEPTNAME> <FATHER>12</FATHER>

</row>

</xml>

 

4

=xml(A3)

Return a table sequence:

5

=xml@s(A3)

Return a multilevel sequence:

6

=xml(A3,"xml/row")

Retrieve data under row level and return it as a table sequence:

xor()[1521][1522]

Description:

Perform XOR operation on integers.

Syntax:

xor(xi,…)

xor(A)

Note:

The function performs XOR operation on integers.

Parameters:

A

A sequence

xi

The numerical expression based on which you perform the XOR operation

Return value:

An integer

Example:

xor(6,11)

13

xunion()[1523][1524]

Here’s how to use xunion() function.

A.xunion()[1525][1526]

Description:

Generate a new sequence by uniting and rearranging distinct members in each of a sequence’s sub-sequences.

Syntax:

A.xunion()

Note:

The function forms a new sequence by uniting and rearranging distinct members in each of sequence A’s sub-sequences. Same members after the distinct operation won’t be removed.

Parameters:

A

A sequence consisting of sequences

Return value:

A sequence

Example:

 

A

 

1

=[[1,2,3,3,4],[1,1,3]].xunion()

[2,3,4,1]

2

=[[1,2,3,3,4],[1,1,3],[4]].xunion()

[2,3,1]

3

=[[1,2],[]].xunion()

[1,2]

4

=demo.query("select top 2 * from EMPLOYEE")

5

=demo.query("select top 1 * from EMPLOYEE")

6

=[A4,A5].xunion()

A4 and A5 come from two table sequences stored in different places, so same records are treated as different members

Related functions:

A.union()

A.conj()

A.isect()

A.diff()

A.xunion(x)[1527][1528]

Description:

Calculate an expression with each member of every sub-sequence of a sequence to generate a new sequence by uniting and rearranging distinct members in each of the resulting sub-sequences.

Syntax:

A.xunion(x)

Note:

Over sequence A whose members are also sequences, the function calculates expression x with each member of every sub-sequence, and forms a new sequence by uniting and rearranging distinct members in each of the resulting sub-sequences. Same members after the distinct operation won’t be removed.

Parameters:

A

A sequence consisting of sequences

x

An expression whose value is a sequence

Return value:

A sequence

Example:

 

A

 

1

=demo.query("select EID,SURNAME,GENDER from EMPLOYEE where GENDER = 'M' and EID < 20")

2

=demo.query("select EID,SURNAME,GENDER from EMPLOYEE where GENDER = 'F' and EID < 20")

3

=[A1,A2].xunion(~.(SURNAME))

Rearranging distinct members in A1 and A2 to generate a new sequence; Same members after the distinct operation won’t be removed

Related functions:

A.xunion()

year()[1529][1530]

Description:

Get the year from a date value.

Syntax:

year(dateExp)

Note:

The function gets the year from the date dateExp.

Parameters:

dateExp

A date or a date expression in standard format

Return value:

An integer

Example:

year(datetime("19800227","yyyyMMdd"))

1980

year("1972-11-08 10:20:30")

1972

year(datetime("2006-01-15 13:20:45"))

2006

Related functions:

month()

day()       

hour()

minute()

second()

millisecond()

ym_build_model()[1531][1532]

Description:

Perform model building operation.

Syntax:

ym_build_model(md, mdfile)

Note:

The function builds a model, returns a PD model object and generates a model file with the extension pcf. The model file path can be absolute or relative; it is [sAppHome]/store/predict if relative.

Parameters:

md

An MD model

mdfile

A model file with the extension pcf

Return value:

A PD model object

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load necessary data for building the model

4

=ym_target(A3, "Survived")

Set Survived as the target variable

5

=ym_build_model(A3,"tra.pcf")

Perform model building operation and generate a model file tra.pcf saved in [sAppHome]/store/predict

6

>ym_close(A1)

Close Python service

ym_close()[1533][1534]

Description:

Close Python service to reduce source usage.

Syntax:

ym_close(env)

Note:

The function closes the Python service to reduce source usage.

Parameters:

env

An env object

Example:

 

A

 

1

=ym_env()

Initialize the environment to start Python service

2

>ym_close(A1)

Close Pyton service to reduce source usage

ym_env()[1535][1536]

Description:

Initialize the environment by setting an environment variable.

Syntax:

ym_env()

Note:

You need to first configure certain parameters, such as sAppHome, sLicenseFile and sPythonHome, in userconfig.xml file under YimmingCli external library’s directory before environment initialization. For more information, see Section 2.18 in External Libray Guide.

When the function is executed, a store directory with four subdirectories under it will be generated. By default:             

[sAppHome]/store/data_md  Contains data files for model building

        [sAppHome]/store/data_pd  Contains data files for prediction

        [sAppHome]/store/predict   Contains model files

        [sAppHome]/store/result    Contains would-be prediction result files

Return value:

An env object

Example:

 

A

 

1

=ym_env()

Initialize the environment to start Python service

2

>ym_close(A1)

Close Python service to reduce source usage

ym_importance()[1537][1538]

Description:

List the degrees of importance for model building variables.

Syntax:

ym_importance(pd)

Note:

The function create a list of degrees of importance for model building variables.

Parameters:

pd

PD model object

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load data for model building

4

=ym_target(A3, "Survived")

Set target variable

5

=ym_build_model(A3,"tra.pcf")

Perform model builing operation to generate a model file

6

=ym_importance(A5)

Return a list of degrees of importance for model building variables

7

>ym_close(A1)

 

 

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on the mode file ttnkh.pcf

3

=ym_importance(A2)

Return a list of degrees of importance for model building variables

4

>ym_close(A1)

Close Python service

ym_list()[1539][1540]

Description:

List model files under a specifid directory.

Syntax:

ym_list(dir)

Note:

The function get a list of model files under a directory specified by parameter dir.

Parameters:

dir

The directory holding model files for prediction; default is [sAppHome]/store/predict when it is absent

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Initialize the environment

2

=ym_list("D:/Desktop/DemoData/allData")

List model files under the specified directory

3

=ym_list()

List model files under [sAppHome]/store/predict because parameter dir is absent

4

=ym_close(A1)

Close Python service

ym_model()[1541][1542]

Description:

Load data for model building.

Syntax:

ym_model(env,data)

Note:

The function loads the data for building a model. The data must be structurized, and can come from a relational database, a text file, a table sequence, a cursor, a CSV file or a MCF file. When the data is stored in a file, its path can be absolute or relative; a relative path is relative to [sAppHome]/store/data_md directory.

Parameters:

env

An env object

data

Data for model building

Return value:

An MD object

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

The data file for building a model

3

=ym_model(A1,A2)

Load the model building data file

4

=file("D:/train.csv").import@tc()

 

5

=ym_model(A1,A4)

Parameter data is a table sequence

6

=file("D:/train.txt").cursor@tc()

 

7

=ym_model(A1,A6)

Parameter data is a cursor

8

>ym_close(A1)

Close Python service

ym_performance()[1543][1544]

Description:

Get information about the performance of a model.

Syntax:

ym_performance(pd)

Note:

The function gets information about the performance of a model, such as Gini index, AUC index and KS index.

Parameters:

pd

A PD model object

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on mode file ttnkh.pcf

3

=ym_performance(A2)

Get information about the performance of A2’s model

4

>ym_close(A1)

Close Python service

ym_predict()[1545][1546]

Description:

Generate a model object based on a model file.

Syntax:

ym_predict(mdFile)

Note:

The function generates a model object based on a model file.

Parameters:

mdFile

A model file

Return value:

A PD model object

Example:

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on mode file ttnkh.pcf

3

=ym_result(A2,"train_2.csv")

Perform prediction according to the model object and the prediction data files and return a able sequence coinsisting of prediction result

4

>ym_close(A1)

Close Python service

ym_present()[1547][1548]

Description:

Get model description data.

Syntax:

ym_present(pd)

Note:

The function gets the description of a model, including model name, AUC index, MSE index and model parameters.

Parameters:

pd

A PD model object

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on mode file ttnkh.pcf

3

=ym_present(A2)

Get model description data

4

>ym_close(A1)

Close Python service

ym_result()[1549][1550]

Description:

Generate the prediction result according to a model object and the data for prediction.

Syntax:

ym_result(pd,data,resultFile)

Note:

The function performs prediction according to model object pd and necessary data data, returns the prediction result as a table sequence, and generates result file resultFile. Similar to data for model building, the data for prediction can come from a database, a table sequence, a CSV file, etc. If the prediction data is a file, it can be located by an absolute path or a relative path; by default the latter is relative to [sAppHome]/store/data_pd.

The result file resultFile can be in an absolute path or a relative path; by default the latter is relative to [sAppHome]/store/result

Wont’ generate a result file when parameter resultFile is absent.

Parameters:

pd

A PD mode object

data

Data for prediction

resultFile

The prediction result file; can be absent

Options:

@s

When the prediction data contains target variables, it enables the function check the model performance according to the prediction result and returns a series of information, such Gini inex, AUC index and KS index

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load data for model building

4

=ym_target(A3, "Survived")

Set a target variable

5

=ym_setparam(A3,"modelFieldNames":["PassengerId","Survived","Pclass","Name","Sex","Age","SibSp"])

Set model parameters

6

=ym_build_model(A3,"tra.pcf")

Perform model building, generate a model file and retun a model object

7

=ym_result(A6,"train_t.csv","ret.txt")

Perform model building based on A6’s model object and the prediction data file train_t.csv and generate a prediction result file ret.txt which is stored in [sAppHome]/store/result

8

>ym_close(A1)

Close Python service

 

 

A

 

1

=ym_env()

Start Python service

2

=ym_predict("ttnkh.pcf")

Generate a model object based on mode file ttnkh.pcf

3

=ym_result@s(A2,"train_2.csv")

Perform prediction based on the model object and the prediction data; with @ s option, the function returns model performance data, as shown below:

As parameter resultFile is absent, the function won’t generates a prediction result file

4

>ym_close(A1)

Close Python service

 

ym_setparam()[1551][1552]

Description:

Set model building parameters.

Syntax:

ym_setparam(md, key:value,…)

Note:

The function set parameters for model building.

Parameters:

md

An MD object

key

A parameter name

value

A parameter value

 

Key

Value Type

 Description

balance

int

Balanced sampling ratio

target

String

A target variable

id

String

ID variable name

intelligence

boolean

Auto-impute a value or not

misformat

String

Missing value format

optimal

boolean

Use the optimal parameter configuration or not

parallel

int

Pre-set the number of pralllel tasks

resample

boolean

Resample or not

resamplemul

int

Resample multiplier

resamplenum

int

Frequency of resampling

testpercent

int

Test data percentage (0-99)

vartypes

ArrayList< Byte>

Set variable type; the byte value is the contant of F_ configured in Consts

ModelFields

ArrayList<String>

Order of field names in model building

Return value:

A Boolean value

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load data for model building

4

=ym_setparam(A3,"balance":2,"target":"Survived","modelFieldNames":["PassengerId","Survived","Pclass","Name","Sex","Age","SibSp"],"intelligence":"true")

Set model building parameters, where the parameters for which values should be properly set is 2, the target variable is Survived, the order of field names for model building is PassengerId, Survived, Pclass, Name, Sex, Age and SibSp, and set auto-assign value

5

>ym_close(A1)

Close Python service

ym_statistics()[1553][1554]

Description:

Get a series of information about a specified variable.

Syntax:

ym_statistics(md, field)

Note:

The function gets a series of information about a specified variable, including the max & min values, degree of importance, missing rate, and deviation, etc., to facilitate users’ data minging and statistical analysis process.

Parameters:

md

An MD object

field

Variable name

Return value:

A table sequence

Example:

 

A

 

1

=ym_env()

Initialize the environment

2

=file("train.csv")

 

3

=ym_model(A1,A2)

Load data for model building

4

=ym_statistics(A3,"Age")

Get information about a model building variable

5

>ym_close(A1)

Close Python service

ym_target()[1555][1556]

Description:

Set a target variable for model building.

Syntax:

ym_target(md, targetName)

Note:

The function sets a target variable, which must be a binary variable or a numeric type variable.

Parameters:

md

An MD object

targetName

Target variable name

Return value:

A Boolean value

Example:

 

A

 

1

=ym_env()

Start Python service

2

=file("D:/yimming/store/data_md/train.csv").cursor@tc()

The data file for model building

3

=ym_model(A1,A2)

Load the data fiel for model building

4

=ym_target(A3, "Survived")

Set Survived filed as the binary target variable

5

=ym_build_model(A3,"tra.pcf")

Perform model building operation and generate a model file tra.pcf

6

>ym_close(A1)

Close Python service

z()[1557][1558]

Description:

Locate a member of a set that is split into multiple subsets.

Syntax:

z(i,n)

z(i,n)

Divide a set of natural numbers into multiple subsets, the length of each is k, and find the subset in which the ith member is located

z(i,k,n)

Divide a set cointaining n members evenly into k subsets and find the subset in which the ith member is located

Note:

 For a set with a specified length, the sequence number of the to-be-located member should be within the length, i.e. i<=n.

Parameters:

i

Integer; the sequence number of a member and i<=n

k

Integer; the length of a subset

n

An integer, which is the length of a set

Return value:

Integer

Example:

z(13,5)

3

z(13,5,19)

4

 

zip()[1559][1560]

Description:
       
Perform file compression operations.

Syntax:
     
zip(
zipfile:encoding,passowrd; path, files)

Note:

The function performs various file compression operations.

Options:

@u

Decompression

@a

Append a new compressed file to an existing compressed file

@d

Delete a file in a compressed file

@n

Won’t perform recursive compression over subdirectories, only compress files of the current level

@f

List files in a compressed file

@p

List directories in a compressed file

Parameters:

zipfile

A compressed file

encoding

Charset; default is utf-8

password

A password; can be absent

path

The root directory holding a to-be-compressed file; it is the directory holding zipfile when the parameter is null or absent. The comma (“,”) after the parameter should be retained even the parameter is absent

files

A file or a sequence of files. Wildcard characters * and ? are allowed in a file name; the former represents any string and the latter represents a single character. With wildcard characters and if the name of the directory where the to-be-compressed file(s) are located isn’t the same with that of the directory holding the future compressed file(s), then the function will also compressed the directory, which contains the absolute path. In that case, the directory list generated via @p option is empty

 

Return value:
Return a Boolean value for compression, appending or deletion, or a file list for other operations

Example:

 

A

 

1

=zip("D:/z1.zip":"GBK","123";,"D:/testData/f1/")

Compress all files under D:/testData/f1/ directory into z1.zip with charset GBK; password for the compressed file is 123; placeholder “,” remains though parameter path is absent

2

=zip("D:/z2.zip";,"D:/testData/f1/")

Compress all files under D:/testData/f1/ directory into z2.zip with default charset utf-8; no password for the compressed file

3

=zip("D:/z4.zip";"D:/testData/f1","/*")

Compress all files under D:/testData/f1/ directory into z4.zip; the resulting file is the same as A2

4

=zip("D:/z5.zip";"D:/testData/f1/")

Compress all files under D:/testData/f1/ directory into z5.zip; with parameter files being absent, the resulting file is the same as A2

5

=zip("D:/z6.zip";,"D:/testData/f1/?ity.txt")

Compress files under D:/testData/f1/ directory whose names matching ?ity.txt with wildcard character ? into z6.zip

6

=zip("D:/z7.zip";,"D:/testData/f1/*.txt")

Compress files under D:/testData/f1/ directory whose names matching *.txt with wildcard character * into z7.zip

7

=["f2/*.txt","f2/*.csv","f2/*.xls"]

 

8

=zip("D:/z8.zip";"D:/testData/",A7)

Parameter files is a sequence, so compress text, csv and xls files under D:/testData/f2/ directory into z8.zip

9

=zip("D:/ZipTest/z11.zip";"testData/f1/")

Parameter path is a relative path, which is relative to the path parameter zipfile specifies; this compresses files under D:/ZipTest/testData/f1/into z11.zip

10

=zip@u("D:/z1.zip":"GBK","123";"D:/zfu/z1")

Decompress z1.zip into D:/zfu/z1 directory with password 123

11

=zip@a("D:/z2.zip";,"D:/testData/f_a/")

Append files under D:/testData/f_a/ directory to z2.zip

12

=zip@d("D:/z2.zip";"f1","C*.txt")

Delete files whose names match C*.txt under f1 directory from z2.zip

13

=zip@n("D:/z13.zip";,"D:/testData/")

Compress files under D:/testData/ into z13.zip; with @u option, the function doesn’t perform a recursion, which means files under subdirectories won’t be compressed

14

=zip@f("D:/z1.zip")

List files under a compressed file without a password

15

=zip@p("D:/z2.zip")

List directories in a compressed file

16

=zip@p("D:/z7.zip")

With a wild character and since the location of the to-be-compressed file isn’t the one holding the would-be compressed file z7.zip, the list of multilevel directories generated via @p option is empty

17

=zip("D:/testData/z15.zip";,"D:/testData/f1/*")

Since a wildcard character is used and the path containing the to-be-compressed file is the same one holding the would-be compressed file, the result file won’t contain a multilevel directory

18

//=zip@p("D:/testData/z15.zip")

With @p option, the function lists the directory

19

=zip("D:/z14.zip";,"D:/testData/")

Compress the file by recursively looping over subdirectories and get a compressed file containing multilevel directories

20

=zip@p("D:/z14.zip")

List multilevel directories

zip_add()[1561][1562]

Description:
 
 Add one or more files to a zip file.

Syntax:
   zip_add(zip,files)

Note:

The function appends one or more files to a zip file.

Parameters:

zip

A zip file object

files        

Name of a to-be-compressed file or FileObject; can be a sequence

Return value:
A Boolean value

Example:

 

A

 

1

=zip_open("D:/z2.zip")

Open a zip file

2

=zip_add(A1,"D:dir1/conn.java")

Add files under D:dir1/conn.java to A1’s zip file

3

>zip_close(A1)

Close a zip file

zip_close ()[1563][1564]

Description:
 
 Close a zip file.

Syntax:
   zip_close(zip)  

Note:

The function closes a zip file to release source.
Parameters:

zip

A zip file object

Example:

 

A

 

1

=zip_open("D:/z2.zip")

Open a zip file

2

=zip_add(A1,"D:dir1/conn.java")

Add files under D:dir1/conn.java to A1’s zip file

4

>zip_close(A1)

Close a zip file

zip_compress()[1565][1566]

Description:
 
  Set compression mode and level for a would-be zip file.

Syntax:
   zip_compress(zip,mode,level)

Note:

      This function sets mode and level for compressiong a file to get various compression ratio.

Parameters:

zip

A zip file object

mode       

Compression mode

0: Won’t compress

1: Standard compression

2: AES_ENC mode compression

Other values: Standard compression

 

level

Compression level

1: DEFLATE_LEVEL_FASTEST

2: DEFLATE_LEVEL_FAST

3: DEFLATE_LEVEL_NORMAL

4: DEFLATE_LEVEL_MAXIMUM

5: DEFLATE_LEVEL_ULTRA

Other values: DEFLATE_LEVEL_NORMAL

Return value
A Boolean value

Example:

 

A

 

1

=zip_open("D:/emp.zip")

Open a zip file

2

=zip_encrypt(A1,1,3)

Standard encryption

3

>zip_close(A1)

Open a zip file

zip_del()[1567][1568]

Description:
 
 Delete one or more files from a zip file.

Syntax:
   zip_del(zip, files)

Note:

  The function removes one or more specified file from a zip file.

Parameters:

zip

A zip file ovject

files        

A compressed file or a FileObject; can be a sequence

Return value:
A Boolean value

Example:

 

A

 

1

=zip_open("D:/z2.zip")

Open a zip file

2

=zip_del(A1, "dir1/*.java")

Delete all .java files in z2.zip

3

>zip_close(A1)

Close a zip file

zip_encrypt()[1569][1570]

Description:
 
 Set encryption mode for a zip file.

Syntax:
   zip_encrypt(zip, mode)

Note:

The function sets an encryption mode for a zip file with a password. Values of parameter mode is a closed interval [0,4].

Parameters:

zip

A zip file object

mode       

0: Won’t encrypt

1: Standard encryption

2: AES encryption with key length 128

3: AES encryption with key length 192

4: AES encryption with key length 256

Other values:Won’t encrypt

Return value:
A Boolean value

Example:

 

A

 

1

=zip_open("D:/e1.zip","123")

Open a zip file

2

=zip_encrypt(A1,0)

Parameter mode is 0, so the function won’t encrypt the zip file

3

=zip_encrypt(A1,1)

Parameter mode is 1; it is a standard encryption

4

>zip_close(A1)

Close a zip file

zip_extract()[1571][1572]

Description:
 
 Extract one or more files from a zip file.

Syntax:
   zip_extract(zip, files, path)

Note:

The function extract one or more specified files from a zip file onto a path.

Parameters:

zip

A zip file object

files        

A compressed file or a FileObject; can be a sequence

Return value:
A Boolean value

Example:

 

A

 

1

=zip_open("D:/z2.zip")

Open a zip file

2

=zip_extract(A1,"*.txt")

Extract txt files into D:/ directory holding the zip file

3

=zip_extract(A1,"*.csv","D:/csvfile")

Extract csv files into D:/csvfile directory

4

>zip_close(A1)

Close a zip file

zone()[1573][1574]

Here’s how to use zone() function.

zone(h)[1575][1576]

Description:

Get data partitions from nodes.

Syntax:

zone(h)

Note:

The function gets the data partitions on node list h; return a sequence of integer sequences if parameter h is a sequence.

Parameters:

h

A node or a node sequence

Return value:

A sequence

Example:

zone("192.168.0.116:8281")

zone(["192.168.0.116:8281","192.168.0.129:8281"])

 

                    

zone(i)[1577][1578]

Description:

Number a memory data zone.

Syntax:

zone(i)

Note:

The function sets a number for the current memory data zone. It returns the existing memory data zone number when parameter i is absent.

Parameers:

i

Memory data zone number

Return value:

An integer or null

Example:

 

A

 

1

>zone(3)

Number the current memory data zone

2

=zone()

Return the existing memory data zone number, which is 3

 

Intersection of sequences[1579][1580]

Description:

Generate a new sequence composed of common members of two sequences.

Syntax:

A^B

Note:

The operation generates a new sequence composed of members of both A and B.

Parameters:

A

A sequence with a length of n

B

A sequence with a length of m

Return value:

A new sequence composed of two sequences’ common members  

Example:

 

A

 

1

=[1,2,3,4]^[2,3]

[2,3]

2

=[1,2,3,3]^[1,3]

[1,3], there is only a 3 in the common members

3

=[1,2,3,3]^[1,3,3]

[1,3,3], there are two 3s in the common members

Related functions:

Concatenation of sequences

Union of Sequences

Multiplication of sequence

Alignment Arithmetic Operations

cmp()

Comparison operation[1581][1582]

Description:

Compare two numerical values, sequences, characters or serial bytes.

Syntax:

x==y

If values of two operands are equal, then the result is true. Otherwise, it is false.

x! =y

If values of two operands are not equal, then the result is true. Otherwise, it is false.

x<y

If x is less than y, then the result is true. Otherwise, it is false.

x>y

If x is greater than y, then the result is true. Otherwise, it is false.

x<=y

If x is not greater than y, then the result is true. Otherwise, it is false.

x>=y

If x is not less than y, then the result is true. Otherwise, it is false.

Note:

The comparison operation requires the numeric or character operands, and a boolean result value. For the Not Less Than (or Not Greater Than) comparison operators, the result value is false only when both the Greater than (or Less than) and Equal to relations are not true, and the result is still true as long as either of the relations is true.

If x and y are sequences, then x and y will be compared in one-to-one relationship in the sequential order of members. Return the result according to the relationship of first pair of unequal members undergoing the alignment comparison. Return true if the conditions are met; Otherwise, return false. However, for the comparison operator == used for alignment comparison, the true will only be returned when all members are equal. Otherwise, return false. If the numbers of members in sequences x and y are not the same, and those compared members are the same, then the one with fewer members is smaller.

If x and y are serial bytes, the comparison starts from the first byte and stops if the the first pair of different bytes appears. Return true if the conditions are met; Otherwise, return false. Relational operators include >, >=, <, <=. x and y need to have the same number of bytes; otherwise they are incomparable.

Parameters:

x

Sequence, numerical, character data or serial bytes

y

Sequence, numerical, character data or serial bytes

Return value:

True/False

Example:

 

A

 

1

=2==3

false

2

=2!=5

true

3

=2>5

false

4

=10<5

false

5

=2<=3

true

6

=3>=4

false

7

="a"=="b"

false

8

=[5,2,1,2]<=[5,2,1,2,-3]

true

9

=k(1)==k(1:2)

false

10

=k(3)!=k(1:2)

true

11

=k(1:2)<k(3:2)

true

12

=k(1:2)>k(3:2)

false

13

=k(2:2)<=k(1:2)

false

14

=k(2:2)>=k(1:2)

true

Hexadecimal long integer[1583][1584]

Description:

Hexadecimal long integer.

Syntax:

0x12

Note:

Integers that start with “0x” are the hexadecimal long integers.

Example:

0x2345

9029

Related functions:

Long integer

Modulus[1585][1586]

Description:

Perform Mod operation or integer division on two integers.

Syntax:

x%y

Get remainder

x\y

Get the integer part

Note:

The operation gets the integer part or the remainder part after division of one integer/long integer by another.

Parameters:

x

Integer or Long integer

y

Integer or Long integer

Return value:

An integer

Example:

 

A

 

1

=7%2

1

2

=7\2

3

Related functions:

cmp()

Concatenation of sequences[1587][1588]

Description:

Concatenate two sequences to generate a new sequence.

Syntax:

A|B

Note:

The operation oncatenates the members of two sequences(or single values) in their original order to compose a new sequence, that is, [A(1),…,A(n),B(1),…,B(m)].

Parameters:

A

A sequence whose length is n, or a single value,which can be regarded as [A]

B

A sequence whose length is m, or a single value,which can be regarded as [B]

Return value:

A new sequence after concatenating two sequences

Example:

 

A

 

1

=[1,2]|[1,2,3,"a"]

[1,2,1,2,3,a]; the same member appears repeatedly

2

=1|2|"a"

[1,2,a]; the single values can also be concatenated

3

=2|[3,"b"]

[2,3,b]

4

=[3,"b"]|2

[3,b,2]

Related functions:

Difference between sequences

Intersection of sequences

Union of sequences

Multiplication of sequences

Alignment Arithmetic Operations

cmp()

Arithmetic operations[1589][1590]

Description:

Perform the four arithmetic operations on two members.

Syntax:

x+y

x-y

x*y

x/y

Note:

If both the bottom rank operations (addition and subtraction) and the next rank up operations (multiplication and division) appear in the same formula, the multiplication and division take precedence over the addition and subtraction.

In the cases where there is parentheses or brackets, work problems from the inside out. When having a bunch of operations of the same rank, you just operate from left to right.

Parameters:

x

A number

y

A number

Return value:

A number

Example:

 

A

 

1

=2+5

7

2

=2-5

-3

3

=2*5

10

4

=10/5

2

5

=2+3.5*30

107

Related functions:

cmp()

Compound assignment[1591][1592]

Description:

The value of a variable will undergo a certain computation with an expression to assign a new value to the variable.

Syntax:

a?=x 

Note:

A variable value will undergo a certain computation with an expression to assign a new value to the variable.

Parameters:

a

Variable name

x

Legal expression

?

An operator, which can be +, -, *, /, \, and %

Return value:

New variable

Example:

 

A

 

1

=a=7

 

2

=a-=4

3

 

String[1593][1594]

Description:

Define a string constant.

Syntax:

"string"      or

$[string]         

Note:

An expression must be double quoted in use. But the quotation marks are not required if the string constants are defined directly.

The macro in "string" will not be replaced. When copying/pasting/inserting/deleting the row, the cell referenced by "string" will not change automatically.

The macro in $[string] will be replaced. When copying/pasting/inserting/deleting the row, the cell referenced by $[string] will change automatically.

The double quotation marks in $[string] do not need an escape character; while the double quotation marks in "string" needs one.

Parameters:

string

Contents of the string, which can be any character.

Return value:

String constant

Example:

"asd"

$[asd]

The the cell referenced by the string enclosed in $[] will change automatically when copying/pasting/inserting/deleting a row,but the one referenced by the string enclosed in "" will not change automatically in the same situation.

The macro in $[] will be replaced automatically, while macro in "" will not.

"${arg1}abc"

"${arg1}abc "

$[${arg1}abc]

"Tomabc", (Suppose the value of arg1 is "Tom")

The double quotation marks in $[] do not need to be escaped; while the escaping of double quotation marks in "" is needed.

$[a"s]        

"a\"s"              

Related functions:

Escape character

String concatenation

String concatenation[1595][1596]

Here are types of string concatenation.

x+y[1597][1598]

Description:

Join two or more strings end-to-end.

Syntax:

x+y

Note:

A string and a numeric value cannot be concatenated.

Parameters:

x

A string constant

y

A string constant

Return value:

A string formed by joining x and y.

Example:

"abc"+"def"

abcdef

"abc"+123

123. A string and a numeric value cannot be concatenated.

x/y[1599][1600]

Description:

Concatenate a string with one or more pieces of non-string data.

Syntax:

x/y

Note:

Either x or y is a string. The function will convert the non-string type one to a string before concatenating them to a larger one.

Parameters:

x

Data of any type, with the condition that either x or y is a string.

y

Data of any type, with the condition that either x or y is a string.

Return value:

A string

Example:

"abc"/12

abc12

date("2015-03-12")/"abc"

2015-03-12abc

 

 

Concatenation of serial bytes[1601][1602]

Here’s how to use k1+k2 function for concatenating serial bytes.

k1+k2[1603][1604]

Description:

Concatenate serial bytes.

Syntax:

k1+k2

Note:

Concatenate serial byte k1 and serial byte k2; both k1 and k2 must be serial bytes.

Parameters:

k1

A serial byte

k2

A serial byte

Return value:

A serial byte

Example:

k(1)+k(3:2)

65539

 

k(1:2)+k(1,3,4)

16843524

 

 

Serial bytes concatenation in a composite table:

 

 

 

 

A

 

 

1

=create(k1,v1).record([k(1:3),10,k(2:3),20,k(3:3),30,k(4:3),40,k(10:3),100])

Create a table sequence where k1field is serial byte data

 

2

=create(k1,k2,v2).record([k(1:3),k(1:2),"a",k(2:3),k(4:2),"c",k(2:3),k(8:2),"b"])

Create a table sequence where k1field and k2 filed are serial byte data

 

3

=file("D:/ckv2.ctx")

A composite table file

 

4

=A3.create(#k1:3,v1)

Create the composite table’s base table where k1 field is serial byte data

 

5

=A4.attach(table2,#k2:2,v2)

Add attached table table2 to the base table, where k2 field is serial byte data

 

6

=A4.append(A1.cursor())

 

 

7

=A5.append(A2.cursor())

 

 

8

=A5.cursor(k1+k2).fetch()

Alignment arithmetic operations[1605][1606]

Description:

Generate a new sequence by performing Arithmetic Operations, Mod operation or integer division between members in the same position in two sequences which are of the same length, such as alignment addition, alignment subtraction, alignment multiplication, and so on.

Syntax:

A++B

[A(1)+B(1),A(2)+B(2),…], alignment addition

A--B

[A(1)-B(1),A(2)-B(2),…], alignment subtraction

A**B

[A(1)*B(1),A(2)*B(2),…], alignment multiplication

A//B

[A(1)/B(1),A(2)/B(2),…], alignment division

A%%B

[A(1)%B(1),A(2)%B(2),…], mod operation

A\\B

[A(1)\B(1),A(2)\B(2),…], integer division

Note:

Alignment Arithmetic Operations are performed between members in the same position in two sequences A and B, and thus generate new members for the new sequence. For example, A++B indicates [A(1)+B(1),A(2)+B(2),…].

Parameters:

A

An integer sequence

B

An integer sequence

Return value:

A new sequence created through alignment arithmetic operations

Example:

 

A

 

1

=[4,2,3,3]++[5,10,2,1]

[9,12,5,4]

2

=[4,2,3,3]--[5,10,2,1]

[-1,-8,1,2]

3

=[4,2,3,3]**[5,10,2,1]

[20,20,6,3]

4

=[4,2,3,3]//[5,10,2,1]

[0.8,0,2,1.5,3.0]

5

=[7,12,3,3]%%[5,10,2,1]

[2,2,1,0]

6

=[7,12,3,3]\\[5,10,2,1]

[1,1,1,3]

Related functions:

Difference between sequences

Intersection of sequences

Union of sequences

Multiplication of sequences

Concatenation of sequences

cmp()

 

Difference between sequences[1607][1608]

Description:

Generate a new sequence by subtracting members of another sequence from a sequence.

Syntax:

A\B

A\x

Note:

The operation generates a new sequence by subtracting the members (or single values) of B from sequence A in order.

Parameters:

A

A sequence whose length is n

B

A sequence whose length is m or a single value which can be regarded as [B]

Return value:

A new sequence by subtracting the members (or single values) of B from sequence A in order.

Example:

 

A

 

1

=[1,2,3,4]\[2,3]

[1,4]

2

=[1,2,3,3]\[1,3]

[2,3], the duplicate members will not be subtracted repeatedly

3

=[1,2,3]\3

[1,2]

Related functions:

Concatenation of sequences

Intersection of sequences

Union of Sequences

Multiplication of sequences

Alignment arithmetic operations

cmp()

Union of sequences[1609][1610]

Description:

The operation generates a new sequence by merging two sequences.

Syntax:

A&B

Note:

Generate a new sequence by merging the members (or single values) from two sequences A and B  in proper order. The common members will not appear repeatedly in the new sequence.

Parameters:

A

A sequence with the length of n

B

A sequence with the length of m or a single value; When it is a single value, it is regarded as [B]

Return value:

A new sequence after merging the two sequences A and B

Example:   

 

A

 

1

=[1,2,3,4]&[3,2]

[1,2,3,4]. If members of the two sequences are not arranged in the same order, then follow the order of the first sequence

2

=[1,2,3,3]&[1,3]

[1,2,3,3]. Duplicate members will not appear repeatedly, but the same members in the former sequence will be retained

3

=[1,2,3,3]&4

[1,2,3,3,4]

4

=4&[1,2,3,3]

[4,1,2,3,3]

Related functions:

Difference between sequences

Intersection of sequences

Concatenation of sequences

Multiplication of sequences

Alignment arithmetic operations

cmp()

 

Multiplication of sequences[1611][1612]

Description:

Generate a new sequence by duplicating members of a sequence.

Syntax:

A*k          or

k*A

Note:

The function generates a new sequence by multiplying the given sequence by an integer k, that is - duplicating members of the sequence for k times.

If k<=0, then return an empty sequence.

Parameters:

A

A sequence

k

A positive integer

Return value:

A new sequence generated by duplicating the members of a given sequence for multiple times.

Example:

 

A

 

1

=[1,2,3]*3

[1,2,3, 1,2,3, 1,2,3]

2

=3*[1,2,3]

[1,2,3, 1,2,3, 1,2,3]

3

=[1,2,3]*0

[]

Related functions:

Difference between sequences

Union of sequences

Concatenation of sequences

Alignment arithmetic operations

cmp()

XOR-enabled sequence[1613][1614]

Description:

Generate a new sequence by arranging distinct members (or single values) in two sequences.

Syntax:

A%B

Note:

The operator enables a new sequence by arranging distinct members (or single values) in sequenceA and sequence B. Won’t repeate distinct operation over same members.

Parameters:

A

An integer sequence

B

A sequence or a single value; treated as sequence [B] when it is a value

Return value:

A sequence

Example:

 

A

 

1

=[1,2,3,4]%[2,3]

[1,4]

2

=[1,2,3,3]%[1,3]

[2,3]; won’t repeat distinct operation over same members

3

=[1,2,3]%3

[1,2]

4

=[1,2,3,3,4]%[1,1,3]

[2,3,4,1]

Related functions:

Difference between Sequences

Intersection of sequences

Union of Sequences

Alignment arithmetic operations

cmp()

Loop functions[1615][1616]

Description:

The introduction of common rules of loop functions.

Syntax:

A.f(x)

Note:

The loop functions compute A(1).f(x),…,A(n).f(x),~=A(i) in proper order against each member or each record of sequence A before performing further processing. "~" in x is used to reference the current record A(i).

Parameters:

A

A sequence or a table sequence

x

An expression, in which the sing “#” represents the sequence number of the current member/record

f

A loop function, which includes aggregate functions, locate function, select function, modify function and so on, most of which can be performed on a sequence

Return value:

The computation of the function f

Example:

 

A

 

1

=demo.query("select EID,NAME,BIRTHDAY,SALARY,1 as AGE from EMPLOYEE")

 

2

=A1.run(AGE=age(BIRTHDAY))

Compute the ages of the employees, and assign the results to the AGE field .

3

=A1.avg(AGE)

35.52

4

=create(Num,Accu)

5

 

 

6

>100.run(A4.insert(0,#,A5=A5+#))

 

 

 

The writing rules for expression x in loop functions[1617][1618]

Description:

Introduce the common rules on expressions in loop functions.

Note:

Expression x in loop functions such as r.(x), r.run(x), A.(x), A.run(x) and so on, should follow the rules below:

Ø  Members: ~ and A.~. ~ means the record being processed currently.

 

 

A

 

1

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

 

2

=A1.(age(~.HIREDATE))

[9,6,3,7,9,8,…]

3

=A1.new(~.NAME:Name,age(~.HIREDATE):Workage)

 

Ø  Sequence numbers: # and A.#. # indicates the sequence number of the members.

 

 

A

[1,2,3,4,5,6,7,8…], the two results are the same

1

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

2

=A1.(#)

3

=A1.(A1.#)

 

Ø  Fields: F, ~.F, r.F and A. F are equal to A.~. F , and A.F is equal to A(1).F if there is not a loop.

 

 

A

 

1

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

 

2

=A1.(age(HIREDATE))

 [9,6,3,7,9,8,…], the results of the three expressions are the same.

 

3

=A1.(age(~.HIREDATE))

4

=A1.(age(A1.HIREDATE))

5

=A1.HIREDATE

2005-03-11, it is equal to A1(1).HIREDATE if

there is not a loop.

 

Ø  A[i] and ~[i] are equal to A(#+i) in the loop, which counts the members forward from the current member in A and return the ith member. If the boundary is exceeded, errors are not reported and null is returned. F[] is equal to A[].F

 

 

A

 

1

=demo.query("select ORDERID,AMOUNT,'' as ACCUMULATION from SALES")

 

2

=A1.run(ACCUMULATION=AMOUNT+ACCUMULATION[-1])

Obtain the current ACCUMULATION by adding the ACCUMULATION of the last record to the current AMOUNT.

 

Ø  A[a,b] and ~[a,b] in the loop indicate a sequence composed of members between A(#+a) and A(#+b). a is 1-# by default and b is A.len()-# by default.

 

 

A

 

1

=demo.query("select STOCKID,DATE,CLOSING,'' as FirstThree from STOCKRECORDS")

 

2

=A1.run(FIRSTTHREE=~[--3,-1].(CLOSING).avg())

~[-3,-1] indicates a sequence composed of three records counted backward from the current row.

 

Ø  Iteration: A1.f1(A2.f2(x))

Symbols in expression x will be first identified to serve A2; if expression x serves A1, the iteration will be . A1.f1(A2.f2(A1.x)).

 

A

 

1

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

 

2

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

 

3

=A2.run(MANAGER=A1.select@1(EID==A2.~.MANAGER).NAME)

Reference the nested loop

 

Ø  Aggregate: A.f(x) 

A.f(x) is equal to A.(x).f(), in which f is an aggregate function and x can be null.

Note:

The x in A.count(x) is a boolean expression, which is different from the rule for other aggregate functions.

Batch Computation[1619][1620]

Description:

Compute a series of expressions one by one in an automatic fashion, and return the result of the last expression.

Syntax:

(x1,x2,…,xk)

Note:

The later expressions can reference the variable values computed by the preceding expressions for value assignment.

Parameters:

xk

Expressions you want to compute in batch

Example:

 

A

 

1

=(1,1+2,2+3)

5

2

=(a=1,b=a*3,c=b+5,a+b+c)

12

 

Identifier[1621][1622]

Description:

Identifier is commonly referred to as the variable name. We can define an identifier, or a variable name.

Syntax:

string1

'string2'

Note:

Normally the variable name can be used without having to be specifically defined. But if the variable name contains the space, equal sign, and other misleading characters, it needs to be defined specifically. There’s the same principle when handling spaces in commands line.

Parameters:

string1

Ordinary identifier

'string2'

If the string contains any misleading characters such as =, space, +, and - , it must be enclosed in single quotation marks.

Return value:

A variable value specified by the variable name - string1 or 'string2'.

Example:

 

A

 

1

>arg1=5

An ordinary identifier

2

>'a b'=4

Identifier that contains a space

3

>'a=b'=3

Identifier that contains equal signs

4

=arg1

5

5

='a b'

4

6

='a=b'

3

 

 

A

 

1

=file("emp.xls").xlsimport@t()

Import an Excel file whose second column name is NA ME, which contains a space

2

=A1.('NA ME')

An identifier containing a space and quoted by single quotation marks

 

Opposite Number[1623][1624]

Description:

Opposite number.

Syntax:

-a

Note:

Opposite number. If a is the datetime value or a string, then it can be used to sort in descending order.The operator is usually used with functions that can only sort data in ascending order, including cs.sortx(), A.sort(x ;loc), A.psort (x), A.top(n,x), and etc. By default, they sort data in ascending order,but the sign “-“ can be used to sort the inverse fields. And sorting the inverse fields ascendingly means sorting the original fields descendingly.

Parameters:

a

Variable name , datetime or string

Return value:

Number or sequence

Example:

 

A

 

1

=a=7

 

2

=-a

-7

3

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

 

4

=A3.sort(-BIRTHDAY)

Sort data by BIRTHDAY descendingly

5

=A3.sort(-DEPT)

Sort data by a string descendingly

 

Empty Sequence[1625][1626]

Description:

A sequence having no member.

Note:

A sequence having no member, for example: [].

 

Assignment[1627][1628]

Description:

        Assign value to a member of a sequence.

Syntax:

A(i)=x

Assign the ith member of sequence A with the value x

A(p)=x

Parameter is an integer sequence containing sequence numbers of members of sequence A. Assign value x to members of sequence A corresponding to members of p; member values of p should be less than or equal to the length of sequence A

A(p)=X

Parameter p is an integer sequence containing sequence numbers of members of sequence A. Assign members of sequence X to members of sequence A corresponding to members of p; p and X should have same lengths.

Parameters:

A

A sequence

i

A number, which is less than and equal to the length of sequence A

x

Data you are about to assign to the members

p

An integer sequence

X

A sequence, of which the data is to be assigned to the members of the sequence

Example:

 

A

 

1

=[1,2,3,4,5]

 

2

>A1(2)="a"

 

3

>A1(4)="b"

 

4

=A1

[1,"a",3,"b",5]

5

>A1([1,2,3])=9

 

6

=A1

[9,9,9,"b",5]

7

>A1([3,4,5])=[8,6,”y”]

 

8

=A1

[9,9,8, 6, "y"]

 

 

Value Computation and Assignment[1629][1630]

Description:

Assign the result of an expression to a variable and return this result.

Syntax:

a=x

Note:

Assign the result of expression x to variable a and return this result.

Parameters:

a

The variable name

x

The legal expression

Return value:

The result of an expression

Example:

 

A

 

1

>time=now()

 

2

>arg1=5*3

 

3

=time

The current time

4

=arg1

15

Escape Character[1631][1632]

Description:

A character that invokes an alternative interpretation on certain characters in a string.

Syntax:

\s

Note:

The characters such as \ (not an escape character, simply a backslash), ", ', newlines, etc., need an alternative interpretation when used in a string, or they will be misunderstood.

The double quotation marks in $[string] do not need the escape character; while the double quotation marks in "string" need one.

esProc supports applying “\ to the following characters:

\t

\r

\n

Parameters:

s

The character that needs an alternative interpretation, such as \ (not an escape character, simply a backslash), ", ', newlines, etc.

Return value:

A string of escaped character

Example:

Common examples:

"\\"

Backslash

"\n"

Newline

Double quotes in $[] do not need an escape character, while double quotes in "" do.

$[a"s]

 

"a\"s"

 

Related functions:

String

Logical Operations[1633][1634]

Description:

Perform logical operations on two boolean expressions.

Syntax:

x&&y

Logical AND operation; If both x and y are true, then the result is true. Otherwise, it is false. As long as the left operand value is false, the final result will always be false, no matter the right operand value is true or false.

x||y

Logical OR operation; The result is true as long as either x or y is true. Otherwise, it is false. As long as the left operand value is true, the final result is always the true, no matter the right operand value is true or false.

!x

Logical NOT operation, which gets the reverse value of the original value.

Note:

The operands to logical operators are boolean values. If the operand is not a boolean value, then it will be automatically converted to the boolean one. The result is a boolean value.

Parameters:

x

An expression

y

An expression

Return value:

true/false

Example:

 

A

 

1

=(2>1)&&(3<4)

true

2

=(2>10)&&(3<4)

false

3

=(2>1)||(3<4)

true

4

=(2>10)||(3<4)

true

5

=(2>11)

false

6

=! (2>11)

true

7

=!(12-11)

false

 

Long Integer[1635][1636]

Description:

Long integer.

Syntax:

1L

Note:

A long integer is represented by an integer with a tailing capital L.

Example:

2345L

2345

Related functions:

Hexadecimal long integer

 

Cell type[1637][1638]

Description:

Cell type.

Syntax:

 

x  'x

Constant cell

A cell containing a constant represented by value x or string x

Examples of automatically identifiable constants: 342.4E5-4.455%2012-11-223:43:23

The writing sytle 'x means the returned cell value is a string

=x

Calculation cell

A cell whose value is the result of computing expression x

>x  x

Executable cell

A cell that executes statement x and returns no value; the sign > will be omitted if the statement begins with a reserved word

/x

Comment cell

A cell containing comment that will be skipped in execution; its value is string x

Example:

 

A

 

1

10

Return constant 10

2

'10

Return a string

3

=2+3

Calculate expression 2+3 and return result 5

4

/This is a comment

A comment cell, which will be skipped in execution

5

[2,5,-3,8]

 

6

>A6.run(~=~+~[-1]) 

Based on sequence A6, calculate the sum of each member and its previous one; A5’s result is [2,7,4,12]

 

Code block type[1639][1640]

Description:

Code block type

Syntax:

==x

Calculation block; will be passed after the calculation finishes

>>x

Executable block; will be passed after the execution finishes

//x

Comment block; will be skipped

??

Under the current environment, calculate all cells in order (except the current cell) in the code block in which the current cell is the master cell, and return the result of calculating the last cell

Example:

       Calculation cell:

 

A

B

 

1

==demo.query(

"select NAME as CITY,

The code block is made up of A1, B1 and B2; the string in the master cell begins with ==

2

 

STATEID as STATE from CITIES")

The program will calculate the code block with cell A1 being the master cell as a whole statement, instead of splitting it up

After executing the statement according to the esProc rule, the progam will skip the rest of the cells in the code block

 

Executable cell:

 

A

B

 

1

=connect("demo")

 

 

2

>>A1.execute(

"update DEPARTMENT set MANAGER=? where DEPT='Sales'",

The executable cell is made up of A2, B2 and B3, and returns no result

3

 

"7")

 

Comment cell:

 

A

B

 

1

//comment

1.note...

The comment cell covers a stretch of cells A1-B4; will be skipped in execution

2

 

2.note...

3

 

3.note...

4

 

=1+1

5

=1+1

 

The result is 2

 

The usage of double question marks ??:

 

A

B

C

 

1

[59,164,50,104,93]

 

 

 

2

==A1.(??)

=if(

~>300:"Hazardous",

This is a code block with A2 being the master cell; its value is:

3

 

 

~>200:"Very Unhealthy",

4

 

 

~>150:"Unhealthy",

5

 

 

~>100:"Unhealthy for Sensitive Groups",

6

 

 

~>50:"Moderate",

7

 

 

"Good")

 

Chart Elements[1641][1642]

This section introduces functions to plot chart element and to compute chart element parameters.

G.draw()[1643][1644]

Description:

Draw a canvas.

Syntax:

G.draw(w,h)

Note:

The function draws a w(width) * h (height) canvas and calculates the hyperlink string. The format of image returned is specified by an option, and the default one is an SVG image with the hyperlink.

Parameters:

G

Canvas

w

Width of canvas in pixels

h

Height of canvas in pixels

Options:

@j

Return a JPG canvas

@g

Return a GIF canvas

@p

Return a PNG canvas

Return value:

A completed canvas

Example:

 a.draw@p(600,600)

Return a PNG canvas of 600 x 600 pixels (witdth x height)

G.hlink[1645][1646]

Description:

Return the hyperlink string of a canvas.

Syntax:

G.hlink()

Note:

The function gets a hyperlink string corresponding to the returned non-SVG image.

Return value:

A hyperlink string

Example:

a.hlink()

Return a hyperlink string

 

G.plot()[1647][1648]

Description:

Compute the chart plotting string and its parameters, plot them onto the canvas, and return a chart element.

Syntax:

G.plot(e,ai:xi:Ai,…)

Note:

The function computes the plotting string on the canvas G to plot the chart element e; and assigns the chart element parameter ai with the value xi. If the corresponding coordinate axis is available for this parameter value, then this coordinate axis is Ai. The text element, when certain properties are present, can be used to generated two-dimensional code.

Parameters:

G

Canvas

e

Chart element, for example, MapAxis, NumericAxis, EnumAxis, DateAxis, BackGround, Column, Line, Dot, Polygon, Text, Legend and Sector.

ai

Parameters of chart element, for example, the name, logicData, and physicalData parameters in the chart element of MapAxis. For more details, please refer to sections about chart element parameters.

xi

Parameter value

Ai

Coordinate axis corresponding to the parameter value

Return value:

Chart element

Example:

 

 

A

 

1

=a.plot("Legend","legendText":A1,"legendFillColor":A1:"map1")

Legend

2

=canvas()

 

3

=A2.plot("Text","text":"hello","barType":256)

Generate two-dimensional code using the text element

4

=A2.draw(200,200)

Return a canvas with both width and height being 200 pixels; click Chart plotting under the Value column or right-click the current cell to select Chart plotting to generate the following two-dimensional code

 

 

 

Chart Element Parameters[1649][1650]

Here are parameters for plotting various chart elements.

MapAxis[1651][1652]

name

Name of mapping table

logicalData

The sequence composed of logical coordinate values of a logical axis.

physicalData

The mapping values corresponding to the logicalData, which are in a one-to-one relation to the logicalData. They are usually in the form of a sequence composed of the appearance property values.

NumericAxis[1653][1654]

name

Numeric axis name.

visible

Show or hide axis

location

The position where a numeric axis will be plotted. You can set the axis as vertical axis, horizontal axis, polar axis, or radial axis.

is3D

Whether the axis is 3-dimensional or not. If the 3D property is adopted for at least one coordinate axis in the coordinate system on canvas, then the other coordinate axes in the current coordinate system will take on the 3D effect accordingly in chart plotting.

threeDThickRatio

The thickness ratio of 3D axes in a 3D chart. This parameter determines the 3D Thickness, which refers to the length of edges pointing towards the observer. The threeDThickRatio takes effect on condition that there is no enum axis in the coordinate system on canvas, and the axis 1 is the numeric axis. The default maximum 3D depth is 60 pixels.

To compute the overall 3D thickness based on the 3D thickness ratio of axis 1, use 3D Thickness Ratio * Canvas Height. If the ratio is greater than 1, then it represents the absolute pixel value. In addition, the chart will be auto-plotted with 60 pixels if the 3D thickness is greater than 60.

autoCalcValueRange

Whether or not the value range of the coordinate axis will be computed automatically according to the coordinates of a point. If set as true, it will set automatically the value range of numeric axis for the computation according to the coordinates of the coordinate axis.

maxValue

Maximum on the customized numeric axis. To get this, the autoCalcValueRange must be set to false, and thus the system will not compute the axis range automatically.

minValue

Minimum on the customized numeric axis. To get this, the autoCalcValueRange must be set to false, and thus the system will not compute the axis range automatically.

scaleNum

The number of scales displayed on the customized numeric axis. The autoCalcValueRange must be set to false, and thus the system will not compute axis range automatically.

format

The display format of the scale and label values manually, for example, 0.00, and $0.0.

transform

The transformation types of scales on the numeric axis. Options include not-to-transform, scale, logarithm, and index.

scale

It customizes the zooming scales for numeric axis when the transformation type is scale. The default value is 1.0.

logBase

It customizes the logarithmic base of the scale values on the numeric axis if the transformation type is logarithm. The default value is 10.

powerExpoment

It customizes the power exponent if the transformation type is the index. The default value is 2.718.

warnLineStyle

Styles of a warning line, including dotted line, solid line and none, etc.

warnLineweight

The thickness of a warning line, whose value is an integer and which is measured by pixels. Being zero means hiding the warning line.

warnLineColor

The color of a warning line.

warnLineData

The value for specifying a warning line. It is numeric.

unitFont

The font of unit text displayed for the value type after setting the type of transformation.

unitStyle

The styles of unit text. The options include the bold, italic, underline, and vertical text. The vertical text setting will override the underlines if setting them both.

unitSize

Size displayed for unit text

unitAngle

Rotation angle of unit text

unitColor

Color of unit text

xStart

The position of starting coordinate point on X-axis on the canvas when the numeric axis is a horizontal axis.

If the specified value is not greater than 1 and not less than 0, it indicates the percentage the chart will take up the width/length of the canvas. If the specified value is greater than 1 or less than 0, then it represents the pixel values. The chart will expand across the border if the pixels are greater than the width/length of canvas.

The origin point is in the top left corner if the specified value is not less than 0; Otherwise, it will be located in the bottom right corner if the specified value is less than 0.

xEnd

The position of ending coordinate point on X-axis on the canvas when the numeric axis is a horizontal axis. Please refer to the xStart property description for the property value setting.

xPosition

The position of Y-axis coordinates on the canvas when the numeric axis is a horizontal axis. Please refer to the xStart property description for the property value setting.

yStart

The position of starting coordinate point on Y-axis on the canvas when the numeric axis is a vertical axis. The numeric values increase from top to bottom. Please refer to the xStart property description for the property value setting.

yEnd

The position of ending coordinate point on Y-axis on the canvas when the numeric axis is a vertical axis. Please refer to the xStart property description for the property value setting.

yPosition

The position of X-axis coordinates on the canvas when the numeric axis is a vertical axis. Please refer to the description on the value forms of the xStart property for the property value setting.

polarX

The position of starting coordinate point on X-axis on the canvas when the numeric axis is a polar axis. Please refer to the description on the value forms of the xStart property for the property value setting.

polarY

The position of starting coordinate point on Y-axis on the canvas when the numeric axis is a polar axis. Please refer to the description on the value forms of the xStart property for the property value setting.

polarLength

The polar axis length.

startAngle

The start angle when the numeric axis is a radial axis. In plotting the pie chart, the sectors can be customized with the startAngle and endAngle properties.

endAngle

The end angle of a radial axis.

axisColor

The axis line color of a numeric axis.

axisLineStyle

The style of axis line. Options include the dotted line, solid line, and none.

axisLineWeight

The line weight of numeric axis.

axisArrow

The arrow style of numeric axis.

title

The title name of numeric axis.

titleFont

The font of title of numeric axis.

titleStyle

The title style of numeric axis. Please refer to unitStyle.

titleSize

The title font size of numeric axis.

titleIndent

The blank space left by indenting the title of numeric axis.

titleColor

The title color of numeric axis.

titleAngle

The rotation angle of the title of numeric axis.

allowLabels

Whether the labels will be displayed or not.

labelFont

The font of label values.

labelStyle

The label value style. Please refer to the unitStyle of NumericAxis.

labelSize

The font size of label values.

labelIndent

The blank space between the label values and the axis.

labelColor

The font color of label values.

labelStep

The display style of labels. The labelStep=0 indicates that all labels will be displayed, and labelStep=2 indicates a label value will be displayed every other 2 labels.

labelAngle

The rotation angle of label values

labelOverlapping

 The overlapping of labels. If checked, labels are allowed to be overlapped; Otherwise, the overlapping labels are not allowed, and they, if any, will be overridden and hidden.

scalePosition 

Positions of tick marks, which can be displayed on the right or top, on the left or bottom, or across axis, or no tick marks appear. Once they are positioned, their values will change accordingly.

scaleStyle

The style of tick marks, including the dotted line, the solid line, and so on.

scaleWeight

The weight of tick marks.

scaleLength

The length of tick marks.

displayStep

The display style of tick marks. If displayStep=0, then every tick mark will be displayed, and displayStep=2 indicates it becomes visible every other two.

allowRegions

Whether the background region will be displayed or not.

regionLineStyle

The styles of lines in the background region.

regionLineColor

Color of lines in the background region

regionLineWeight

The weight of lines in the background region

regionColors

Color of the background region

regionTransparent

Degree of transparency of the background region. The value range for it is [0,1], in which the 0 represents the 100% transparency (i.e. totally transparent), and the 1 represents full opaqueness. The values higher than 1 give the same total opaque effect as 1, and the values less than 0 represent the total transparency as well.

isPolygonalRegion

Whether it is a polygon background or not. This property is only valid in the polar coordinate system, and is fit for radar chart and other no-fill charts. There is no such polygonal effect with pie chart and other charts with fill colors. On the radar chart, the shape of background region will change along with the number of categories.

EnumAxis[1655][1656]

name

Enum axis name.

visible

Show or hide axis.

location

The positon where an enum axis will be plotted. You can set the axis as vertical axis, horizontal axis, polar axis, or radial axis.

is3D

Whether the axis is 3-dimensional or not. If the 3D property is adopted for at least one coordinate axis in the coordinate system on canvas, then the other coordinate axes in the current coordinate system will take on the 3D effect accordingly in chart plotting.

threeDThickRatio

The thickness ratio of 3D axes in a 3D chart. This parameter determines the 3D Thickness, which refers to the length of edges pointing towards the observer. The default maximum 3D thickness is 60 pixels.

To compute the overall 3D thickness based on the 3D thickness ratio of the enum axis, use 3D Thickness Ratio * Enum Axis Series Width. The axes will be auto-plotted with 60 pixels if the 3D thickness is greater than 60.

categories

The categories. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Tom","Mary"] is auto-retrieved as the category values.

series

The series. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Maths","English","French"] is auto-retrieved as the series values.

gapRatio

The ratio of width of graph of each series on the category axis to the category gap, starting gap, or ending gap. By default, this value is 1.5, indicating the gap width is 1.5 times of the basic width of graph of a series.

xStart

The position of starting coordinate point on X-axis on the canvas when the enum axis is a horizontal axis.

If the specified value is not greater than 1 and not less than 0, it indicates the percentage the chart will take up the width/length of the canvas. If the specified value is greater than 1 or less than 0, then it represents the pixel values. The chart will expand across the border if the pixels are greater than the width/length of canvas.

The origin point is in the top left corner if the specified value is not less than 0; Otherwise, it will be located in the bottom right corner if the specified value is less than 0.

xEnd

The position of ending coordinate point on X-axis on the canvas when the enum axis is a horizontal axis. Please refer to the xStart property description for the property value setting. 

xPosition

The position of Y-axis coordinates on the canvas when the enum axis is the horizontal axis. Please refer to the description on the xStart property for the property value settings.

yStart

The position of starting coordinate point on Y-axis on the canvas when the enum axis is a vertical axis. The numeric values increase from top to bottom. Please refer to the description on the xStart property for the property value setting.

yEnd

The position of ending coordinate point on Y-axis on the canvas when the enum axis is a vertical axis. Please refer to the description on the xStart property for the property value setting.

yPosition

The position of X-axis coordinates on the canvas when the enum axis is a vertical axis. Please refer to the description on the xStart property for the property value setting.

polarX

The position of starting coordinate point on X-axis on the canvas when the enum axis is a polar axis. Please refer to the description on the xStart property for the property value setting.

polarY

The position of starting coordinate point on Y-axis on the canvas when the enum axis is a polar axis. Please refer to the description on the xStart property for the property value setting.

polarLength

The polar axis length.

startAngle

The start angle when the enum axis is a radial axis. In plotting the pie chart, the sectors can be customized with the startAngle and endAngle properties.

endAngle

The end angle of a radial axis.

axisColor

The axis line color of an enum axis.

axisLineStyle

The style of axis line. Options include the dotted line, solid line, and none.

axisLineWeight

The line weight of the enum axis.

axisArrow

The arrow style of the enum axis.

title

The title name of the enum axis.

titleFont

The title font of the enum axis.

titleStyle

The title style of the enum axis. Please refer to the description on unitStyle of numeric axis.

titleSize

The title font size of the enum axis.

titleIndent

The blank space left by indenting the title of enum axis.

titleColor

The title color of the enum axis.

titleAngle

The rotation angle of the title of the enum axis.

allowLabels

Indicates if the labels will be displayed.

labelFont

The font of label values.

labelStyle

The label value style. Please refer to the unitStyle of NumericAxis.

labelSize

The font size of label values.

labelIndent

The blank space between the label values and the axis.

labelColor

The font color of label values.

labelStep

The display style of labels. The labelStep=0 indicates that all labels will be displayed, and labelStep=2 indicates a label value will be displayed every other 2 labels.

labelAngle

The rotation angle of label value

labelOverlapping

The overlapping of labels. If checked,labels are allowed to be overlapped; Otherwise, the overlapping labels are not allowed, and they, if any, will be overridden and hidden.

scalePosition

Positions of tick mark, which can be displayed on the right or top, on the left or bottom, or across axis, or no tick marks appear. Once they are positioned, their values will change accordingly.

scaleStyle

The style of tick marks, including the dotted line and the solid line, and so on.

scaleWeight

The weight of tick marks.

scaleLength

The length of tick marks.

displayStep

The display style of tick marks. If displayStep=0, then every tick mark will be displayed, and displayStep=2 indicates it becomes visible every other two.

allowRegions

Whether the background region will be displayed or not.

regionLineStyle

The style of lines in the background region.

regionLineColor

Color of lines in the background region

regionLineWeight

The weight of lines in the background region

regionColors

Color of the background region

regionTransparent

Degree of transparency of the background region. The value range for it is [0,1], in which the 0 represents the 100% transparency (i.e. totally transparent), and the 1 represents opaqueness. The values higher than 1 give the same totally opaque effect as 1, and the values less than 0 represent the total transparency as well.

isPolygonalRegion

Whether it is a polygon background or not. This property is only valid in the polar coordinate system, and is fit for radar chart and other no-fill charts. There is no such polygonal effect with pie chart and other charts with fill colors. On the radar chart, the shape of background region will change along with the number of categories.

DateAxis[1657][1658]

name

Date axis name

visible

Show or hide axis

location

The position where a date axis will be plotted. You can set the axis as vertical axis, horizontal axis, polar axis, or radial axis.

is3D

Whether the axis is 3-dimensional or not. If the 3D property is adopted for at least one coordinate axis in the coordinate system on canvas, then the other coordinate axes in the current coordinate system will take on the 3D effects accordingly in chart plotting.

threeDThickRatio

The thickness ratio of 3D axes in a 3D chart. This parameter determines the 3D Thickness, which refers to the length of edges towards the observer. The threeDThickRatio takes effect on condition that there is no enum axis in the canvas coordinate system, and the axis 1 is the date axis. The default maximum 3D thickness is 60 pixels.

To compute the overall 3D thickness based on the 3D thickness radio of axis 1, use 3D Thickness Ratio * Canvas Height. If the ratio is greater than 1, then it represents the absolute pixel value. In addition, the chart will be auto-plotted with 60 pixels if the 3D thickness is greater than 60.

autoCalcValueRange

Whether or not the value range of coordinate’s axis will be computed automatically according to the coordinates of a point. If the autoCalcValueRange is set as true, then the value range of date axis will be set automatically according to the coordinates of the axis.

endDate

End date on date axis

beginDate

Start date on date axis

scaleUnit

The unit scales on date axis, including year, month, day, hour, minute, second, and millisecond.

format

The display format of scale values on the date axis, for example, yyyy/MM/dd, and yy-MM-dd.

xStart

The position of starting coordinate point on X-axis on the canvas when the date axis is a horizontal axis.

If the specified value is not greater than 1 and not less than 0, it indicates the percentage the chart will take up the width/length across the canvas. If the specified value is greater than 1 or less than 0, then it represents the pixel values. The chart will expand across the border if the pixels are greater than the width/length of canvas.

The origin point is in the top left corner if the specified value is not less than 0; Otherwise, it will be located in the bottom right corner if the specified value is less than 0.

xEnd

The position of ending coordinate point on X-axis on the canvas when the date axis is a horizontal axis. Please refer to the description on the xStart property for the property value setting.

xPosition

The position of Y-axis coordinates on the canvas when the date axis is a horizontal axis. Please refer to the description on the xStart property for the property value setting.

yStart

The position of starting coordinate point on Y-axis on the canvas when the date axis is a vertical axis. The numeric values increase from top to bottom. Please refer to the description on the xStart property for the property value setting.

yEnd

The position of ending coordinate point on Y-axis on the canvas when the date axis is a vertical axis. Please refer to the description on the xStart property for the property value setting.

yPosition

The position of X-axis coordinates on the canvas when the date axis is a vertical axis. Please refer to the description on the xStart property for the property value setting.

polarX

The position of starting coordinate point on X-axis on the canvas when the date axis is a polar axis. Please refer to the description on the xStart property for the property value setting.

polarY

The position of starting coordinate point on Y-axis on the canvas when the date axis is a polar axis. Please refer to the description on the xStart property for the property value setting.

polarLength

The length of polar axis.

startAngle

The start angle of the date axis when it is a radial axis. When plotting the pie chart, you can use startAngle and endAngle to customize the sectors.

endAngle

The end angle of the date axis when it is a radial axis.

axisColor

The axis line color of a date axis.

axisLineStyle

The style of axis line. Options include the dotted line, solid line, and none.

axisLineWeight

The axis line weight of date axis.

axisArrow

The arrow style of date axis.

title

The title name of date axis.

titleFont

The title font style of date axis.

titleStyle

The title style of date axis. Please refer to the description on unitStyle of numeric axis.

titleSize

The title font size of date axis.

titleIndent

The blank space left by indenting the title of date axis.

titleColor

The color of title of date axis.

titleAngle

The rotation angle of the title of date axis.

allowLabels

Whether the labels will be displayed or not.

labelFont

The font of label values.

labelStyle

The label value style. Please refer to the unitStyle of numeric axis.

labelSize

The font size of label values.

labelIndent

The blank space between the label values and the axis.

labelColor

The font color of label values.

labelStep

The number of display intervals of labels and the value is not less than 0. The labelStep=0 indicates that all labels will be displayed, and labelStep=2 indicates a label value will be displayed every other 2 labels.

labelAngle

The rotation angle of label values

labelOverlapping

The overlappingof labels. If checked,labels are allowed to be overlapped; Otherwise, the overlapping labels are not allowed, andthey, if any, will be overridden and hidden.

scalePosition

Positions of tick marks, which can be displayed on the right or top, on the left or bottom, or across axis, or no tick marks appear. Once they are positioned, their values will change accordingly.

scaleStyle

The style of tick marks, including the dotted line, the solid line, and so on.

scaleWeight

The weight of tick marks.

scaleLength

The length of tick marks.

displayStep

The number of display intervals of scales and the value is not less than 0. The displayStep=0 indicates that all tick marks will be displayed, and displayStep=2 indicates a tick value will be displayed every other 2 ticks.

allowRegions

Whether the background region will be displayed or not.

regionLineStyle

The style of lines in the background region.

regionLineColor

Color of lines in the background region

regionLineWeight

The weight of lines in the background region

regionColors

Color of the background region

regionTransparent

Degree of transparency of the background region. The value range for it is [0,1], in which the 0 represents the 100% transparency (i.e. totally transparent), and the 1 represents full opaqueness. The values higher than 1 give the same total opaque effect as 1, and the values less than 0 represent the total transparency.

isPolygonalRegion

Whether it is a polygon background or not. This property is only valid in the polar coordinate system, and is fit for radar chart and other no-fill charts. There is no such polygonal effect with pie chart and other charts with fill colors. On the radar map, the shape of background region will change along with the number of categories.

Line[1659][1660]

endToHead

Whether it is an end-to-end closed polyline or not. To be one, check the closedArea property.

closedArea

Whether it is a closed area or not. When its value is true, a closed area will be formed by the polyline and the x-axis. But by checking endToHead property, the closed area will be formed by linking the start and end points of the polyline.

areaColor

The fill color of the closed area. The color can be pure or gradient.

stackType

Types of stacking include no stack, stacked by percent and stacked by value. Data series of the same category will be plotted by stacking in sequence.

radiateLine

Radiate lines or not. If set as true, radiate lines will be plotted by connecting the original point to each of other points.

stairLine

Stair lines or not. If set as true, start from the original point to connect to the next point with stair-like lines. Thus the final chart will be a stair line.

transparent

The degree of transparency for polyline. The value range for it is [0,1], in which the 0 represents the 100% transparency (i.e. totally transparent), and the 1 represents full opaqueness. The values higher than 1 give the same total opaque effect as 1, and the values less than 0 represent the total transparency as well.

textOverlapping

Whether the text overlapping is allowed or not. If it is checked, the text can be displayed with overlaps. Otherwise, the overlapping text will be overridden and hidden.

shadow

The shadow effect for line chart element

visible

Whether the line chart element is visible or not.

htmlLink

Hyperlinks to polylines.

tipTitle

Hyperlink tips to polylines.

linkTarget

The hyperlink destination. You can use_blank, _self, _parent and _top to open a hyperlink.

markerStyle

The shape of markers on a polyline.

lineStyle

Style of outline of the closed area formed with a polyline.

lineWeight

Thickness of the outline.

lineColor

Color of the outline.

markerColor

Fill color of the markers on a polyline.

markerWeight

Sizes of the markers which are measured by pixels.

radius1

Marker radius relative to axis1 and measured by percent of the axis. It determines the shape of markers along with radius2.

radius2

Marker radius relative to axis2 and measured by percent of the axis. It determines the shape of markers along with radius1.

text

Label text of markers on a polyline.

textFont

Label font.

textStyle

The label text font style. Please refer to textStyle of column chart/histogram.

textSize

Label text size

textColor

Label text color

axis1

The name of axis 1, which corresponds to numeric axis, enum axis, or date axis.

data1

The sequence composed of the logical coordinate values on axis 1. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

axis2

The name of axis 2, which correspond to numeric axis, enum axis, or date axis.

data2

The sequence composed of the logical coordinate values on axis 2. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

Dot[1661][1662]

transparent

The degree of transparency for a dot chart. The value range for it is [0,1], in which 0 represents the 100% transparency (i.e. totally transparent), and 1 represents full opaqueness. Values higher than 1 give the same total opaque effect as 1, and values less than 0 represent the total transparency.

textOverlapping

Whether the label text overlapping is allowed or not. If it is checked, the text can be displayed with overlaps. Otherwise, the overlapping text will be overridden and hidden.

shadow

Whether the dot element will take on the shadow effect or not.

visible

Whether the dot element is visible or not

htmlLink

Hyperlinks to dots.

tipTitle

Hyperlink tips to dots.

linkTarget

The hyperlink destination. You can use_blank, _self, _parent and _top to open a hyperlink.

markerStyle

The style of data markers in a scatter chart.

lineStyle

The style of dot element outline.

lineWeight

The weight of dot element outline.

lineColor

The color of dot element outline.

markerColor

The color of dots.

markerWeight

Sizes of the dots which are measured by pixels.

radius1

Marker radius relative to axis1 and measured by percent of the axis. It determines the shape of markers along with radius2.

radius2

Marker radius relative to axis2 and measured by percent of the axis. It determines the shape of markers along with radius1.

text

The label text of dot element.

textFont

The label text font.

textStyle

The label text font style. Please refer to textStyle of column chart/histogram.

textSize

Label text size

textColor

Label text color

axis1

The name of axis 1, which corresponds to numeric axis, enum axis, or date axis.

data1

The sequence composed of the logical coordinate values on axis 1. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

axis2

The name of axis 2, which corresponds to numeric axis, enum axis, or date axis.

data2

The sequence composed of the logical coordinate values on axis 2. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

Column[1663][1664]

shadow

Whether the chart element will take on the shadow effect or not.

convexEdge

Whether a protruding border will be plotted or not. It is valid only for the 2D/3D columns.

data3

The intial height of a column/histogram chart. The default value is 0. When setting the property, use a sequence whose length is equivalent with the longest sequence used by other peroperty. For instance, if there are 4 columns in a column chart, the value of data3 should be a sequence whose length is 4.

stackType

Types of stacking include no stack, stacked by percent and stacked by value. Data series of the same category will be plotted to be stacked in sequence.

textOverlapping

Whether the label text overlapping is allowed or not. If it is checked, the text can be displayed with overlaps. Otherwise, the overlapping text will be overridden and hidden.

transparent

The degree of transparency for column chart/histogram. The value range for it is [0,1], in which 0 represents the 100% transparency (i.e. totally transparent), and 1 represents full opaqueness. Values higher than 1 give the same total opaque effect as 1, and values less than 0 represent the total transparency.

visible

Indicates if the column chart/histogram is visible

htmlLink

Hyperlinks to columns in a column chart/histogram.

tipTitle

Hyperlink tips to columns.

linkTarget

The hyperlink destination. You can use_blank, _self, _parent and _top to open a hyperlink.

columnWidth

The width of column. The decimal values represent percentages, and values greater than 1 represent pixels. If measured by pixels, then the column width will remain unchanged when reaching the maximum pixel, and there is no interval between columns at this point. The column width is co-determined by the axis length, number of categories, and number of series.

columnShape

Column type, which can be the square column, 3D square column, and round column.

borderStyle

Column outline style.

borderWeight

Column outline weight.

borderColor

Column outline color.

fillColor

Fill color of a column.

horizontalAlign

The alignment of text in horizontal direction.

verticalAlign

The alignment of text in vertical direction.

text

Label text of column.

textFont

The label text font.

textStyle

Label text styles, including bold, italic, underline, and vertical text.

textSize

Label text font size.

textColor

The color of text.

axis1

The name of axis 1, which corresponds to numeric axis, enum axis, or date axis.

data1

The sequence composed of the logical coordinate values on axis 1. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

axis2

The name of axis 2, which corresponds to numeric axis, enum axis, or date axis.

data2

The sequence composed of the logical coordinate values on axis 2. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

Sector[1665][1666]

stackType

Types of stacking include no stack, stacked by percent and stacked by value. Data series of the same category will be plotted to be stacked in sequence. Pie/doughnut chart is stacked chart with one of the stacked type.

textOverlapping

Indicates if the label text overlapping is allowed. If it is checked, the text can be displayed with overlaps. Otherwise, the overlapping text will be overridden and hidden.

transparent

The degree of transparency for pie/doughnut chart. The value range for it is [0,1], in which 0 represents the 100% transparency (i.e. totally transparent), and 1 represents full opaqueness. Values higher than 1 give the same total opaque effect as 1, and values less than 0 represent the total transparency.

visible

Whether the sector/ring is visible or not.

htmlLink

Hyperlinks to sectors/rings in a pie/doughnut chart.

tipTitle

Hyperlink tips to sectors/rings.

linkTarget

The hyperlink destination. You can use_blank, _self, _parent and _top to open a hyperlink.

textLineStyle

Style of guide lines presenting label text.

textLineWeight

Thickness of guide lines presenting label text.

textLineColor

Color of guide lines presenting label text.

borderStyle

Type of outlines.

borderWeight

Weight of outlines.

borderColor

Color of outlines.

fillColor

Fill color of a sector/ring.

text

The label text for a sector/ring.

textFont

The label text font.

textStyle

The label text style. Please refer to textStyle of column charts/ histogram.

textSize

Label text size.

textColor

Label text color.

axis1

The name of axis 1, which corresponds to numeric axis, enum axis, or date axis.

data1

The sequence composed of the logical coordinate values on axis 1. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

axis2

The name of axis 2, which corresponds to numeric axis, enum axis, or date axis.

data2

The sequence composed of the logical coordinate values on axis 2. When plotting, the logical coordinate values will be converted to the physical coordinate values automatically.

GraphColumn[1667][1668]

columnType

Column types include basic column, 3D column, 3D clustered columns, stacked columns, 3D stacked columns, as well as basic bar, 3D clustered bars, stacked bars and 3D stacked bars.

barDistance

The space between columns/bars in a column/bar chart.

columnBorderColor

The color of column/bar outline.

categories

Specifies the categories of data. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Tom","Mary"] is auto-retrieved as the category values.

values

Plotting data of a specified type of graph, referred to as data of multiple series in each category.

xTitle

Text of X-axis, or the horizontal axis, title, which is generally displayed below the axis.

xTitleFont

X-axis title text font.

xTitleBold

Whether the X-axis title text is bold or not.

xTitleVertical

Whether the X-axis title text is vertical or not.

xTitleSize

X-axis title text font size.

xTitleColor

X-axis title text color.

xTitleAngle

Angle of rotation of X-axis title text.

yTitle

Text of Y-axis, or the verticle axis, title, which is generally displayed on the left side of the axis.

yTitleFont

Y-axis title text font.

yTitleBold

Whether the Y-axis title text is bold or not.

yTitleVertical

Whether the Y-axis title text is vertical or not.

yTitleSize

Y-axis title text font size.

yTitleColor

Y-axis title text color.

yTitleAngle

Angle of rotation of Y-axis title text.

xLabelFont

X-axis label text font.

xLabelBold

Indicates if the X-axis label text is bold.

xLabelVertical

Whether the X-axis label text is vertical or not.

xLabelSize

X-axis label text font size.

xLabelColor

X-axis label text color.

xLabelAngle

Angle of rotation of X-axis labels.

xLabelInterval

The interval between labels on X-axis. If xLabelInterval=0, display every label; if xLabelInterval=2, display a label every other 2 label positions.

yLabelFont

Y-axis label text font.

yLabelBold

Whether the Y-axis label text is bold or not.

yLabelVertical

Whether the Y-axis label text is vertical or not.

yLabelSize

Y-axis label text font size.

yLabelColor

Y-axis label text color.

yLabelAngle

Angle of rotation of Y-axis labels.

yLabelInterval

The interval between labels on Y-axis. If yLabelInterval=1, display every label by adding 1 to every label value; if yLabelInterval=2, display every label by adding 2 to every label value.

yStartValue

The starting value of statistical values of Y-axis labels.

yEndValue

The ending value of statistical values of Y-axis labels.

yMinMarks

The minimum number of labels on Y-axis.

gridLineType

Styles of grid lines.

gridLineColor

Color of grid lines.

warnLineData

Warning value specified for plotting a warn line, which is numeric data.

warnLineStyle

Line styles of the warning line, which include dotted line, solid line and none.

warnLineWeight

Warning line weight, whose value is an integer and measured in pixels. Being 0 means hiding the warning line.

warnLineColor

Color of the warning line.

axisTopColor

The color of upper half the axis.

axisBottomColor

The color of lower half the axis.

axisLeftColor

The color of left half the axis.

axisRightColor

The color of right half the axis.

graphBackColor

Background color of the chart area, i.e. the coordinate plane.

canvasColor

Background color of the canvas.

legendBorderColor

Color of legend border.

borderStyle

Style of canvas outline.

borderWidth

Canvas outline weight.

borderColor

Canvas outline color.

borderShadow

Display shadow effect for the canvas or not.

graphTitle

The text title of the column chart, which is generally displayed above the graphs.

graphTitleFont

Font for the chart title.

graphTitleBold

Whether the chart title uses the bold or not.

graphTitleVertical

Whether the chart title uses vertical text or not.

graphTitleSize

Font size for the chart title.

graphTitleColor

Color for the chart title.

graphTitleAngle

Angle of rotation of chart title.

graphTitleMargin

The space left for the chart title, or distance between the top edge of the graph and the top of the canvas. The value is an integer and is measured in pixels.

displayData

Types of displaying data, including not to display, and display by percent or by values.

displayDataFormat

Format for displaying user-defined data labels.

dataFont

Font for data labels.

dataBold

Whether data labels use the bold or not.

dataVertical

Whether data labels use the vertical text or not.

dataSize

Font size for data labels.

dataColor

Data label color.

dataAngle

Angle of rotation of data labels.

legendLocation

Position of the legend in a chart. Position options include not display, as well as display at the top, in the bottom, on the left and on the right.

drawLegendBySery

Whether the legend according to series data or not. Generally legends are plotted based on data series, but if there is only one series, checking this property means plotting legend using series data and not checking means using category data to plot it.

legendFont

Font of legend text.

legendBold

Whether the legend text is bold or not.

legendVertical

Whether the legend text is vertical or not.

legendSize

Font size of legend text.

legendColor

Legend text color.

legendAngle

Angle of rotation of the legend text.

graphTransparent

Whether display graphs in transparency or not. This property is used with 3D graphs.

gradientColor

Whether use gradient color or not for graphs.

showOverlapText

Whether display overlapping neighbouring values, labels or legend text or not. If checked, display those just mentioned; otherwise they are overridden and hidden.

topData

Use data with top values to plot a chart. If there are many categories of data, use top rows of data with greatest values to plot the chart, so that graphs in the resulting chart will not be too dense to reduce the readability.

In this case, to maintain data integrity, the system will combine the rest of the categories of data into a whole and display them as an individual “Others” category.

GraphLine[1669][1670]

lineType

Line types include polyline chart, 3D polyline chart, curve chart and radar chart.

categories

The categories of data. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Tom","Mary"] is auto-retrieved as the category values.

values

Plotting data of a specified type of graph, referred to as data of multiple series in each category.

drawLineDot

It plots data points, which are dots for marking positions of data. If checked, plot a dot corresponding to the label of each data category.

drawLineTrend

Whether draw a trend line or not by marking the change of data positions in a polyline

drawShade

Whether display shading effects for a chart or not

ignoreNull

It determines whether to plot records whose values are nulls or not.

lineThick

The thickness of a polyline and a trend line.

lineStyle

Styles of the polyline and trend line, including dotted line, solid line, none, and etc.

xTitle

Text of X-axis, or the horizontal axis, title, which is generally displayed below the axis.

xTitleFont

X-axis title text font.

xTitleBold

Whether the X-axis title text is bold or not.

xTitleVertical

Whether the X-axis title text is vertical or not.

xTitleSize

X-axis title text font size.

xTitleColor

X-axis title text color.

xTitleAngle

Angle of rotation of X-axis title text.

yTitle

Text of Y-axis, or the verticle axis, title, which is generally displayed on the left side of the axis.

yTitleFont

Y-axis title text font.

yTitleBold

Whether the Y-axis title text is bold or not.

yTitleVertical

Whether the Y-axis title text is vertical or not.

yTitleSize

Y-axis title text font size.

yTitleColor

Y-axis title text color.

yTitleAngle

Angle of rotation of Y-axis title text.

xLabelFont

X-axis label text font.

xLabelBold

Whether the X-axis label text is bold or not.

xLabelVertical

Whether the X-axis label text is vertical or not.

xLabelSize

X-axis label text font size.

xLabelColor

X-axis label text color.

xLabelAngle

Angle of rotation of X-axis labels.

xLabelInterval

The interval between labels on X-axis. If xLabelInterval=0, display every label; if xLabelInterval=2, display a label every other 2 label positons.

yLabelFont

Y-axis label text font.

yLabelBold

Whether the Y-axis label text is bold or not.

yLabelVertical

Whether the Y-axis label text is vertical or not.

yLabelSize

Y-axis label text font size.

yLabelColor

Y-axis label text color.

yLabelAngle

Angle of rotation of Y-axis labels.

yLabelInterval

The interval between labels on Y-axis. If yLabelInterval=1, display every label by adding 1 to every label value; if yLabelInterval=2, display every label by adding 2 to every label value.

yStartValue

The starting value of statistical values of Y-axis labels.

yEndValue

The ending value of statistical values of Y-axis labels.

yMinMarks

The minimum number of labels on Y-axis.

gridLineType

Styles of grid lines.

gridLineColor

Color of grid lines.

warnLineData

Warning value specified for plotting a warn line, which is numeric data.

warnLineStyle

Line styles of the warning line, which include dotted line, solid line and none.

warnLineWeight

Warning line weight, whose value is an integer and measured in pixels. Being 0 means hiding the warning line.

warnLineColor

Color of the warning line.

axisTopColor

The color of upper half the axis.

axisBottomColor

The color of lower half the axis.

axisLeftColor

The color of left half the axis.

axisRightColor

The color of right half the axis.

graphBackColor

Background color of the chart area, i.e. the coordinate plane.

canvasColor

Background color of the canvas.

legendBorderColor

Color of legend border.

borderStyle

Style of canvas outline.

borderWidth

Canvas outline weight.

borderColor

Canvas outline color.

borderShadow

Indicates if display shadow effect for the canvas.

graphTitle

The text title of the column chart, and generally displayed above the graphs.

graphTitleFont

Font for the chart title.

graphTitleBold

Whether the chart title uses the bold or not.

graphTitleVertical

Whether the chart title uses vertical text or not.

graphTitleSize

Font size for the chart title.

graphTitleColor

Color for the chart title.

graphTitleAngle

Angle of rotation of chart title.

graphTitleMargin

The space left for the chart title, or distance between the top edge of the graph and the top of the canvas. The value is an integer and is measured in pixels.

displayData

Styles of displaying data, including not to display, and display by percent or by values.

displayDataFormat

Format for displaying data labels.

dataFont

Font for data labels.

dataBold

Whether data labels use the bold or not.

dataVertical

Whether data labels use the vertical text or not.

dataSize

Font size for data labels.

dataColor

Data label color.

dataAngle

Angle of rotation of data labels.

legendLocation

Position of the legend in a chart. Position options include not display, as well as display at the top, in the bottom, on the left and on the right.

drawLegendBySery

Whether the legend is plotted according to series data or not. Generally legends are plotted based on data series, but if there is only one series, checking this property means plotting legend using series data and not checking means using category data to plot it.

legendFont

Font of legend text.

legendBold

Whether the legend text is bold or not.

legendVertical

Whether the legend text is vertical or not.

legendSize

Font size of legend text.

legendColor

Legend text color.

legendAngle

Angle of rotation of the legend text.

graphTransparent

Whether display graphs in transparency or not. This property is used with 3D graphs.

gradientColor

Whether use gradient color for graphs or not.

showOverlapText

Whether or not display overlapping neighbouring values, labels or legend text. If checked, display those just mentioned; otherwise they are overridden and hidden.

topData

It uses data with top values to plot a chart. If there are many categories of data, use top rows of data with greatest values to plot the chart, so that graphs in the resulting chart will not be too dense to reduce the readability.

In this case, to maintain data integrity, the system will combine the rest of the categories of data into a whole and display them as an individual “Others” category.

GraphPie[1671][1672]

pieType

Types of pie charts include basic pie chart and 3D pie charts.

pieSpacing

Whether explode one of the sectors of the pie or not. 

pieRotation

It sets the rotation angle by specifying the ratio of the length of the radial axis to that of the polar axis in a 3D pie chart.

pieHeight

It sets the 3D pie chart height by specifying the ratio of pie height to the radius.

pieJoinLineColor

The color for guide lines for presenting label text in a 3D pie chart.

categories

The categories of data. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Tom","Mary"] is auto-retrieved as the category values.

values

Plotting data of a specified type of graph, referred to as data of multiple series in each category.

borderStyle

Style of canvas outline.

borderWidth

Canvas outline weight.

borderColor

Canvas outline color.

borderShadow

Whether display shadow effect for the canvas or not.

graphTitle

The text title of the column chart, and generally displayed above the graphs.

graphTitleFont

Font for the chart title.

graphTitleBold

Whether the chart title uses the bold or not.

graphTitleVertical

Whether the chart title uses vertical text or not.

graphTitleSize

Font size for the chart title.

graphTitleColor

Color for the chart title.

graphTitleAngle

Angle of rotation of chart title.

graphTitleMargin

The space left for the chart title, or distance between the top edge of the graph and the top of the canvas. The value is an integer and is measured in pixels.

displayData

Styles of displaying data, including not to display, and display by percent or by values.

displayDataFormat

Format for displaying data labels.

dataFont

Font for data labels.

dataBold

Whether data labels use the bold or not.

dataVertical

Whether data labels use the vertical text or not.

dataSize

Font size for data labels.

dataColor

Data label color.

dataAngle

Angle of rotation of data labels.

legendLocation

Position of the legend in a chart. Position options include not display, as well as display at the top, in the bottom, on the left and on the right.

drawLegendBySery

Whether the legend is plotted according to series data or not. Generally legends are plotted based on data series, but if there is only one series, checking this property means plotting legend using series data and not checking means using category data to plot it.

legendFont

Font of legend text.

legendBold

Whether the legend text is bold or not.

legendVertical

Whether the legend text is vertical or not.

legendSize

Font size of legend text.

legendColor

Legend text color.

legendAngle

Angle of rotation of the legend text.

canvasColor

Background color of the canvas.

legendBorderColor

Color of legend border.

graphTransparent

Whether display graphs in transparency or not. This property is used with 3D graphs.

gradientColor

Whether use gradient color for graphs or not.

showOverlapText

Whether or not display overlapping neighbouring values, labels or legend text. If checked, display those just mentioned; otherwise they are overridden and hidden.

topData

It uses data with top values to plot a chart. If there are many categories of data, use top rows of data with greatest values to plot the chart, so that graphs in the resulting chart will not be too dense to reduce the readability.

In this case, to maintain data integrity, the system will combine the rest of the categories of data into a whole and display them as an individual “Others” category.

Graph2Axis[1673][1674]

type

Types of two-axis chart include two-axis column-and-line chart and two-axis polyline chart.

categories

The categories of data. If not specified, then select from the crossover sequence of the series and categories. For example, from the crossover sequence =["Tom, Maths","Tom, English","Tom, French","Mary, Maths","Mary,English","Mary,French"], the ["Tom","Mary"] is auto-retrieved as the category values.

values

Plotting data of a specified type of graph, referred to as data of multiple series in each category. For a two-axis column-and-line chart, if the number of series – n - is an even number, plot one half of the number as columns and another half as lines. If n is an odd number greater than 1, the number of columns to be plotted is n+1/2 and the rest of series will be plotted as lines. This way the number of columns is always one more than that of lines.

drawLineDot

It plots data points, which are dots for marking positions of data. If checked, plot a dot corresponding to the label of each data category.

drawShade

Whether display shading effects for a chart or not

ignoreNull

It determines whether to plot records whose values are nulls.

lineThick

The thickness of a polyline and a trend line.

lineStyle

Styles of the polyline and trend line, including dotted line, solid line, none, and etc.

xTitle

Text of X-axis, or the horizontal axis, title, which is generally displayed below the axis.

xTitleFont

X-axis title text font.

xTitleBold

Whether the X-axis title text is bold or not.

xTitleVertical

Whether the X-axis title text is vertical or not.

xTitleSize

X-axis title text font size.

xTitleColor

X-axis title text color.

xTitleAngle

Angle of rotation of X-axis title text.

yTitle

Text of Y-axis, or the verticle axis, title, which is generally displayed on the left side of the axis.

yTitleFont

Y-axis title text font.

yTitleBold

Whether the Y-axis title text is bold or not.

yTitleVertical

Whether the Y-axis title text is vertical or not.

yTitleSize

Y-axis title text font size.

yTitleColor

Y-axis title text color.

yTitleAngle

Angle of rotation of Y-axis title text.

xLabelFont

X-axis label text font.

xLabelBold

Whether the X-axis label text is bold or not.

xLabelVertical

Whether the X-axis label text is vertical or not.

xLabelSize

X-axis label text font size.

xLabelColor

X-axis label text color.

xLabelAngle

Angle of rotation of X-axis labels.

xLabelInterval

The interval between labels on X-axis. If xLabelInterval=0, display every label; if xLabelInterval=2, display a label every other 2 label positons.

yLabelFont

Y-axis label text font.

yLabelBold

Whether the Y-axis label text is bold or not.

yLabelVertical

Whether the Y-axis label text is vertical or not.

yLabelSize

Y-axis label text font size.

yLabelColor

Y-axis label text color.

yLabelAngle

Angle of rotation of Y-axis labels.

yLabelInterval

The interval between labels on Y-axis. If yLabelInterval=1, display every label by adding 1 to every label value; if yLabelInterval=2, display every label by adding 2 to every label value.

yStartValue

The starting value of statistical values of Y-axis labels.

yEndValue

The ending value of statistical values of Y-axis labels.

yMinMarks

The minimum number of labels on Y-axis.

yLabelInterval2

The interval between labels on the right Y-axis. If yLabelInterval=1, display every label by adding 1 to every label value; if yLabelInterval=2, display every label by adding 2 to every label value.

yStartValue2

The starting value of statistical values of the right Y-axis labels.

yEndValue2

The ending value of statistical values of the right Y-axis labels.

gridLineType

Styles of grid lines.

gridLineColor

Color of grid lines.

warnLineData

Warning value specified for plotting a warn line, which is numeric data.

warnLineStyle

Line styles of the warning line, which include dotted line, solid line and none.

warnLineWeight

Warning line weight, whose value is an integer and measured in pixels. Being 0 means hiding the warning line.

warnLineColor

Color of the warning line.

axisTopColor

The color of upper half the axis.

axisBottomColor

The color of lower half the axis.

axisLeftColor

The color of left half the axis.

axisRightColor

The color of right half the axis.

graphBackColor

Background color of the chart area, i.e. the coordinate plane.

canvasColor

Background color of the canvas.

legendBorderColor

Color of legend border.

borderStyle

Style of canvas outline.

borderWidth

Canvas outline weight.

borderColor

Canvas outline color.

borderShadow

Whether display shadow effect for the canvas or not.

graphTitle

The text title of the column chart, which is generally displayed above the graphs.

graphTitleFont

Font for the chart title.

graphTitleBold

Whether the chart title uses the bold or not.

graphTitleVertical

Whether the chart title uses vertical text or not.

graphTitleSize

Font size for the chart title.

graphTitleColor

Color for the chart title.

graphTitleAngle

Angle of rotation of chart title.

graphTitleMargin

The space left for the chart title, or distance between the top edge of the graph and the top of the canvas. The value is an integer and is measured in pixels.

displayData

Types of displaying data, including not to display, and display by percent or by values.

displayDataFormat

Format for displaying data labels.

dataFont

Font for data labels.

dataBold

Whether data labels use the bold or not.

dataVertical

Whether data labels use the vertical text or not.

dataSize

Font size for data labels.

dataColor

Data label color.

dataAngle

Angle of rotation of data labels.

legendLocation

Position of the legend in a chart. Position options include not display, as well as display at the top, in the bottom, on the left and on the right.

drawLegendBySery

Whether the legend is plotted according to series data or not. Generally legends are plotted based on data series, but if there is only one series, checking this property means plotting legend using series data and not checking means using category data to plot it.

legendFont

Font of legend text.

legendBold

Whether the legend text is bold or not.

legendVertical

Whether the legend text is vertical or not.

legendSize

Font size of legend text.

legendColor

Legend text color.

legendAngle

Angle of rotation of the legend text.

graphTransparent

Whether display graphs in transparency or not. This property is used with 3D graphs.

gradientColor

Whether use gradient color for graphs or not.

showOverlapText

Whether or not display overlapping neighbouring values, labels or legend text. If checked, display those just mentioned; otherwise they are overridden and hidden.

topData

It uses data with top values to plot a chart. If there are many categories of data, use top rows of data with greatest values to plot the chart, so that graphs in the resulting chart will not be too dense to reduce the readability.

In this case, to maintain data integrity, the system will combine the rest of the categories of data into a whole and display them as an individual “Others” category.

BackGround[1675][1676]

backColor

The background color of canvas.

transparent

The transparency degree of background chart element. The value range for the degree of transparency is [0,1], in which 0 represents the 100% transparency (i.e. totally transparent), and 1 represents full opaqueness. Values higher than 1 give the same total opaque effect as 1, and values less than 0 represent the total transparency.

visible

Whether the background is visible or not.

imageValue

The content of background element. The value can be a path or a byte array in the form of byte[]; the path can be set under the property value. If the image file is stored in a searching path in the system environment, a file name is enough, like a.png; an absolute path, like d:/a.png, is also supported. The byte array can be set through a property value expression; byte[] is the byte array of the background image.

imageMode

The fill mode of background element. The default position is on the upper left.

Text[1677][1678]

text

The contents of text.

visible

Whether the text is visible or not.

x

The starting X-coordinate of text element. Please refer to the description on the xStart property of the numeric axis.

y

The starting Y-coordinate of text element. Please refer to the description on the xStart property of the numeric axis.

textFont

The font of text.

textStyle

The style of text. Please refer to the description on unitStyle property of the numeric axis.

textSize

The text font size.

textColor

The color of text.

text Angle

The rotation angle of text.

hAlign

The horizontal alignment style of text contents relative to the center coordinates.

vAlign

The vertical alignment style of text contents relative to the center coordinates.

barType

Bar code type.

charSet

Character set.

dispText

Display text; the property is valid when no dimensional code is generated.

recError

Error rate.

logoValue

Logo image content; only valid with two-dimensional code.

logoSize

The size of a logo image, measured in percentages; only valid with two-dimensional code.

logoFrame

Logo image frame; only valid with two-dimensional code.

Legend[1679][1680]

legendText

The text contents of legend.

backColor

The background color.

columns

The number of columns for the legend layout. This property can be used to set the legend orientation of either landscape or portrait.

transparent

The degree of transparency of background of legends The value range for it is [0,1], in which the 0 represents the 100% transparency (i.e. totally transparent), and the 1 represents full opaqueness. The values higher than 1 give the same total opaque effect as 1, and the values less than 0 represent the total transparency.

iconWidth

The width of icons in the legend, measured in pixels

edgeIndent

The blank space left between the legend borders and the legend position.

visible

Whether the legend is visible or not.

htmlLink

Hyperlinks to the icons of a legend.

tipTitle

Hyperlink tips to icons of a legend.

linkTarget

The hyperlink destination. You can use_blank, _self, _parent and _top to open a hyperlink.

x

The X-coordinates of legends. For the value, please refer to description on the xStart property of the numeric axis.

y

The y-coordinates of legends. For the value, please refert to the description on xStart property of the NumericAxis.

width

The width of legend area.

height

The height of legend area.

borderStyle

The border style of legend area.

borderWeight

The border weight of legend area.

borderColor

The border color of legend area.

textFont

The text font of legend.

textStyle

The text font style of legend. Please refer to textStyle of column chart/histogram.

textSize

The text font size of legend

textColor

The text font color of legend.

legendType

The type of icons in the legend area, including rectangle, dot, line, dotted line, or none.

legendLineStyle

The style of icon outlines in the legend region.

legendLineWeight

The line weight of icon outlines in the legend region.

legendLineColor

The line color of icon outlines in the legend region.

legendFillColor

The fill color of icons in the legend area

legendMarkerShape

The style of legend point in the legend area. The setting is valid when the legendType is the dots or dotted lines.



[1] url:sjlx

[2] key:function, convert

[3] url:czf

[4] key:function, basic operations

[5] url:sx

[6] key:function, mathematical operations

[7] url:zfc

[8] key:string function

[9] url:rqsj

[10] key:function,year,month,day,quater

[11] url:xl

[12] key:sequence function

[13] url:xb

[14] key:table sequence function

[15] url:xhhs

[16] key:loop operation

[17] url:glys

[18] key:associative operation

[19] url:wj

[20] key:file-handling operation

[21] url:sjk

[22] key:database function

[23] url:yb

[24] key:cursor function, channel

[25] url:cxyj

[26] key:statement

[27] url:xtyjk

[28] key:function,JDBC

[29] url:jq

[30] key:function, node

[31] url:tx

[32] key:chart-plotting function, canvas

[33] url:cw

[34] key:financial function, interest, coupon

[35] url:wbk

[36] key:external library, database

[37] url:zb

[38] key:composite table, cursor, memory table

[39] url:function

[40] key:esProc functions

[41] url:c2

[42] key:loop, loop number

[43] url:dbsql

[44] key:dbsql

[45] url:dbsqljdbc

[46] key:data source,sql,table sequence

[47] url:dbsqlesjdbc

[48] key:data source,sql,result set

[49] url:sql

[50] key:simple SQL, query

[51] url:macroexp

[52] key:macro replacement

[53] url:expression

[54] key:JDBC,execute statement, return result set

[55] url:statement

[56] key:JDBC,execute statement, result set

[57] url:ab0

[58] key:sequence,cell,value

[59] url:qa0

[60] key:sequence,current cell value,member

[61] url:a

[62] key:a

[63] url:ai

[64] key:sequence,specified sequence number,member value

[65] url:ap

[66] key:member, new sequence

[67] url:ax

[68] key:sequence,member,expression

[69] url:a1an

[70] key:sequence,constant

[71] url:abs

[72] key:parameter,absolute value,numeric

[73] url:acos

[74] key:arc consine

[75] url:acosh

[76] key:inverse hyperbolic cosine,real number

[77] url:age

[78] key:time,interval,year,month,day

[79] url:align

[80] key:sequence,sort,align

[81] url:aliclient

[82] key:connect to Alibaba Cloud,cursor

[83] url:aliclose

[84] key:close,Alibaba Cloud

[85] url:aliquery

[86] key:query data,cursor

[87] url:and

[88] key:integer,AND

[89] url:append

[90] key:append

[91] url:tappendcs

[92] key:cursor,record,base table, attached table

[93] url:fappend

[94] key:concatenate,composite table file

[95] url:arguments

[96] key:specified position,unicode value,ascii,integer

[97] url:array

[98] key:array

[99] url:rarray

[100] key:get field value,sequence

[101] url:asc

[102] key:specified position,Unicode value,asci,integer

[103] url:asin

[104] key:arc sine

[105] url:asinh

[106] key:inverse hyperbolic sine

[107] url:atan

[108] key:arc tangent

[109] url:atanh

[110] key:inverse hyperbolic tangent

[111] url:attach

[112] key:attach

[113] url:tattacht

[114] key:cluster composite table,cluster attached table

[115] url:tattachtc

[116] key:composite table,attached table

[117] url:chattach

[118] key:channel,attach an operation

[119] url:avg

[120] key:avg

[121] url:aavg

[122] key:non-null member,average

[123] url:aavgx

[124] key:sequence,non-null member,average

[125] url:base64

[126] key:encode,blob

[127] url:between

[128] key:check,boolean value

[129] url:bits

[130] key:decimal,numeric

[131] url:bool

[132] key:convert,boolean value

[133] url:breaka

[134] key:break loop

[135] url:C

[136] key:composite table,column

[137] url:C1

[138] key:parent table, higher level parent table,column reference

[139] url:tc

[140] key:attached table column

[141] url:TfC

[142] key:attached table,aggregation

[143] url:TxC

[144] key:attached table,records,sub table sequence

[145] url:Cr

[146] key:cell name

[147] url:calc

[148] key:compute an expression,result

[149] url:acalc

[150] key:compute an expression,result

[151] url:call

[152] key:cellset file, first result set

[153] url:callpathdfx

[154] key:JDBC,search for a program file

[155] url:callx

[156] key:parallel algorithm,cellset file, multiple subtasks

[157] url:cand

[158] key:table sequence,logical AND,boolean vlaue

[159] url:canvas

[160] key:canvas object,plotting

[161] url:case

[162] key:return result,return null

[163] url:ceil

[164] key:specified position,truncate,remaining part,move the decimal point to the right

[165] url:cgroups

[166] key:cgroups

[167] url:tcgroupsfiygiw

[168] key:cube,grouping,filtering

[169] url:ch

[170] key:channel, expression, attached operation

[171] url:channel

[172] key:channel

[173] url:channel1

[174] key:create,return a channel

[175] url:channelcs1

[176] key:return a channel

[177] url:channelcs2

[178] key:return a cluster channel

[179] url:channelch1

[180] key:return a channel

[181] url:channelch2

[182] key:return a cluster channel

[183] url:char

[184] key:unicode,ascii, corresponding character

[185] url:clear

[186] key:clear cell value

[187] url: clipboard

[188] key:clipboard content

[189] url:close

[190] key:close

[191] url:csclose

[192] key:close cursor,release cursor resource

[193] url:dbclose

[194] key:close datasource,database connection

[195] url:Tclose

[196] key:close a composite table

[197] url:cmp

[198] key:compare,expression,sequence

[199] url:cor

[200] key:sequence,logical OR,boolean value

[201] url:combin

[202] key:combinations,integer,number

[203] url:commit

[204] key:commit manually,database

[205] url:dbcommit

[206] key:commit manually,database

[207] url:concat

[208] key:concat

[209] url:concatxi

[210] key:parameter,concatenate,string

[211] url:aconcatd

[212] key:delimiter,concatenate,string

[213] url:conj

[214] key:conj

[215] url:aconj

[216] key:sequence,concatenate,new sequence

[217] url:chconj

[218] key:split,channel,union

[219] url:csconj

[220] key:split,cursor,union,multicursor

[221] url:conjx

[222] key:conjx

[223] url:csconjx

[224] key:union,cursor sequence,cursor

[225] url:connect

[226] key:establish,data source connection

[227] url:contain

[228] key:contain

[229] url:acontainx

[230] key:check,sequence member

[231] url:cos

[232] key:cosine,radian,float

[233] url:cosh

[234] key:hyperbolic cosine

[235] url:count

[236] key:count

[237] url:acountx

[238] key:sequence,non-null member,integer

[239] url:acount

[240] key:sequence,non-null member,count

[241] url:create

[242] key:create

[243] url:createfi

[244] key:create,empty table sequence

[245] url:createxfi

[246] key:create,key,empty table sequence

[247] url:fcreate

[248] key:cluster file,cluster composite table,duplicate

[249] url:fcreatep

[250] key:cluster file,cluster composite table,duplicate

[251] url:fcreatecbkb

[252] key:file,create a composite table

[253] url:fcreatecbkbp

[254] key:file,create a cluster composite table

[255] url:tcreate

[256] key:duplicate,new table sequence

[257] url:rcreate

[258] key:copy,new table sequence

[259] url:cs

[260] key:cursor,expression

[261] url:cuboid

[262] key:cuboid

[263] url:tcuboidcfiygi

[264] key:pre-summarized data cube,grouping,entity table

[265] url:cum

[266] key:loop,iterative operation,same field value,cumulative value

[267] url:cursor

[268] key:cursor

[269] url:cursordfx

[270] key:genrate a cursor,path

[271] url:cursorcsdfx

[272] key:cursor-generating,path

[273] url:acursor

[274] key:retrieve,cursor

[275] url:dbcursor

[276] key:SQL,database cursor,automatically close

[277] url:fcursor

[278] key:file,create a cursor,automatically close

[279] url:tcursorcwkn

[280] key:attached table, distributed,segment

[281] url:tcursorcwkn1

[282] key:cluster memory table,cluster entity table,specified column

[283] url:tcursorcwmcs

[284] key:multicursor,segment,attached table

[285] url:tcursorcwmcs1

[286] key:cluser multicursor,segment,cluster entity table

[287] url:tcursorkn

[288] key:segment,cursor

[289] url:tcursorwmcs

[290] key:memory table,multicursor,memory multicursor

[291] key:mcscursorn

[292] url:common cursor,multicursor with a specified number of parallel subcursors

[293] url:date

[294] key:date

[295] url:datedatetimeexp

[296] key:datetime,get date

[297] url:datestring

[298] key:string,integer,date value

[299] url:fdate

[300] key:last modified time and date

[301] url:datetime

[302] key:datetime

[303] url:datetimedatetimeexp

[304] key:precision,datetime value

[305] url:datetimestring

[306] key:string,long integer,datetime

[307] url:day

[308] key:date value,month

[309] url:days

[310] key:specified date,year,quarter,month,number of days,integer

[311] url:decimal

[312] key:string,numeric value,big decimal number

[313] url:delete

[314] key:delete

[315] url:tdelete

[316] key:delete,table sequence,record

[317] url:adelete

[318] key:delete,specified

[319] url:tdeletep

[320] key:delete,specified

[321] url:tdeletep1

[322] key:delete,specified records

[323] url:tdeletep2

[324] key:delete,specified record

[325] url:dep

[326] key:two date values,equal

[327] url:derive

[328] key:derive

[329] url:aderivexifi

[330] key:table sequence,record sequence,added field

[331] url:pderive

[332] key:generate a table sequence,copy data structure

[333] url:chderive

[334] key:channel,add field,field name

[335] url:csderive

[336] key:cursor,add field,field name

[337] url:tderive

[338] key:key value,field-adding

[339] url:csderiveacsxc

[340] key:key value,cluster,field-adding

[341] url:dfx

[342] key:search for and execute a program,server

[343] url:diff

[344] key:diff

[345] url:adiff

[346] key:sequence,first,remove

[347] url:adiffx

[348] key:first,remove,difference

[349] url:directory

[350] key:wildcard path,file name

[351] url:directorypath

[352] key:wildcard path,file name

[353] url:dup

[354] key:dup

[355] url:tdup

[356] key:cluster memory table,local memory table

[357] url:tduph

[358] key:local memory table,copy,node sequence

[359] url:elapse

[360] key:new date,year,quarter,month,day

[361] url:ends

[362] key:error message,log,terminate

[363] url:enum

[364] key:enumeration,group

[365] url:penumey

[366] key:enumeration,group

[367] url:env

[368] key:global variable,task variable

[369] url:eq

[370] key:change position,boolean value

[371] url:aeqb

[372] key:change position,boolean value

[373] url:error

[374] key:data source connection,last error

[375] url:dberror

[376] key:database connection,last error

[377] url:eval

[378] key:dynamically parse,compute,expression

[379] url:esclose

[380] key:close restclient,release resource

[381] url:esdelete

[382] key:execute delete,boolean value

[383] url:eshead

[384] key:execute head,table sequence

[385] url:esopen

[386] key:connect to server,http protocol,restclient object

[387] url:esget

[388] key:execute get,table sequence,cursor

[389] url:espost

[390] key:execute post,table sequence,cursor

[391] url:esput

[392] key:execute put,table sequence

[393] url:execute

[394] key:database,execute SQL

[395] url:dbexecute

[396] key:database,execute SQL

[397] url:exists

[398] key:exist,file object

[399] url:fexists

[400] key:exist,file object

[401] url:exp

[402] key:en,numeric

[403] url:export

[404] key:export

[405] url:aexport

[406] key:sequence,string

[407] url:fexportaxfs

[408] key:sequence,write to a file

[409] url:fexportcsxfs

[410] key:cursor,write to text file

[411] url:fao

[412] key:complex function,syntax

[413] url:faccrint

[414] key:periodic interest,security,accrued interest

[415] url:faccrintm

[416] key: pay interest at maturity,security,accrued interest

[417] url:fact

[418] key:factorial,long integer

[419] url:false

[420] key:logical constant,false

[421] url:fcoupcd

[422] key:settlement date

[423] url:fcoups

[424] key: number of coupons payable, settlement date

[425] url:fdb

[426] key: fixed-declining balance method, depreciation

[427] url:fddb

[428] key: double-declining balance method, depreciation

[429] url:fdisc

[430] key:security, discount rate

[431] url:fduration

[432] key:security, modified duration, weighted average

[433] url:fetch

[434] key:fetch

[435] url:csfetch

[436] key:cursor,fetch records

[437] url:chfetch

[438] key:channel,set function

[439] url:mcsfetch

[440] key:multicursor,get record,different order

[441] url:field

[442] key:field

[443] url:rfieldf

[444] key:record,get field value

[445] url:rfieldfx

[446] key:modify,specified field value

[447] url:afieldf

[448] key:get field value,sequence

[449] url:afieldfx

[450] key:modify,specified field value

[451] url:file

[452] key:file

[453] url:filefncs

[454] key:open a file,specified file name

[455] url:filefnics

[456] key:filegroup with specified name

[457] url:filefnh

[458] key:remote file,composite table file,cluster file,node

[459] url:filefnzh

[460] key:remote file,node,partition

[461] url:filename

[462] key:split up,full path,get file name,suffix

[463] url:fill

[464] key:concatenate,string

[465] url:find

[466] key:find

[467] url:afind

[468] key:primary key,binary search

[469] url:tfindk

[470] key:find record,specified key value

[471] url:tfindk1

[472] key:get records,specified key values

[473] url:fintrate

[474] key: pays interest at maturity, security, interest rate

[475] url:firr

[476] key: cash flow, internal rate of return

[477] url:float

[478] key: double-precision floating-point numbe

[479] url:floor

[480] key: truncate data at specified position, reject remaining part

[481] url:fmirr

[482] key: a series of periodic cash flows, modified internal rate of return

[483] url:fname

[484] key:fname

[485] url:tfnamei

[486] key:field serial number,field name

[487] url:rfnamei

[488] key:field serial number,field name

[489] url:fno

[490] key:fno

[491] url:tfnof

[492] key: get field serial number

[493] url:rfnof

[494] key: get field serial number,table sequence

[495] url:fnper

[496] key:pay off a loan periodically, number of periods, amount paid

[497] url:fnpv

[498] key: discount rate, payment, income, net present value

[499] url:for

[500] key:for

[501] url:forabs

[502] key:specified,scope,step,loop

[503] url:forcsnx

[504] key:loop cursor

[505] url:forx

[506] key:execute a loop

[507] url:fork

[508] key:fork

[509] url:forkai

[510] key:multithreads,execute code block

[511] url:forkcs

[512] key:fork,multicursor,parallel computation

[513] url:forkhs

[514] key:multiple nodes,multithreads,execute code block

[515] url:forkfork

[516] key:execute code block in parallel

[517] url:format

[518] key:formatted string

[519] url:fpmt

[520] key:constant periodic payments with a constant interest rate, investment,loan

[521] url:fprice

[522] key: periodic interest, discounted security, interest at maturity

[523] url:frate

[524] key: interest rate of the constant periodic payment, reimbursement rate, one-off payment, rate of return

[525] url:freceived

[526] key: maturity,security, amount received

[527] url:fsln

[528] key:straight-line depreciation

[529] url:fsyd

[530] key: sum-of-years’ digits method, depreciation

[531] url:ftpcd

[532] key:ftp server,remote working directory,external library function

[533] url:ftpclient

[534] key:create,ftp client,external library function,passive mode

[535] url:ftpclose

[536] key:close,ftp client,external library function

[537] url:ftpdir

[538] key:list directories,create directories,delete directories,external library function

[539] url:ftpget

[540] key:ftp server,download file,external library function

[541] url:ftpmget

[542] key:FTP server,download,external library function

[543] url:ftpmput

[544] key:FTP server,upload,external library function

[545] url:ftpput

[546] key: upload a file,ftp server,external library function

[547] url:func

[548] key:func

[549] url:funccxi

[550] key:call,subroutine

[551] url:funcreturnxi

[552] key:define,function block

[553] url:fv

[554] key: constant interest rate, periodic constant payment, future value, sum of principal amount and interest

[555] url:fvdb

[556] key: variable declining balance method, double-declining balance method, depreciation

[557] url:fyield

[558] key: periodic interest,security,yield rate

[559] url:gcd

[560] key:greatest common divisor

[561] url:gotoC

[562] key:goto,jump

[563] url:group

[564] key:group

[565] url:agroupxi

[566] key:equi-grouping,sequence

[567] url:agroupxfyg

[568] key:sequence,group,aggregate

[569] url:chgroup

[570] key: records in a channel,group, neighbor

[571] url:csgroup

[572] key: cursor records,group,adjacent

[573] url:csgroupjq

[574] key: cluster cursor, group by comparing neiboring records

[575] url:csgroupxfyg

[576] key:cursor,group and aggregate,neighbour

[577] url:groupi

[578] key:grouping,data-input sheet

[579] url:agroupidi

[580] key:equi-grouping,sequence

[581] url:groupn

[582] key:group

[583] url:csgroupnxc

[584] key:cursor records,group,channel

[585] url:chgroupnxc

[586] key:channel,group

[587] url:csgroupnxF

[588] key:cursor,group,BIN file

[589] url:groups

[590] key:groups

[591] url:agroups

[592] key:cumulatively,table sequence,group and aggregate

[593] url:chgroups

[594] key:channel,group records, combine to result set

[595] url:csgroups

[596] key:cursor,group records, combine to result set

[597] url:csgroupsx

[598] key:cluster cursor,group,aggregate

[599] url:groupx

[600] key:groupx

[601] url:chgroupx

[602] key:channel,ordered records,group

[603] url:csgroupx

[604] key:cursor,records,group

[605] url:csgroupxcs2

[606] key:cluster cursor,records,group

[607] url:hash

[608] key:hash value,positive integer

[609] url:hbaseclose

[610] key:close,hbase database,external library function

[611] url:hbasecmp

[612] key:hbase comparator

[613] url:hbasefilter

[614] key:hbase filter,filter data

[615] url:hbasefilterlist

[616] key: multiple filters,filter data

[617] url:hbaseget

[618] key:query,hbase database,external library function,table sequence

[619] url:hbaseopen

[620] key:create,hbase database

[621] url:hbasescan

[622] key:query,hbase database,cursor,table sequence

[623] url:hdfsclient

[624] key:connect,hdfs file system,hdfsclient object,Hadoop server

[625] url:hdfsclose

[626] key:close,hdfs connection,external library function

[627] url:hdfsdir

[628] key: specified path,file list,external library function

[629] url:hdfslfile

[630] key:specified directory ,hdfs file flow,file object

[631] url:hiveclient

[632] key:create,Hive database,external library function,cursor

[633] url:hiveclose

[634] key:close,Hive database,external library function

[635] url:hivecursor

[636] key:query,hive database,cursor

[637] url:hiveexecute

[638] key:execute,SQL,external library function

[639] url:hivequery

[640] key:query,Hive database

[641] url:hosts

[642] key: main processe, specified partition,node list

[643] url:hour

[644] key: specified datetime,hour,integer

[645] url:htmlparse

[646] key:html,tag

[647] url:httpfile

[648] key:URL, returned result,package as file flow

[649] url:icursor1

[650] key:icursor

[651] url:icursor2

[652] key:index,entity table

[653] url:icursor3

[654] key:index,cluster entity table

[655] url:icount

[656] key:sequence,distinct members

[657] url:aicount

[658] key:sequence,count,distinct

[659] url:id

[660] key:id

[661] url:aid

[662] key:sequence,distinct value

[663] url:chid

[664] key:channel, sequence of sequences

[665] url:csid

[666] key:cursor, sequence of sequences

[667] url:if

[668] key:if

[669] url:ifx

[670] key:statement,execute

[671] url:ifxelseifx

[672] key:if statement,if,else

[673] url:ifxlelsel

[674] key:if statement, same line

[675] url:ifxelse

[676] key:if statement,if,else

[677] url:ifa

[678] key: calculate boolean expressions

[679] url:ifax

[680] key:sequence

[681] url:ifdate

[682] key:date,datetime

[683] url:ifn

[684] key:ifn

[685] url:aifn

[686] key:sequence,first non-null member

[687] url:aifnx

[688] key:sequence,first non-null member

[689] url:ifnumber

[690] key:numeric data

[691] url:ifr

[692] key:record

[693] url:ifstring

[694] key:string type

[695] url:ift

[696] key:table sequence

[697] url:iftime

[698] key: time type

[699] url:ifv

[700] key:variable,boolean value

[701] url:ifxclose

[702] key:close,database connection

[703] url:ifxconn

[704] key:create database connection

[705] url:ifxcursor

[706] key:cursor, fragmentation information

[707] url:ifxlistfrag

[708] key:table sequence,fragmentation information

[709] url:ifxsavefrag

[710] key:memory,save as a new file, fragmentation information,table sequence

[711] url:ifxsetfrag

[712] key:set,table, fragmentation information,table sequence,null

[713] url:ifxtakefrag

[714] key:extract, fragmentation information

[715] url:import

[716] key:import

[717] url:simport

[718] key:string,retrieve contents,table sequence

[719] url:fimport

[720] key:file object,read contents,table sequence

[721] url:timport

[722] key:entity table,table sequence

[723] url:index

[724] key:index

[725] url:tindex

[726] key:table sequnce,index table

[727] url:tindexn

[728] key:memory table,hash index

[729] url:tindexiwch

[730] key:create,index file,boolean value

[731] url:inf

[732] key:inf

[733] url:infd

[734] key:positive infinity value

[735] url:infx

[736] key: negative infinity value

[737] url:insert

[738] key:insert

[739] url:ainsert

[740] key:table sequence,insert,member

[741] url:tinsert

[742] key:insert, automatically update, check distinctness

[743] url:int

[744] key: data type conversion function, integer

[745] url:interval

[746] key:interval,datetime value

[747] url:inv

[748] key:inv

[749] url:ainvp

[750] key:adjust,order of member

[751] url:pinvk

[752] key: another integer sequence,sequence number

[753] url:invoke

[754] key:invoke,static function

[755] url:isalpha

[756] key:letter,boolean value

[757] url:isdigit

[758] key:number,boolean value

[759] url:isect

[760] key:isect

[761] url:aisect

[762] key:sequence,intersection

[763] url:aisectx

[764] key:sequence,intersection

[765] url:iselect

[766] key:ordered file,create a cursor

[767] url:fiselectaxfs

[768] key:ordered file,create a cursor

[769] url:islower

[770] key:lower case letter,boolean value

[771] url:isolate

[772] key:set,transaction,isolation level

[773] url:dbisolate

[774] key:set,transaction,isolation level

[775] url:isupper

[776] key:upper case letter,boolean value

[777] url:iterate

[778] key:iterate

[779] url:aiterate

[780] key:interative loop,sequence,record sequence

[781] url:chiterate

[782] key: interative loop,channel,record sequence

[783] url:csiterate

[784] key: interative loop,cursor,record sequence

[785] url:iteratexagi

[786] iterative loop

[787] url:join

[788] key:join

[789] url:joinaifixi

[790] key:join multiple sequences

[791] url:ajoin

[792] key:table sequence,record sequence,foreign-key-style join

[793] url:chjoin

[794] key:channel,record sequence, foreign-key-style join

[795] url:csjoin

[796] key:cursor,record sequence,foreign-key-style join

[797] url:csjoinjiqun

[798] key:cursor,record sequence,foreign-key-style join

[799] url:joinx

[800] key:joinx

[801] url:joinxyoubiao

[802] key:join,cursor

[803] url:joinxjiqunyoubiao

[804] key:join,cluster cursor

[805] url:csjoinxf

[806] key:cursor,segmentable bin file,foreign-key-style join

[807] url:csjoinxT

[808] key:cursor,entity table,foreign-key-style join

[809] url:chjoinx

[810] key:channel,segmentable bin file,foreign-key-style join

[811] url:json

[812] key:json string,record,parse

[813] url:k

[814] key:serial byte

[815] url:kabc

[816] key:serial byte,byte

[817] url:kafkaclose

[818] key:close connection to Kafka server

[819] url:kafkacommit

[820] key:commit,object

[821] url:kafakapoll

[822] key:get records,table sequence,cursor

[823] url:kafkasubscribe

[824] key:connect,object

[825] url:key

[826] key:key

[827] url:rkey

[828] key:get,primary key value

[829] url:keys

[830] key:table sequence,set a key

[831] url:tkeysk

[832] key:table sequence,set a key

[833] url:tkeyski

[834] key:define,memory table,key

[835] url:tkeyskin

[836] key:primary key,hash,serial byte index

[837] url:lcm

[838] key:least common multiple,sequence

[839] url:left

[840] key:source string,leftmost,substring

[841] url:len

[842] key:len

[843] url:alen

[844] key:seqeunce,length,integer

[845] url:klen

[846] key:getnumber of bytes,serial byte,length

[847] url:tlen

[848] key:get,memory table

[849] url:lens

[850] key:compute,string

[851] url:lg

[852] key:base 10,logarithm

[853] url:like

[854] key:format string,boolean value

[855] url:ln

[856] key:natural logarithm,numeric

[857] url:lock

[858] key: synchronization lock

[859] url:long

[860] key:convert, long integer

[861] url:lower

[862] key:string,convert to lower case

[863] url:m

[864] key:m

[865] url:am

[866] key:get,specified position,member

[867] url:amabcde

[868] key:members,specified positions,new sequence

[869] url:max

[870] key:max

[871] url:amax

[872] key:non-null,maximum value

[873] url:amaxx

[874] key:compute,maximum value

[875] url:maxp

[876] key:sequence,maximum value

[877] url:amaxpx

[878] key:sequence, maximum value

[879] url:mcursor

[880] key:mcursor

[881] url:csmcursor

[882] key: a sequence of cursors,multicursor

[883] url:csmcursorn

[884] key:one cursor,multicursor

[885] url:md5

[886] key:string,MD5 signature

[887] url:median

[888] key:sequence,logical division

[889] url:amediankn

[890] key: sequence,logical division

[891] url:memory

[892] key:memory

[893] url:csmemoryk

[894] key: memory table,load in order

[895] url:csmemoryk1

[896] key:cluster memory table,load in order

[897] url:memoryhv

[898] key:local memory table,cluster memory table

[899] url:tmemory

[900] key:compressed memory table, uncompressed memory table

[901] url:tmemorycw

[902] key:entity table,memory table

[903] url:tmemorycwv

[904] key:cluster entity table,cluster memory table

[905] url:merge

[906] key:merge

[907] url:amergex

[908] key:merge

[909] url:mergex

[910] key:merge,cursor sequence

[911] url:csmergexx

[912] key:merge,cursor sequence

[913] url:csmergex

[914] key:cluster cursor,merge,local ordinary cursor

[915] url:mcsmergex

[916] key:multicursor,merge,an ordinary cursor

[917] url:mid

[918] key:string,substring

[919] url:millisecond

[920] key:datetime value,millisecond

[921] url:min

[922] key:min

[923] url:amin

[924] key:non-null member,minimum value

[925] url:aminx

[926] key:loop,minimum value

[927] url:minp

[928] key:sequence,minimum value

[929] url:aminpx

[930] key:sequence,minimum value

[931] url:minute

[932] key: datetime value,minute

[933] url:modify

[934] key:modify

[935] url:rmodifyxifi

[936] key: modify,field value

[937] url:tmodify

[938] key:modify,table sequence,field value

[939] url:amodify

[940] key:specified position,assign,sequence

[941] url:mongoclose

[942] key:close,mongo database

[943] url:mongoinsert

[944] key:mongodb collection,insert

[945] url:mongoopen

[946] key:connect,mongodbServer

[947] url:mongoshell

[948] key:query,mongodb database,result

[949] url:month

[950] key: specified date,month

[951] url:movefile

[952] key:file,move,delete,rename

[953] url:movefilefp

[954] key:file,move,delete,rename

[955] url:nfx

[956] key:loop variable,loop operation

[957] url:name

[958] key:main directory, path

[959] url:f_name

[960] key:main directory, path

[961] url:new

[962] key:new

[963] url:anewxifi

[964] key:compute,generate

[965] url:chnew

[966] key:channel,field value

[967] url:csnew

[968] key:cursor,field value

[969] url:tnewacsxc

[970] key:key value,field-retrieving

[971] url:tnewacsxc1

[972] key:key value,field-retrieving from a cluster

[973] url:news

[974] key:news

[975] url:anewsxxifi

[976] key:concatenate,generate

[977] url:chnews

[978] key:field value,update,channel

[979] url:csnews

[980] key:field value,update,cursor

[981] url: tnewsacsxc

[982] key: key value,one-to-many association

[983] url:nexta

[984] key:skip loop,execute the next loop

[985] url:nodes

[986] key:children node

[987] url:pnodesfrn

[988] key:children node

[989] url:not

[990] key:integer,bitwise NOT

[991] url:now

[992] key:current system datetime

[993] url:null

[994] key:null value

[995] url:number

[996] key:string,convert,number

[997] url:anvl

[998] key:sequence, first non-null & non-double-quoted member

[999] url:olapclose

[1000] key:close,multidimensional database

[1001] url:olapopen

[1002] key:create,multidimensional database

[1003] url:olapquery

[1004] key:query,multidimensional database

[1005] url:or

[1006] key:integer,bitwise OR

[1007] url:output

[1008] key:console,output,printout data

[1009] url:p

[1010] key:specified position,sequence number

[1011] url:apip

[1012] key:specified position,sequence number

[1013] url:pad

[1014] key:pad

[1015] url:padscl

[1016] key:pad,specified length

[1017] url:apad

[1018] key:sequence,pad,specified length

[1019] url:parse

[1020] key:analyze,corresponding data type

[1021] url:paste

[1022] key:loop through a sequence,in order,modify record field values in a table sequence

[1023] url:tpasteafk

[1024] key:loop through a sequence,in order,modify record field values in a table sequence

[1025] url:pdate

[1026] key:the first day,the last day

[1027] url:penum

[1028] key:judge,enum group

[1029] url:epenumy

[1030] key:judge,enum group

[1031] url:periods

[1032] key: specified regular intervals,a sequence of datetime values

[1033] url:permut

[1034] key:number of permutations

[1035] url:pfind

[1036] key:primary key value,sequence number

[1037] url:apfindk

[1038] key:primary key value,sequence number

[1039] url:pi

[1040] key:circumference-to-diameter ratio,multiple

[1041] url:pivot

[1042] key:column,row,transposition

[1043] url:apivotgfvnn

[1044] key:column,row,transposition

[1045] url:pmax

[1046] key:maximum value,position

[1047] url:apmaxx

[1048] key:maximum value,position

[1049] url:pmin

[1050] key:minimum value,position

[1051] url:apminx

[1052] key:minimum value,position

[1053] url:pos

[1054] key:pos

[1055] url:apos

[1056] key:get,sequence member,position

[1057] url:aposx

[1058] key:position,monitonically increasing integer sequence

[1059] url:poss1s2begin

[1060] key:parent string,substring,position

[1061] url:power

[1062] key:numerical value,nth power,base

[1063] url:prior

[1064] key:foreign key,query recursively

[1065] url:rpriorfrn

[1066] key:foreign key,query recursively

[1067] url:proc

[1068] key:database,stored procedure

[1069] url:dbprocsptmv

[1070] key:database,stored procedure

[1071] url:product

[1072] key:a set of numbers,product

[1073] url:property

[1074] key:property file,retrieve,property value

[1075] url:fpropertyp

[1076] key:property file,retrieve,property value

[1077] url:pseg

[1078] key:sequence, sequence number of an interval

[1079] url:apsegx

[1080] key:sequence, sequence number of an interval

[1081] url:pselect

[1082] key:sequence member,position

[1083] url:apselectxy

[1084] key:sequence member,position

[1085] url:psort

[1086] key:sort,original position,sequence number

[1087] url:apsortx

[1088] key:sort,original position,sequence number

[1089] url:ptop

[1090] key:the smallest member,sequence number

[1091] url:aptopnx

[1092] key:the smallest member,sequence number

[1093] url:push

[1094] key:push

[1095] url:apush

[1096] key:push,channel

[1097] url:chpush

[1098] key:push,channel

[1099] url:cspush

[1100] key:cursor,channel

[1101] url:query

[1102] key:query

[1103] url:dbquery

[1104] key:data source,SQL,query,table sequence

[1105] url:dbquerysql

[1106] key:SQL,query,external table

[1107] url:rtf

[1108] key:record sequence,table sequence,sequence

[1109] url:rx

[1110] key:record,compute,expression

[1111] url:rf

[1112] key:record,value

[1113] url:rfx

[1114] key:record field,assign

[1115] url:rand

[1116] key:random number

[1117] url:rands

[1118] key:random string,integer

[1119] url:range

[1120] key:a specified interval,beginning member

[1121] url:rank

[1122] key:rank

[1123] url:aranky

[1124] key:members,ranking

[1125] url:arankyx

[1126] key:compute,ranking

[1127] url:rankfigi

[1128] key:interative loop,number records

[1129] url:ranki

[1130] key:interative loop,number records

[1131] url:ranks

[1132] key:ranks

[1133] url:aranksx

[1134] key:get,ranking

[1135] url:aranks

[1136] key:compute,ranking

[1137] url:read

[1138] key:file object,read as a string

[1139] url:fread

[1140] key:file object,read as a string

[1141] url:record

[1142] key:record

[1143] url:trecord

[1144] key:sequence,table sequence,new record

[1145] url:rrecord

[1146] key:sequence,modify,record

[1147] url:redis

[1148] key:connect,single machine model,Redis database

[1149] url:redisclose

[1150] key:close,Redis database

[1151] url:rediscluster

[1152] key:connect,cluster

[1153] url:redisget

[1154] key:key,values of multiple keys

[1155] url:redisgetrange

[1156] key:key,string,substring

[1157] url:redishkeys

[1158] key:hash,key,all fields

[1159] url:redishlen

[1160] key:hash,key,number of fields

[1161] url:redishmget

[1162] key:hash,key,values of given hash fields

[1163] url:redishvals

[1164] key:hash,key,all hash fields

[1165] url:rediskeys

[1166] key:matching pattern,key

[1167] url:redislindex

[1168] key:key,index

[1169] url:redisllen

[1170] key:get,key,length

[1171] url:redislrange

[1172] key:key,range,offset value

[1173] url:redispool

[1174] key:connect,buffer pool mode

[1175] url:redisscard

[1176] key:set,key,number of members

[1177] url:redissdiff

[1178] key:set,difference

[1179] url:redisselect

[1180] key:change, selected database,index

[1181] url:redissentinel

[1182] key:connect,distributed Redis cluster

[1183] url:redisshared

[1184] key:connect,shared pool mode

[1185] url:redissharedpool

[1186] key:connect, buffer pool,shared pool mode

[1187] url:redissinter

[1188] key:members,given sets

[1189] url:redissismember

[1190] key:determine,member,set

[1191] url:redissmembers

[1192] key:set,all members

[1193] url:redissrandmember

[1194] key:set,random member

[1195] url:redisstrlen

[1196] key:key,store,string,length

[1197] url:redissunion

[1198] key:member,given sets,union

[1199] url:redistype

[1200] key:key,store,data type of a value

[1201] url:rediszcard

[1202] key:sorted set,key

[1203] url:rediszcount

[1204] key:sorted set,key,starting score,ending score

[1205] url:rediszrange

[1206] key:sorted set,key,range

[1207] url:rediszrangebyscore

[1208] key:sorted set,key,range

[1209] url:rediszrank

[1210] key:sorted set,key,member ranking

[1211] url:rediszscore

[1212] key:sorted set,key,member,score

[1213] url:regex

[1214] key:regex

[1215] url:sregex

[1216] key:regular expression,match a string,an array of sections of matching data

[1217] url:aregex

[1218] key:regular expression,sequence,string members

[1219] url:csregex

[1220] key:regular expression,cursor,string members

[1221] url:register

[1222] key:dfx,register,function,call

[1223] url:rename

[1224] key:table sequence,field,rename

[1225] url:trename

[1226] key:table sequence/composite table,field,rename

[1227] url:csrename

[1228] key:cursor,renamed fields,index

[1229] url:replace

[1230] key:replace,source string,substring

[1231] url:reportconfig

[1232] key:read,configuration file,information

[1233] url:reportexporthtml

[1234] key:export,HTML,MHT,external library function

[1235] url:reportexortpdf

[1236] key:export,PDF file

[1237] url:reportexportxls

[1238] key:export,xls,xlsx

[1239] url:reportopen

[1240] key:read,report file

[1241] url:reportrun

[1242] key:compute,report

[1243] url:reset

[1244] key:reset

[1245] url:csreset

[1246] key:cursor,move it back

[1247] url:fresetf

[1248] key:copy,composite table file

[1249] url:treset

[1250] key:clear,members of a table sequence

[1251] url:result

[1252] key:channel,result

[1253] url:chresult

[1254] key:channel,result

[1255] url:returnxi

[1256] key:main program,free up resource

[1257] url:rgb

[1258] key:levels of transparency,convert,color value,64-bit long integer

[1259] url:right

[1260] key:string,right,substring

[1261] url:rollback

[1262] key:rollback,database

[1263] url:dbrollback

[1264] key:rollback,database

[1265] url:frollback

[1266] key:rollback,composite table file

[1267] url:round

[1268] key:specified position,truncate,round off

[1269] url:row

[1270] key:find,key,record

[1271] url:krowt

[1272] key:find,key,record

[1273] url:krowt1

[1274] key:find,primary key,record

[1275] url:run

[1276] key:run

[1277] url:rrunxi

[1278] key:record,compute

[1279] url:prunxifi

[1280] key:record sequence,record

[1281] url:arunx1x2xi

[1282] key:sequence,record sequence,each member

[1283] url:chrun

[1284] key:channel,record,expression

[1285] url:csrun

[1286] key:cursor,expression

[1287] url:rvs

[1288] key:sequence,reverse,new sequence

[1289] url:arvs

[1290] key:sequence,reverse,new sequence

[1291] url:sapclient

[1292] key:create,SAP server connection

[1293] url:sapclose

[1294] key:close,SAP server connection

[1295] url:sapcursor

[1296] key:cursor,get,result set list

[1297] url:sapexcute

[1298] key:get,function object

[1299] url:sapgetparam

[1300] key:import,get,data records

[1301] url:saptable

[1302] key:table-valued parameter,list

[1303] url:savepoint

[1304] key:set,savepoint

[1305] url:dbsavepointspn

[1306] key:set,savepoint

[1307] url:second

[1308] key:datetime vlaue,get,second

[1309] url:asegpx

[1310] key:sequence,interval number

[1311] url:select

[1312] key:select

[1313] url:aselect

[1314] key:select,sequence,satisfy a condition

[1315] url:tselect

[1316] key:table sequence,filtering expression,index

[1317] url:chselect

[1318] key:select,original channel

[1319] url:chselectxch

[1320] key:channel,can’t meet a given condition,send

[1321] url:csselect

[1322] key:original cursor

[1323] url:csselectxch

[1324] key:cursor,can’t meet a given condition,send

[1325] url:csselectxf

[1326] key:cursor,push

[1327] url:seq

[1328] key:loop operation,number records

[1329] url:shift

[1330] key:shift

[1331] url:shiftxs

[1332] key:shift operation,shift left,shift right

[1333] url:ashift

[1334] key:a shuffled sequence

[1335] url:sign

[1336] key:judge,positive, negative,0

[1337] url:sin

[1338] key:parameter,sine value

[1339] url:sinh

[1340] key: hyperbolic sine

[1341] url:size

[1342] key:length of a file,size

[1343] url:fsize

[1344] key:length of a file,size

[1345] url:sizeof

[1346] key:memory space an object occupies

[1347] url:skip

[1348] key:cursor,skip

[1349] url:csskipnx

[1350] key:cursor,skip

[1351] url:sleep

[1352] key:sleep

[1353] url:sort

[1354] key:members of a sequence,sort

[1355] url:asortxloc

[1356] key:members of a sequence,sort

[1357] url:sortx

[1358] key:sortx

[1359] url:chsortx

[1360] key:channel,records,sort

[1361] url:cssortx

[1362] key:cursor,sort

[1363] url:cssortxx

[1364] key:cluster cursor,sort

[1365] url:sparkclient

[1366] key:create,Spark database connection

[1367] url:sparkclose

[1368] key:close,Spark database connection

[1369] url:sparkcursor

[1370] key:query,Spark database,cursor

[1371] url:sparkquery

[1372] key:query,Spark database,query

[1373] url:split

[1374] key:string,delimiter,sequence

[1375] url:ssplitd

[1376] key:string,delimiter,sequence

[1377] url:sqlparse

[1378] key:SQL query,split,sequence

[1379] url:sqltranslate

[1380] key:translate,specified

[1381] url:sqljia

[1382] key:SQL+,convert,SPL

[1383] url:substr

[1384] key:string,substring

[1385] url:staxclose

[1386] key:close,Cassandra databae connection

[1387] url:staxconnect

[1388] key:create,Cassandra database connection

[1389] url:staxquery

[1390] key:query,Cassandra database,table sequence

[1391] url:sqrt

[1392] key:square root

[1393] url:step

[1394] key:specified starting position

[1395] url:astepmk

[1396] key:specified starting position

[1397] url:string

[1398] key:convert,format string

[1399] url:stringef

[1400] key:convert,format string

[1401] url:sum

[1402] key:sum

[1403] url:asumx

[1404] key:compute,sequence,sum

[1405] url:asum

[1406] key:sequence,sum

[1407] url:swap

[1408] key:interval,integer sequence,swap

[1409] url:sswappq

[1410] key:interval,integer sequence,swap

[1411] url:switch

[1412] key:switch

[1413] url:aswitchfiaix

[1414] key:reference field,key values,referenced records

[1415] url:chswitchfiaix

[1416] key:channel,reference field,key values

[1417] url:csswitchfiaix

[1418] key:cursor,specified field

[1419] url:csswitchfiaixjiqun

[1420] key:cluster cursor,specified field

[1421] url:sync

[1422] key:nodes,synchronize

[1423] url:system

[1424] key: system command,execute

[1425] url:tan

[1426] key:tangent value,float type

[1427] url:tanh

[1428] key:hyperbolic tangent

[1429] url:time

[1430] key:time

[1431] url:timedatetimeexp

[1432] key:datetime value,get the time

[1433] url:timehms

[1434] key:convert,time data

[1435] url:to

[1436] key:to

[1437] url:ato

[1438] key:specified position,new sequence

[1439] url:to1

[1440] key:generate,integer sequence

[1441] url:top

[1442] key:get,smallest members,sequence

[1443] url:atopnx

[1444] key:get,smallest members,sequence

[1445] url:total

[1446] key:aggregation

[1447] url:cstotal

[1448] key:cursor,aggregation

[1449] url:chtotal

[1450] key:channel,aggregation

[1451] url:trim

[1452] key:remove,string,blank characters

[1453] url:true

[1454] key:logical constant,true

[1455] url:union

[1456] key:union

[1457] url:aunion

[1458] key:sequence,union

[1459] url:aunionx

[1460] key:compute, sequence member,union

[1461] url:update

[1462] key:update

[1463] url:dbupdate

[1464] key:update,database table

[1465] url:tupdatep

[1466] key:update,records

[1467] url:tupdatep1

[1468] key:update,record

[1469] url:tupdatep2

[1470] key:update,record

[1471] url:upper

[1472] key:string,convert,upper case

[1473] url:urlencode

[1474] key:URL string,encoded

[1475] url:v0

[1476] key:referencing field,primary key

[1477] url:vv

[1478] key:referencing field,primary key

[1479] url:words

[1480] key:extract,string,English words

[1481] url:swords

[1482] key:extract,string,English words

[1483] url:workday

[1484] key:specified date, the nth workday after

[1485] url:workdays

[1486] key: workdays, between two dates

[1487] url:write

[1488] key:string,sequence,file object,binary data

[1489] url:fwritesa

[1490] key:string,sequence,file object,binary data

[1491] url:wscall

[1492] key:webservive server,send a query request,get data

[1493] url:wsclient

[1494] key:create,webservice server

[1495] url:xjoin

[1496] key:multiple,cross join

[1497] url:xjoinx

[1498] key:multiple,cursor,cross join

[1499] url:xlscell

[1500] key:Excel object,enter,read

[1501] url:xlsclose

[1502] key:close,Excel object

[1503] url:xlsexport

[1504] key:xlsexport

[1505] url:fxlsexport

[1506] key:table sequence,write,Excel file

[1507] url:xoxlsexport

[1508] key:Excel object,write

[1509] url:xlsimport

[1510] key:xlsimport

[1511] url:fxlsimport

[1512] key:Excel file,retrieve contents,record,table sequence

[1513] url:xoxlsimport

[1514] key:Excel object,table sequence

[1515] url:xlsopen

[1516] key:read,Excel file

[1517] url:xlswrite

[1518] key:Excel object,save,file

[1519] url:xml

[1520] key:XML string,table sequence,parse

[1521] url:xor

[1522] key:integer,XOR operation

[1523] url:xunion

[1524] key:xunion

[1525] url:axunion

[1526] key:distinct,sequence

[1527] url:axunionx

[1528] key:member,distinct

[1529] url:year

[1530] key:date value,get year

[1531] url:ymbuildmodel

[1532] key:model building,model file

[1533] url:ymclose

[1534] key:close Python

[1535] url:ymenv

[1536] key:start Python,yimming

[1537] url:ymimportance

[1538] key:model,variable,list of degrees of importance

[1539] url:ymlist

[1540] key: model file list

[1541] url:ymmodel

[1542] key:data for model building

[1543] url:ymperformance

[1544] key: model performance information

[1545] url:ympredict

[1546] key:model file,model object

[1547] url:ympresent

[1548] key: Model description

[1549] url:ymresult

[1550] key:prediction

[1551] url:ymsetparam

[1552] key: model parameter variables

[1553] url:ymstatistics

[1554] key:target variable

[1555] url:ymtarget

[1556] key:target variable

[1557] url:z

[1558] key:locate,evenly split

[1559] url:zip

[1560] key:zip,compression,decompression

[1561] url:zipadd

[1562] key:zip,add a file

[1563] url:zipclose

[1564] key:zip,close

[1565] url:zipcompress

[1566] key:zip,compression mode & level

[1567] url:zipdel

[1568] key:zip,delete

[1569] url:zipencrypt

[1570] key:zip,encryption mode

[1571] url:zipextract

[1572] key:zip,file extraction

[1573] url:zone

[1574] key:zone

[1575] url:zoneh

[1576] key:get,node,data zone

[1577] url:zonei

[1578] key:node,data zone

[1579] url:jl

[1580] key:sequences,common members,composed of

[1581] url:bjys

[1582] key:comparison operation,boolean value

[1583] url:sljzczs

[1584] key:hexadecimal, “0x”,integer

[1585] url:qyqz

[1586] key:integer,Mod operation,get integer part

[1587] url:hl

[1588] key:sequences,concatenate

[1589] url:szys

[1590] key:addition,subtraction,multiplication,division

[1591] url:fhfz

[1592] key:computation,assignment

[1593] url:zfccl

[1594] key:string,constant

[1595] url:zfcpj

[1596] key:zfcpj

[1597] url:xy

[1598] key:string,concatenate

[1599] url:x1y

[1600] key:string,non-string type,concatenate

[1601] url:phlj

[1602] key:serial bytes

[1603] url:phljab

[1604] key:serial bytes

[1605] url:dwys

[1606] key: alignment addition, alignment subtraction, alignment multiplication, alignment division, mod operation, integer division

[1607] url:cl

[1608] key:sequences,subtract,new sequence

[1609] url:bl

[1610] key:sequences,union,new sequence

[1611] url:xlc

[1612] key:duplicate,sequence member,new sequence

[1613] url:yhl

[1614] key:distinct,member,new sequence

[1615] url:xhhsgtgz

[1616] key:common rules

[1617] url:xhhszdbdssxgz

[1618] key:expressions of loop functions,common rules

[1619] url:pys

[1620] key: a series of expressions,compute

[1621] url:bsf

[1622] key:variable name,variable value

[1623] url:xfs

[1624] key:variable name,datetime,string

[1625] url:kl

[1626] key:no member,sequence

[1627] url:fz

[1628] key:member in the sequence

[1629] url:fzjs

[1630] key:result,assignment

[1631] url:zyf

[1632] key:string,certain characters,escape

[1633] url:ljys

[1634] key:oolean expression

[1635] url:czs

[1636] key: long integer

[1637] url:dyglx

[1638] key:cell type

[1639] url:dmklx

[1640] key:code block type

[1641] url:ty

[1642] key:chart element

[1643] url:gdraw

[1644] key:draw,canvas

[1645] url:ghlink

[1646] key:hyperlink string

[1647] url:gplot

[1648] key:chart plotting string,parameters

[1649] url:tycs

[1650] key:chart element parameter

[1651] url:maxaxis

[1652] key:mapping table

[1653] url:numbericaxis

[1654] key:numeric axis

[1655] url:enumaxis

[1656] key:enum axis

[1657] url:dateaxis

[1658] key:date axis

[1659] url:line

[1660] key:line

[1661] url:dot

[1662] key:dot

[1663] url:column

[1664] key:column

[1665] url:sector

[1666] key:sector

[1667] url:graphcolumn

[1668] key: column

[1669] url:graphline

[1670] key: line

[1671] url:graphpie

[1672] key:pie chart

[1673] url:graph2axis

[1674] key:two-axis chart

[1675] url:background

[1676] key:background

[1677] url:text

[1678] key:text

[1679] url:legend

[1680] key:legend