Opening and saving text files

To open a text file

Use the File > Open command and choose Text from the File of type list or drag and drop a given text file into the main GS-Base window.
Next, specify additional text file options:

Field separator A single character used to separate fields in one line.
Fixed field widths A list of fixed field width values. For example:
10,30,15,40
If not all widths are specified, the remaining fields are assumed to contain 1024 characters.
Quoting symbol

A symbol used to delimit fields containing separator characters.
Fields containing quoting symbols, separators or new line characters must be delimited by quoting symbols. The inner quoting symbols must be doubled.
If you need to open a text file that doesn't conform to this standard, consider specifying some unique quoting symbol that doesn't occur within that file.

Encoding Specifies the text encoding for a given text file: UTF-8, UTF-16, ANSI 8-bit, ISO/OEM. The initial value is set based on the file initial bytes.
First row contains field names Specifies whether text strings from the first line of the file should be treated as field names. If you clear this option when reading a text file, GS-Base will use simple "field_nnnn" names. A field names must begin with a letter.
Convert text to numbers If you check this option, a column containing only text strings that can be converted to numbers (without formatting) will be treated as a numeric database field. Otherwise all such columns will be imported as text fields (and will be sorted and searched as plain text fields).
You can also change the field type after you import the file using the Database > Field Properties command.
If automatic field type checking is selected, a given file is scanned twice, with the first pass to make sure there are no conflicts between a given field type and the dat.
Convert text to dates If you check this option, text strings representing dates in one of the local system formats will be converted to generic date/time strings.
As selecting this option may significantly slow down opening a text file, it's recommended that you use the Edit > Convert Field Data > Text To Standard Date String command instead (for selected fields, after the file is opened).
If automatic field type checking is selected, a given file is scanned twice, with the first pass to make sure there are no conflicts between a given field type and the dat.
Set Filter As GS-Base loads files to RAM, to enable processing data from CSV/text files of any size also for computers with insufficient memory, you can now specify "Text File Input Filters" to limit the size of the loaded data. Only filtered records will be loaded from a given file.
Filters can use RegEx patters, the popular relations, ranges of values and fuzzy filters.

Note:When changing most of the option you need to click the "Reload Fields" button to show the number and names of the detected field names.

*

To save a text file

Use the File > Save Recordset As command and choose Text from the File of type list. Next, specify the same additional text file options as above and the following ones:

Save 'Image/File' objects to a zip file
Save 'Long Text' field contents a zip file

If you check this option(s), the contents of GS-Base binary Image/File and Long Text fields will be saved to an additional zip file [text_file_name].zip. The corresponding fields in the saved text table will contain file links referring to that zip structure. For example, if some record in the original GS-Base database has some "Memo" Long Text field and some long text in it, the saved text table some_text_file.txt instead of the "Memo" contents will contain the file path:

some_text_file/r[record_number]\f[field_number]     (like some_text_file/r00000002f00003\text.txt)

If you re-import the some_text_file.txt text table, unzip the some_text_file.zip file and use the Format > Hyperlink command to format that file link text field, clicking that link will open an application associated with the *.txt and showing that former GS-Base Long Text field contents. The same applies to images and other file types.

Note that depending on your database size the above may result in creating a zip file with a very large number streams/files and native Windows tools (e.g. the File Explorer) will require a lot of time to unzip it.

Leaving this option unchecked results in saving the text file only with labels describing the binary contents.

Note: When saving a text file, GS-Base 14.5.3 and earlier versions save only filtered records from the active table and GS-Base 14.7 and later versions saves the whole table using the default (unsorted) record order. To save only the current filtered and sorted recordset, you have to use the Save Recordset As command.

To automatically resize the column widths to fit the field contents in the opened file, select the Options > General > Auto-fit column widths in imported files option. Keep in mind that for very large files this may slow down the process of importing. To optimize the resizing in the Options > General dialog box increase the declared number of processor cores that GS-Base can use.

Related Topics

Saving PDF files
Opening and saving html files
Opening and saving xBase files
Opening and saving Excel workbooks