CSV Import

CSV is a very popular and widely supported simple yet versatile textual format for data, described e.g. in the Wikipedia here. MoStacks on Windows offers an importer for CSV files. This importer is rather sophisticated, and thus importing a CSV file is probably the easiest way to arrive at a new MoStack filled with data.

Note that MoStacks can also export data to CSV files which opens the possibility to export, then process/modify data with another tool in a way that MoStacks does not support (or supports only poorly), and finally re-import the modified data.

You can import a CSV file and let MoStacks turn it into a new stack, or you can import CSV data into a selected background of an already existing stack (that might contains other backgrounds, complete with cards that won't be affected by the import.)

MoStacks support CSV files in the Latin-1 / Windows coding, probably the most common text file coding as of today in the world of Windows PCs. (See the Wikipedia entry here.) It supports also Unicode text files in UTF-8 encoding (see the Wikipedia description here.)

There are a number of text file formats that MoStacks does not support that can contain CSV data as well, e.g. Unicode in UTF-16 encoding and files with non-Windows line endings, i.e. files from Unix or Apple Macintosh. But there are a number of good freeware programs (like e.g. BabelPad) that you can use to convert the files first before importing them with MoStacks.

As you can see in the frame Delimiter of the window CSV Import Options, MoStacks supports commas (the C in CSV), semicolons and tab characters as delimiters (the characters that separate the individual data values on a line). In the rare case of a CSV file with still another delimiter you will have to resort to using a text editor like Notepad or BabelPad and replace the delimiters first.

The following options influence the import:

First line is header line with column names?: Most CSV files have a special first line that does not contain data but names for the data columns in the file. (MoStacks cannot detect automatically whether that first is data or indeed such a header line.)

With this option set the first line is treated as header line, and the column names become field names and labels in the one background of the resulting stack. With this option not set MoStacks treats already the first line as data and produces generic names for the controls and corresponding generic labels.

Note that setting this option wrong either leaves you with one data record short and nonsensical names for the controls, or with a nonsensical first card and a field type detection (see next option) thrown off-course by the atypical "field" values of the first line.

Try to detect field types?: With this option set MoStacks takes a "look" at the data column-by-column and tries to guess the data type of each column. Anything that can't be confirmed to be a numerical, a boolean, a date or a time value column defaults to text. With this option not set all columns become text fields.

The "guessing" is quite sophisticated on the one hand and careful on the other hand: Already a single text value in a column that otherwise contains only numbers lets MoStacks default to a text column instead of a number column, because the text value would get lost otherwise. (Empty values, on the other hand, are no problem and result in values of zero.)

It's recommend to leave that option set or at least try first to import with this option set and only switch it off for a second import attempt if anything should still go wrong. MoStacks so far has only rudimentary support for changing the type of a field while keeping the values on existing cards, so if after import you have only text fields it's hard to reform the stack.

Try to detect order / create sort key?: With this option set MoStacks checks after import wether the data records in the CSV file were probably sorted, and if yes, creates a corresponding sort key and sets the Keep cards sorted? flag of the background. With this option not set the order of the cards will correspond exactly with the order of the lines in the CSV file, and no sort key will be defined.

For deciding whether a sort order is present or not, MoStacks takes the values of the first field and the values of the first and the second field combined and checks whether the values are all or almost all in ascending order.

First field as card name if suitable?: With this option set MoStacks checks after import all the values in the first field. If they are unique or nearly so and thus suitably identify the cards, the Use value as card name? flag is set for the first field, and the cards get their names through this mechanism. With this option not set no such checks take place, and cards get simple ascending numbers as names.

Note that you are free to set that field flag anytime yourself later as well, even if this results in lots of cards with identical names (which still may may be better than cards that basically have no names.)