action_="savetable"

<do action_="savetable"> executes a given 1010data query and saves the results as a table. (Available as of version 10.23)

Syntax

<dynamic saved_path="">
    <do action_="savetable"
     value_="@saved_path" 
     path_="[PATH]"
     folder_="[FOLDER]" 
     tablename_="[NAME]" 
     replace_="0|1" append_="0|1" 
     inherit_="0|1" temp_="0|1"
     users_="[LIST_OF_USERS]"
     title_="[TABLE_TITLE]" 
     sdesc_="[SHORT_DESCRIPTION]"
     ldesc_="[LONG_DESCRIPTION]"
     segsize_="[TARGET_SEGMENT_SIZE]"
     segby_="[LIST_OF_SEGBY_COLS]"
     sortseg_="[LIST_OF_SORTSEG_COLS]"
     sort_="[LIST_OF_SORT_COLS]"
     index_="[LIST_OF_INDEX_COLS]"
     use_materialize_="0|1"
     viewmode_="data|nodata|happy"
     owner_="[OWNER]"> 
       [1010data_QUERY]
    </do>
</dynamic>

Attributes for action_="savetable"

value_
The path where the table is saved is stored in the dynamic variable associated with this attribute.

The variable must be declared in the opening <dynamic> tag of the QuickApp (e.g., <dynamic var_name="">).

path_
Specifies the path where the table is to be saved.
The value of this attribute may be:
  • the path of a directory to which the creator has upload permission, in which case a new table is created with a system-generated name in that directory
  • the path of an as-of yet nonexistent table in a directory to which the creator has upload permission, in which case the new table has the specified path
  • the path of an existing table or directory which the creator owns, in which case either replace_="1" or append_="1" must be specified, and the existing object will be replaced or appended to, respectively
Note: If path_ is specified, folder_ and tablename_ must not be present.
folder_
Specifies the folder in which the table is to be saved.

If folder_ and tablename_ are specified, it is equivalent to specifying path_ as [FOLDER].[NAME]. If tablename_ is not specified, a new object is created in the specified folder with a system-generated name.

If folder_ is not specified, the table is saved to the uploads folder by default, and the table name may only be specified using tablename_ if replacing/appending to an existing object. (Specific named objects may not be created in uploads.)

If path_, folder_, and tablename_ are not specified, the table is saved as a new object with a system-generated name in the uploads folder.

Note: The folder_ attribute must not be present if path_ is specified.
tablename_
Specifies the name of the table to be saved.

If folder_ and tablename_ are specified, it is equivalent to specifying path as [FOLDER].[NAME]. If tablename_ is not specified, a new object is created in the specified folder with a system-generated name.

If folder_ is not specified, the table is saved to the uploads folder by default, and the table name may only be specified using tablename_ if replacing/appending to an existing object. (Specific named objects may not be created in uploads.)

If path_, folder_, and tablename_ are not specified, the table is saved as a new object with a system-generated name in the uploads folder.

Note: The tablename_ attribute must not be present if path_ is specified.
replace_
Specifies whether to replace an existing table, if it exists. Accepts a 1 or 0.

If replace_="1", the table, if it exists, is replaced.

If replace_="0", the table, if it exists, is not replaced.

append_
Specifies whether to append to an existing table, if it exists. Accepts a 1 or 0.

If append_="1", the table, if it exists, is appended to.

If append_="0", the table, if it exists, is not appended to.

inherit_
Specifies whether to inherit the set of users who have permission to access this table. The set of users is inherited from the parent folder in which the table is saved.

If inherit_="1", the set of users is inherited from the parent folder in which the table is saved. In this case, the users_ attribute, if specified, is ignored.

If inherit_="0" (or is not specified), the table is private to the creator (unless the users_ attribute is specified).

Permissions are not in any case modified when replacing or appending to a table.

temp_
Specifies whether the table is temporary for the current session only. Accepts a 1 or 0.

When temp_="1", the table is temporary; that is, the data is saved to disk, but the table will not persist beyond the current session. Although the table is temporary, it uses disk space and counts against user disk quota until it is cleaned up automatically by the system.

When temp_="0", the table is saved and will persist beyond the current session.

The default is 0.

(Available as of version 13.04)

users_
Specifies the set of users that have permission to access this table. Accepts a comma-separated list of 1010data user names.

If users_ is not specified and inherit_="0" (or is not specified), the table is private to the creator.

If inherit_="1", permissions are inherited from the parent folder in which the table is saved, and the users_ attribute is ignored.

Permissions are not in any case modified when replacing or appending to a table.

title_
Specifies the title to be saved in the table informational metadata.

If explicitly specified, the table title is modified when replace_="1" or append_="1".

sdesc_
Specifies the short description to be saved in the table informational metadata.

If explicitly specified, the short description is modified when replace_="1" or append_="1".

ldesc_
Specifies the long description to be saved in the table informational metadata.

If explicitly specified, the long description is modified when replace_="1" or append_="1".

segsize_
May either be a constant integer or a value expression.

If a positive integer, this specifies the target segment size, which may be used in conjunction with segby_ or sortseg_.

If a value expression, this must evaluate to an integer between 0 and some non-negative number at each row, with no numbers "left out" (but may evaluate to N/A at some rows). In this case, the value at each row determines the target segment of the row. If a value expression is specified, this overrides the segby_ or sortseg_ attributes, which may still be specified in an advisory manner to mark the resulting table as segby/sortseg, respectively.
Note: In this case, of course, you are responsible for ensuring that the segmentation expression does, in fact, lead to the specified segby/sortseg property.
Special cases:
  • segsize_="0" - specifies that the new table will have a single segment
  • segsize_="seg_" - specifies that the new table will have identical segmentation to the source table
segby_
A comma-separated list that specifies the columns that will be used to segment the table.

The table will automatically be marked as segby.

This attribute can only be used when use_materialize_="1" (or is not specified).

(Available as of version 10.25)

sortseg_
A comma-separated list that specifies the columns that will be used to sort and segment the table.

The table will automatically be marked as sortseg.

This attribute can only be used when use_materialize_="1" (or is not specified).

(Available as of version 10.25)

sort_
A comma-separated list that specifies the columns that will be sorted within each segment.

This attribute can only be used when use_materialize_="1" (or is not specified).

(Available as of version 10.25)

index_
A comma-separated list that specifies the columns in the resulting table that should also be indexed.

Indexing provides increased selection performance at the cost of storage.

The default is no columns.

This attribute can only be used when use_materialize_="1" (or is not specified).

(Available as of version 10.25)

use_materialize_
Specifies whether to use materialize to save the table or the legacy savetable method.

When use_materialize_="1", materialize is used to save the table.

When use_materialize_="0", the legacy savetable method is used to save the table.

The default is 1.

(Available as of version 10.25)

viewmode_
Specifies the display mode for the table when using the classic (pre-version 10) GUI.

Valid values are:

data
Open the object as a table.
nodata
Open the object as a library.
happy
Open the object as a QuickApp.
Note: This attribute is optional and exists for pre-version 10 compatibility. In general, this mode will be ignored or treated differently when using the new GUI in version 10.
owner_
Specifies the owner of the table.

owner_ is executed as a separate transaction. Therefore, it is possible for the savetable to succeed but for the ownership change to fail.

(Available as of version 14.10)