Skip to main content
OCLC Support

Enter format text

Learn how to enter the data tags, hash tags and labels into the Format Text field in OLIB.

►Data Exchange Reference Data> Output Formats

This information relates to the data tags and commands that are entered in the Format Text field of the Output Formats domain. This domain is where you can define new output formats for exporting and displaying data.

The Format Text field determines the format of the output when you export your data. It is a free text field where you enter the export format. The basic principle is that you enter the 'data tag' representing the field you want to include, surrounded by the text that you want to be included before and/or after the data. A 'data tag' is taken from the Data Tag List surrounded by brackets '<' and '>'.

For example, <TI> is the data tag representing the Title field. The data tag will be replaced by the data when the record is exported or displayed.

Data tags and labels

To include data from a non-repeatable field, enter the data tag surrounded by brackets '<' and '>'. For example, to include the title preceded by a Title: field label, enter the following in the Format Text field:

Title: <TI>

This very simple export format will output just the titles of the selected records, preceded by the field label 'Title:' e.g.

Title: An A-Z of counseling theory and practiceTitle: An abridged guide to CornwallTitle: Adoption - what it is and what it meansTitle: Adoption and loss

Hashtags

These are mnemonics surrounded by hashes and are used to control the display of the data and associated text depending on whether the field is populated in the record. Other special hashtags control the overall format of the record and output.

For example, the following export format will output the titles of the selected records, preceded by the field label Title:, together with the subtitle preceded by Subtitle: if the subtitle is present in the record. In addition, the inclusion of #B# at the end means that each record will start on a new line:

Title: <TI>
#STNN#Subtitle: <ST>
#/STNN##B#

e.g.

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Title: An abridged guide to Cornwall
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people
Title: Adoption and loss
Subtitle: implications for contemporary social work in the UK

Non-repeatable data (Title fields)

The following detailed syntax rules are used for the data and hashtags. The full list of data and hashtags are included in the general Data Tag List.

(TI, RN, NF, ST, RS, DF, CD, ED, FMD, MT, ME, OG, PAGES, PK, SIT, IF, SPTI, SHST, SPNF, BTD, LM, PUBP1, PUBP2, RESRC, SP, TIED, TISD, TISER, TINT)

The above 'Title: <TI>' will force the Title: field label to be included in the exported record even if the field itself is blank. To prevent the field label and/or punctuation from being included in the exported record when the field is blank, use the #[data tag]NN##/[data tag]# hash tag set, with the text and the data tag included between the start and end hashtags. For example, the following will cause the subtitle to be included in the exported record, preceded by the Subtitle: field label, but only if the subtitle field is not blank:

#STNN#Subtitle: <ST>#/STNN#

If you want the next field to be exported on the next line rather than on the same line, the terminating hashtag must be entered at the beginning of the next line. For example,

#STNN#Subtitle: <ST>
#/STNN##EDNN#Edition: <ED>
#/EDNN#

If you don't do this, records without a subtitle will have a blank line where the subtitle would normally go.

Repeatable data

These include authors, publishers, prices, series, notes, subjects, classmarks, title control numbers, copy details, cross-referenced titles, alternative titles, ISxNs, attached objects, physical details.

Repeatable data fields are those that can occur more than once in the record. For example, you can link a title to any number of authors or subjects - the author surname field, the author forename field, the subject field, etc. are regarded as repeatable fields. Repeatable fields are grouped into repeatable data blocks. For example, all the author fields are grouped into the Authors repeatable data block.

For the configurable export facility, each repeatable data block has been allocated a two-character repeatable data tag (RDT) and a repeatable data prefix (RDP). The following table shows the RDT and RDP for each repeatable data block.

Repeatable data block RDT RDP
Authors AU A
Subjects SU S
Classmarks CL L
Publishers PU P
ISxNs IS I
Copies CO  C
Attached Objects OB O
Physical Details PH F
Prices PR R
Series SE E
Notes NO N
Title Control Numbers XC Y
Cross-Referenced Titles XT X
Alternative Titles  AT T

     
To include repeatable fields in the exported record, you must surround the field labels, punctuation and the data tags with the relevant #RDT##/RDT# hashtag set. For example, to include the author forename and surname fields preceded by an Authors: field label, with the responsibility fields in parentheses at the end, and with the authors separated by ';', enter the following in the Format Text field:

Authors: #AU#<AF> <AS> (<AR>) ; #/AU#

This will export the records as follows:

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Authors: William Edward STEWART (AUTH) ; David Smythe (AUTH) ; Joan HANAFIN (AUTH) ; Ricardo SABATES (AUTH) ; Neera SHARMA (AUTH) ;
Title: An abridged guide to Cornwall
Authors: Paul CHATTERTON (AUTH) ;
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people
Authors:

Null values

In this example, the Authors: field label is exported even if the title is not linked to any authors. To exclude the label if there are no authors, you must surround the whole repeatable data block with a #[RDT]NN##/[RDT]NN# hashtag set. For example:

#AUNN#Authors: #AU#<AF> <AS> (<AR>) ; #/AU##/AUNN#

will export the records as follows:

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Authors: William Edward STEWART (AUTH) ; David Smythe (AUTH) ; Joan HANAFIN (AUTH) ; Ricardo SABATES (AUTH) ; Neera SHARMA (AUTH) ;
Title: An abridged guide to Cornwall
Authors: Paul CHATTERTON (AUTH) ;
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people

Different repeatable data blocks

Another problem with this example is that it includes a space, semi-colon and space after each author, including the last author, and including the first author if it is the only author. To have different punctuation for the first and subsequent repeatable data blocks, use the #[RDP]1##/[RDP]1# hashtag set for the first block and the #[RDT]NN##/[RDT]NN# hashtag set for the others. For example:

#AUNN#Authors: #A1#<AF> <AS> (<AR>)#/A1##AU# ; <AF> <AS> (<AR>)#/AU##/AUNN#

will export the records as follows:

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Authors: William Edward STEWART (AUTH) ; David Smythe (AUTH) ; Joan HANAFIN (AUTH) ; Ricardo SABATES (AUTH) ; Neera SHARMA (AUTH)
Title: An abridged guide to Cornwall
Authors: Paul CHATTERTON (AUTH)
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people

In this example, the ';' is at the start of the #AU##/AU# hashtag set, and it is not included in the #A1##/A1# hashtag set. So it is not included if there is only one author, and it is not included at the end of the multiple author string.

You can use the #[RDP]1##/[RDP]1#, #[RDP]2##/[RDP]2# and/or #[RDP]3##/[RDP]3# hashtag sets to include just the 1st, 2nd and/or 3rd repeatable data blocks in the exported record. For example:

#AUNN#Authors: #A1#<AF> <AS> (<AR>)#/A1##A2# ; <AF> <AS> (<AR>)#/A2##A3# ; <AF> <AS> (<AR>)#/A3##/AUNN#

includes just the 1st three authors in the exported record, as follows:

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Authors: William Edward STEWART (AUTH) ; David Smythe (AUTH) ; Joan HANAFIN (AUTH)
Title: An abridged guide to Cornwall
Authors: Paul CHATTERTON (AUTH)
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people

Finally, the #[RDP]L#…#/[RDP]L# hashtag set is available to specify what should be exported for the final repeatable data block. For example:

#AUNN#Authors: #A1#<AF> <AS> (<AR>)#/A1##A2# ; <AF> <AS> (<AR>)#/A2##A3# ; <AF> <AS> (<AR>)#/A3##AL# et al#/AL##/AUNN#

will export the 1st three authors and, if there are more than three authors, it will include 'et al' at the end of the author string, as follows:

Title: An A-Z of counseling theory and practice
Subtitle: an intermediary guide for learning professionals
Authors: William Edward STEWART (AUTH) ; David Smythe (AUTH) ; Joan HANAFIN (AUTH) et al
Title: An abridged guide to Cornwall
Authors: Paul CHATTERTON (AUTH)
Title: Adoption - what it is and what it means
Subtitle: a guide for children and young people

The same principles apply to all repeatable data blocks.

Abstract

To include the abstract in the exported record, include the <AB> tag in the appropriate position in the export format record.

A special tag, <ABLB>, is available as an alternative abstract export tag. This causes the abstract to be split into lines of at most 100 characters, the cut-off point being the last space before the 100th character. The first line is prefixed by AB and a space. Subsequent lines are prefixed by AB \. This mirrors the format in which the abstract is exported when a record is exported using the standard OLSTF export format.

Special tags

Header

To include a header at the top of the export file (e.g. for column headers in CSV files), start the Format Text field with the #H#…#/H# hashtag set. Include the header text between the #H# and the #/H#. The following example will include field names as the first line of a comma-separated file:

#H#Title, Authors, Subjects, ISBN, Publisher, No. Copies#/H#

The system automatically includes a line break after the terminating #/H# tag.

Blank lines

To force each record to start on a new line, include the #B# hash tag on the last line of the export format. To include 3 blank lines between each record, include four #B# hashtags on separate lines at the end of the export format.

Comma-separated and tab-separated formats

Certain tags can be used to allow you to export data in this way so that you can open the exported data using MS Excel.

Specify that an Output format is intended to produce columns of output with a separator as follows:

  • Use #csv#, #CSV#, #tsv# or #TSV# in the format in the position where the field separators should appear.
    csv will use a comma as the separator and tsv will use the TAB character.
  • Using at least one #sep:x# where a separator should appear and #sep# elsewhere.
    x can be one of: comma (,), #tab#, decimal point (.), colon (:), semicolon (;), at (@), tilde (~), hash (#), forward slash (/), backslash, pipe (|), asterisk (*), exclamation mark (!), apostrophe ('), quotation mark ("), dollar ($), percent (%), ampersand (&), plus (+) or equals (=)
    x will be identified in the sequence above. If a subsequent #sep:y# is present elsewhere (before or after the #sep:x#), this will appear unmodified in the output result.

The encapsulating character is designated as a quotation mark ("), unless this is specified as the separator. In which case the encapsulation character will be an apostrophe (').

If the data or the formatted text, after processing the tags, contains the separator or the encapsulating character then the fields will be encapsulated using the designated character. If the formatted text uses the encapsulating character, it must be escaped by being doubled in the format definition.

If the separator is "%" then the data will be encapsulated, regardless of whether this is necessary.

For example, in the Output Formats domain see Tab Separated Titles Export and Example Excel Export.

Create a new output format and Rebuild Config Data as normal
Search for the titles to be exported and work through the export process. If you open the file in Notepad you will see that the data is separated by tabs. If you open the file in MS Excel (as a tab-delimited file) it will open in columns.