You are here: Commands > Delete

Delete

Use the Delete command to remove unwanted fields, variables, project items, data files, relations and table histories from the current Analyzer environment. This command can be only be issued in command mode from the Command Log or within a procedure.

By default, without using any parameters, the Delete command will delete a field or variable.

Deleted project items or data files are permanently removed from wherever they are stored, for example, the Analyzer Project folder, a shared folder, a local drive or network drive. For Windows-based platforms only, the deleted projects items and data are sent to the recycle bin for possible later recovery (except when deleted within a procedure).

Note: Analyzer cannot recycle deleted fields, variables, the Command Log, the Table History or Relations.

You cannot delete a field or variable referenced by a computed field unless you delete the computed field first. Also, you cannot delete any fields referenced by the current View.

Unless you specify OK on the command line, you are prompted for confirmation before any item is deleted, even if the Warn Before Overwriting Files option on the [Interface Options] tab of Tools/Options is not selected.

Parameters

The Delete command has the following command parameters:

All

Indicates that all variables in the current Analyzer environment are to be deleted. Fields are not affected.

Note: DELETE ALL EXCEPT "_*" can be used to delete all variables except permanent variables. See examples below for more variations on using the LIKE and EXCEPT options.

Data

Deletes the specified data file. Can be used to delete any file whether created by Analyzer or another application (spreadsheets, delimited files, etc.).

Note: Deleting an Analyzer created data file (.FIL) does not delete the associated table layout .

Folder

Deletes the specified folder relative to either the current folder or the current Analyzer project root (which is dependant on the format of the syntax used - see examples below).

Note: Delete Folder necessarily deletes the specified folders contents.

The folder name to be deleted may be specified in one of the following ways:

data

which is a relative path to the current folder

data\temp same

which is the relative path from the current folder, but two levels further down.

\inventory\data\temp

which is a folder path relative to the Analyzer project root.

"\more data\temp"

which is a folder path relative to the Analyzer project root, but the folder path must be surrounded in double quotes because of the blank contained within the folder name.

In any of the above syntax examples, you can use either a \ or a / to separate the path components, but you can't mix the two within the same reference.

Examples:

DELETE FOLDER data OK

deletes the data folder (relative to the current folder), with prompting

DELETE FOLDER \inventory\data\temp

deletes the temp folder (relative to the Analyzer project root), with prompting

DELETE FOLDER "/more data/temp" OK

deletes the temp folder (relative to the Analyzer project root), without prompting

Note: For information on setting the root folder, see Set Folder.

Format

Deletes the specified table layout, its default View (named after the table) and its associated indexes and relations. All other Views for the specified table layout are retained. The underlying data for the specified table layout is also deleted if the table layout (format) and its data were created by an Analyzer command (such as Extract).

History

Deletes the history of the currently open table. To save the history of an existing table before deleting the table, use the command Display History. You can then either highlight the table history written to the Command Log and print it or copy and paste it into a text file. If you delete the history of a table, you can no longer use the Create Procedure from Table History option under Tools menu to automatically create a procedure to reproduce the table.

Index

Deletes the specified index.

OK

Indicates that the delete command is to be executed without confirmation.

Procedure

Deletes the specified procedure.

Relation

Deletes relation for currently open table.

Report or View

Deletes the specified View.

Temp

Indicates that all project items whose names begin with the temporary prefix (set in Interface Options or via a Set Temp command) should be deleted. For more information see Use Temporary Object Prefix.

Workspace

Deletes the specified workspace.

Command Mode Syntax

DELETE {field-name|variable-name|ALL} <OK>

DELETE HISTORY <number-to-retain> <OK>

DELETE RELATION <OK>

DELETE PROCEDURE <procedure-name> <OK>

DELETE FORMAT <table-layout-name> <OK>

DELETE REPORT <view-name> <OK>

DELETE VIEW <view_name> OK

DELETE WORKSPACE <workspace-name> <OK>

DELETE INDEX <index-name> <OK>

DELETE DATA <data-name> <OK>

DELETE TEMP <OK>

DELETE FOLDER <folder-name> <OK>

DELETE ALL < {LIKE | EXCEPT} mask > <OK>

Number-to-retain indicates the number of histories to retain. You can use the SET HISTORY command to set the maximum number of histories to retain. For example, the command SET HISTORY 4 means that the number of histories retained never grows beyond four.
LIKE and EXCEPT allow only variables that meet the mask criteria to be deleted. The mask can also use ? and * in the same manner as the ALL keyword for other commands, except that for the Delete command ALL refers to variables instead of fields. For more information see All.

Examples

To delete all variables from the command line or within a procedure:

DELETE ALL OK

To delete only temporary variables using the prefix "TMP_":

DELETE ALL LIKE "TMP_*" OK

To delete all variables except permanent variables:

DELETE ALL EXCEPT "_*" OK

For more detailed information on the use of the ALL LIKE/EXCEPT qualifiers, see All.

To delete an unwanted field (QtyOO) containing the quantity of inventory items on order, enter the following in the Command Log text box:

DELETE QTYOO

Note: Analyzer will display a dialog asking you to confirm that you want to delete the field (unless you add OK to the end of the command).

In a procedure, to retain only the last four file history entries for a cyclically processed table named Demo, execute the Delete History command. The carriage return symbol (¿) marks the end of each line of multi-line text.

OPEN DEMO ¿

SORT ON PRODCLS PRODNO TO "SORTPROD" ¿

OPEN SORTPROD ¿

EXTRACT RECORD TO "SORTED" IF AMOUNT > 100 ¿

OPEN SORTED ¿

STRATIFY ON COST ACCUMULATE MKTVAL PROFIT INTERVAL 10 TO "STRATCOST" ¿

OPEN STRATCOST ¿

EXTRACT RECORD TO DEMO IF AMOUNT > 0 ¿

OPEN DEMO ¿

DELETE HISTORY 4 ¿

You can issue the Delete History command in a procedure or from the Command Log to delete the file histories for the currently open table.