merge (Merge two tables)

The merge transaction creates a new table by combining one or more existing tables. The table is added to the 1010data database hierarchy and may be made accessible to other users.

The tables are combined by appending all their rows together (i.e., the new table has similar columns to the original tables but has as many rows as the sum of the rows of the original tables). The original tables must have some columns in common, and each of those columns must have the same data type and other attributes (NA values, alphabetic case, etc.) in all the tables. If some columns do not appear in all the tables, those columns are not included in the new table.

Query string

The query string in the HTTP header must contain the following parameters:

api
Specify the name of the API transaction.
apiversion
Specify the version of the API that should handle the requested transaction.

For the most up-to-date version, use apiversion=3.

uid
Specify a valid 1010data user name.
pswd
Specify a valid password for the 1010data user name provided to the uid parameter.
Note: The pswd value should be the encrypted password returned from the login transaction.
sid
The session ID for the current API session.

This value is returned by the login transaction and must be provided to every transaction (except login).

kill (optional)
Valid values for kill are as follows:
yes
Terminate the existing session and start a new one.
no
Do not terminate the existing session.

If no session exists, a new one will be created. If a session does exist, an error is returned.

Note: If kill=no and a session is active, the system returns an error.
possess
Log in and possess the existing session.
auth
Authenticate with the system but do not kill, possess, or start any session.

The default is yes.

XML input to server

The specifications must contain the following elements:

<tabs>
Used to specify the table(s) to be merged. The <tabs> element must contain one or more <tab> elements, which specify the full location name of each table to be merged.
Note: A <tabs> element containing at least one <tab> element is required by this transaction.
<name>
The full name of the table that will result from the <merge> transaction.

<name> may include optional attribute mode. If a table already exists by this name and mode="replace", the table will be replaced. If mode="noreplace" , an error message will be returned. If mode is omitted, the default is noreplace.

Note: A <name> element containing a valid 1010data path to the new table is required by the <merge> transaction.
<title>
The title of the directory or table.
<sdesc>
The short description of the table resulting from the <merge> transaction.
<link>
The link header for the new table resulting from the <merge> transaction. (see <link> (Link header))
<maxdown>
The download limit for the new table (see <maxdown> (Download limit)).
<users>
The access rights for the new table (see Users Tree).

<tabs> and <name> are required; the others are optional.

XML response from server

A successful merge contains the following elements:

<rc>
The return code generated by the transaction. For a list of return codes, see Return codes.
<msg>
The message returned by the system. Specific messages correspond to specific return codes.

Query string example

https://www2.1010data.com/gw.k?api=merge&apiversion=3&uid=$UID&pswd=$PSWD&sid=$SID

XML input example

<in>
<tabs>
   <tab>annualtables.t2001</tab>
   <tab>annualtables.t2002</tab>
</tabs>
<name mode="noreplace">myfolder.mytable</name>
<title>2001-2002</title>
<users>
   <user>john</user>
   <user>tom</user>
</users>
</in>

XML Response Example

<out>
  <rc>0</rc>
  <msg>Saved table myfolder.mytable</msg>
</out>