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 prefix 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 (~/). Regardless of the filename extension in the path, .plist is assumed.
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 formats the Rating column based on an expected integer value representing the number of stars. However it is possible to directly edit the cell. The correct method of interpreting the cell content is to take its integer value. The integer value can be used with the Set statement which will handle out of range values.
- ~
- The column represents an out of bounds column.
- A
- The column contains a Yate Album ID. Qualifiers is empty.
- T
- The column contains a Yate Track ID. Qualifiers is empty.
- P
- The column contains an Apple App PID.
- empty
- The column does not represent Yate metadata which can be modified. The column is an Export Set special field type not covered above. Qualifiers contains the name of the special field type.