Child pages
  • Metadata Transformation Tools, Tips, and Tricks
Skip to end of metadata
Go to start of metadata

GREL

splitByCharType Function

The splitByCharType function will split up data into an array, and will group consecutive like characters (e.g. all lowercase letters will be grouped together, all punctuation will be grouped together). You can then extract the sections of a field that you need by using indexing. Additional information.

Code block
splitByCharType(column to edit)[index]

Where:

  • column to edit = either the current column, value; or another column cells.<column name>.value
  • index = index position of the array element you want to access

 Examples

Syntax
From : v.<start vol.>(<start year>)-v.<end vol.>(<end year>), extract just <start year>-<end year> i.e. From v.1(1925)-v.20(1945), extract 1925-1945.

splitByCharType(value)[4] + splitByCharType(value)[6] + splitByCharType(value)[11]

Or

splitByCharType(value)[4] + "-" + splitByCharType(value)[11]

Syntax
From : v.<start vol.>(<start year>)-v.<end vol.>(<end year>), extract v.<start vol.>-v.<end vol.>

splitByCharType(value)[0]+splitByCharType(value)[1] + splitByCharType(value)[2] +splitByCharType(value)[6] +splitByCharType(value)[7]+splitByCharType(value)[8] + splitByCharType(value)[9]

or

"v." + splitByCharType(value)[2] + "-v." + splitByCharType(value)[9]


Regex

Excel functions

TEXT function

The TEXT function converts a numeric value to a text string. It is particularly useful when dealing with date transformations. Additional information.

Syntax
TEXT(value, format_text)

Where:

    • value = cell reference or numeric value
    • format_text = how you want the resulting text to be formatted

Examples

Number to text without format change.
=TEXT(A2, "0")
Date to yyyy-mm-dd format (i.e., 2017-10-19)
=TEXT(A2,"yyyy-mm-dd") 
Date to full date format, including day of the week (i.e., Wednesday, October 19, 2017)
=TEXT(A2,"dddd, mmmm d, yyyy") 
Date to full date format (i.e., October 19, 2017)
=TEXT(A2,"mmmm d, yyyy") 



OpenRefine

  • No labels