Application icon

Read Database Sidecar File

If you want to process an arbitrary CSV/TSV database file you need to know the column mappings. This function reads the column mapping information from a database sidecar (plist) file and encodes the information in a Yate List in the specified named variable with -Encoding appended. The raw column names are stored in a second named variable which has -Names appended. A third list with -Qualifiers appended contains qualifying information.

The path may contain any of the escape sequences described in Escape Sequences. At runtime, the path to a database must be absolute (/) or relative to the home folder (~/).

Example: Save to named variable Sidecar Information. Named variable Sidecar Information receives the encoded mapping list. Sidecar Information-Names receives the column names. Sidecar Information-Qualifiers receives the qualifier names.

If the plist file is successfully read and it represents a valid Yate database sidecar file the action test state will be set to true, otherwise false. When false, all three named variables will be cleared.

The list delimiter used to separate the components is a \~ sequence.

Note that it is your responsibility to load the content file associated with the sidecar file. The Read Text File statement can be used to read the content. The CSV Data to List statement can be used to create lists from the content of a CSV file.

Each item in the encoding list represents a column encoded as follows:

/
The column contains a File Path. Qualifiers is empty.
:
The column contains a Folder path. Qualifiers is empty.
=
The column is an editable Yate field. The field name is in the qualifiers list. These names can be used to indirectly read fields in a track by placing the name in a variable and using the \= escape sequence. The fields may be written by using the Set Indirect statement.
#
The column is associated with a UDTI whose name is in the qualifiers list. The associated fields in a track can be read and written by using the User Defined Fields statement.
@
The column is associated with a UDURL whose name is in the qualifiers list. The associated fields in a track can be read and written by using the User Defined Fields statement.
&
The column is associated with a Unique File Identifier whose name is in the qualifiers list. The associated fields in a track can be read and written by using the User Defined Fields statement.
!
The column is associated with a named Comment whose name is in the qualifiers list. The associated fields in a track can be read and written by using the User Defined Fields statement. Note that the default comment (unnamed), will be represented as an = encoding.
*
The column represents a rating. The Yate Database viewer does not support inline editing of rating fields but rather uses a menu to choose a number of stars. The length of the content for this column can be used as star rating value on the Set statement.
empty
The column does not represent Yate metadata which can be modified. Qualifiers is empty.