New/Modify File
This option is also available from the File Editor tab when a file is open.
A Description column, at the right-hand side of the grid, allows the purpose and the content of any field in the file to be described using a maximum of 255 characters. See: Field Descriptions
File
Double click in the File field, or click the list box, to select the file to be modified. If required, use the Type drop down to select the type of file selected.
New title
Optionally, enter a new title for the file to be modified.
Left justify fields
Select the Left justify fields check box if you want the fields of the file to inherit Left Justify layout format.
Format Numeric Fields
If the Round off option is selected, the program rounds two decimal values up; e.g. values such as 3.14, 4.5, 13, 7.528 and 6.135 are formatted respectively as follows: 3.14, 4.50, 13.00, 7.53 and 6.14.
If Truncate is selected, the program rounds values to two decimals without rounding. For example, values such as 3.14, 4.5, 13, 7.528 and 6.135 are formatted respectively as follows: 3.14, 4.50, 13.00, 7.52 and 6.13. This means, if the number of decimals specified in the file structure is smaller than the number of decimals present in a field, excess decimal places are removed.
Field Grid
You can add or insert new fields and delete or rename existing fields in the grid.
Function | Description |
---|---|
ADD | Add a field to the file and specify its type, width and decimal precision (if any). You can also specify a Start value and an Increment value. |
INSERT | Insert a field in the file, after the field specified in the Before column, and specify its type, width and decimal precision (if any). You can also specify a Start value and an Increment value. |
MODIFY | Modify the name, type, width and decimal precision (if any) of an existing field. You may also modify the Start value and Increment value (if any). |
DELETE | Delete the field specified in the Field Name column. If a field of that name does not exist in the file, the DELETE command is ignored. |
DELETE GROUP | Delete multiple consecutive fields in the file, beginning with the field specified in the Field Name column, and ending with the field specified in the Before column. If a named field does not exist in the file, the DELETE command for that field is ignored and the process continues to the next field. |
RENAME | Rename the field specified in the Field Name column by entering a new name in the Start column. |
Text (Character, Numeric), Binary (Real, Float, Long, Short) and Formatted (Date, Date Time and Colour) field types can be selected in the Modify File Structure dialog:
You can use the Modify function to left-justify text files that were imported in column delimited format, and format numeric fields even if you don't want to modify the file. For example, if an imported file includes more decimal places than you require, you can use this function to rewrite decimal places and left-justify all fields.
Note that setting the unit of measure of a field will bind the unit of measure to that field. Changing the unit of measure from the form will NOT perform a unit conversion. (File | Field | Calculate or File | File Transformer, etc. can be used to perform the conversion.)
If a Unit value is not specified, when modifying a record, the existing Unit value will remain unchanged. If you need to clear the Unit value of the record, an explicit setting of <undefined> must be entered.
Type
Text fields
Select either Character or Numeric from the Text group of the Type column drop down.
Selecting either option will enable the Width field, which is used to enter the required width of the Character or Numeric field (in characters).
Selecting Numeric will also enable the Decimals field, in which you can enter the number of decimals required for the Numeric field.
Binary Numbers
Real Fi
elds
When choosing how Real numbers are formatted, you can specify the number of decimal places or the number of significant figures:
When modifying the structure of a file and adding a Real field, the field is populated with a Decimals format and blank decimals. Unless the decimal precision is explicitly set, a default precision, based on the data in that field, will be used.
For Real fields, the valid range of precision is -9 to 9 decimals (includes 0 decimals), then the default decimal precision. Negative decimals on a Real field are rounded to powers of 10.
For Float (single-precision) fields, the valid range of precision is 1 to 9, then the default decimal precision. FLOAT fields are now deprecated in File Create/Modify and are no longer recommended. FLOATS are converted to REALs (double precision), improving precision and avoiding numerical inconsistencies.
Long fields are integer fields with a range of ± 2,147,483,647. Long fields are best suited for a count, ID number, or record number field where the numeric values are integers that are expected to exceed 32,767.
A Short field is an integer with a range of ± 32,767. Use a Short field for numerical codes and other small integer numbers.
More information on binary numbers is contained in Binary fields.
Formatted Types
Date
Use the drop down in the Format column to select the ISO (yyyy-mm-dd) date format, or select a (Short, Medium, Long or Full) date format.
Date/Time fields
Use the drop down in the Format column to select the ISO (yyyy-mm-ddThh:mm:ss) date/time format, or select a (Short, Medium, Long, Full or Time) date format.
When you select a Short, Medium, Long, Full, or Time format, the field is formatted using the International Components for Unicode (ICU), based on the locale of your computer. For more information, see: http://demo.icu-project.org/icu-bin/locexp
The English (Australia) locale is switched to use the English (United Kingdom) locale, since the short date formats of the latter are preferred.
Colour fields
In the File Editor, the content of a formatted Colour field is displayed as a (selectable) colour patch.
This field can be used to colour code data displayed in Vizex. However, if you are mapping Colour values to a Colour Set, the "Colour" field you select must be a field that contains valid RGB, HTML Hex, Hex, or Integer colour definitions.
Width
The Width column is used to enter the width (in characters) for a field where the Character or Numeric value type is chosen - as outlined in Type.
Decimals
The Decimals column is enabled when Numeric is selected for a field. The column is used to enter the number of decimal places required - as outlined in Type.
Before
The Before column is used to select the field before which the new field is to be inserted in the file where the Insert function is specified. The action button at the right of the Before cell opens the Fields dialog, from which you can select the value.
Start and Increment
The Start and Increment columns can be used to enter a constant value to a newly defined field and increment the numeric component of a newly defined field in successive records.
To enter a constant value (character or numeric) to a selected field in every record of a file, enter the value in the Start column opposite the selected field (and 0 for the increment). After processing the modifications, the value appears in the selected field in all the records of the file.
To increment the value entered in the Start column in successive records, enter the increment or decrement (a negative value) in the Increment column. Beginning with the value in the Start column, the increment is added to the first numeric characters found successively record by record. For example, if for a field called HOLE, DDH0001 is the value in the START column and 1 the value in Increment, the HOLE field will contain DDH0001, DDH0002, DDH0003 etc. after modification.
Only integer values can be incremented in Character fields. If decimals are required, the field type must be changed to Numeric.
To create or modify a file via a macro
- Select File | Create or Modify File or Macros | File Create/Modify from the main menu.
- Select the file you want to modify, or enter the name of a new file to be created.
- Select the appropriate file type.
- Optionally, enter a descriptive title of up to 40 characters. A DESCRIPTION column, at the right-hand side of the grid, allows the purpose and the content of any field in the file to be described using a maximum of 255 characters.
- If you want to left-justify fields or format numeric fields, select these options.
- In the table defining the file structure, select or enter the required values.
- If using the RENAME function, remember to enter the new field name in the Start column.
- If using the DELETE GROUP function, remember to enter the last field name in the Before column.
- Click on the Forms menu button if you want to save the file structure as a form set.
- Click on the Run button to run the macro.
Modifying the structure of a file in a previous version will remove any descriptions you have added in the current version.
When you add new fields using the Modify function, no data is lost from the file. If, however, you delete a field that contains data, that data will be lost.