Date field parsing

Note: Some of the recipes listed below now exist as knowledge base articles on the Relativity Community. When you click those links, you must enter valid Community credentials to access those articles. The remaining recipes will soon be integrated into their corresponding feature documentation so that they'll show up either as new topics or new headings within existing topics. Once this relocation is complete, we will be deprecating this home page, and all of the content below will be accessible via search on our sites.

You must have valid Relativity Community credentials in order to download any Community file linked to the documentation site. You'll need to enter those credentials on the Community login screen if you're not already logged in. If you're already logged in to the Community at the time you click a link, the file is automatically downloaded in the bottom left corner of your screen. If you get an error message stating "URL No Longer Exists" after clicking a Community link, it may be due to a single sign-on error related to the SAML Assertion Validator, and you should contact your IT department.

The Date Field Parsing solution parses the date and time from a Date field. It then writes the values to a separate field for each document returned by a specific saved search.

To download the solution files, visit the Relativity Community.

This page contains the following sections:

Before you begin

The Date Field Parsing solution parses date and time values from date source field. It adds these values to two different destination fields. The source is a Date field, while the destinations are Fixed-Length Text or Long Text fields. The solution completes this process all the documents returned by a specific saved search. When configuring the solution, you need to specify the following items:

  • A specific saved search.
  • The Date field with the data to parse.
  • The fields used to store date and time values.
  • The format uses for date and time values.

Supported versions

This solution is supported in Relativity 8.1 - Server 2021.

Solution version Supported Relativity version
3.1 8.2 - Server 2021

Components

This solution consists of a Relativity script that runs at the workspace level.

Considerations

Review the following considerations for this solution:

  • This script should only be run by a system admin. If you are not a system admin, we recommend you do not run this script.
  • The script overwrites the values in the destination fields. You can't undo these modifications.
  • The script doesn't parse a date or time value from the date source field for a document when the field is NULL.
  • This solution doesn't support the client domains (multi-tenancy) and Data Grid features of Relativity.

Deploying and configuring the solution

Preparing the workspace

After deploying the solution, you can install and configure it in a workspace by completing these tasks:

  1. Install the solution script from the Relativity Script Library. See Installing the solution script.
  2. Optionally create destination fields for storing the date and time values for each document. See Creating the destination fields.

Installing the solution script

Complete these steps to install the solution script:

  1. Navigate to the workspace.
  2. Click the Administration > Scripts tabs.
  3. Click New Relativity Script.
  4. At the Script Type, click Select from Script Library.
  5. In the Scripts section, click Ellipsis (...) button.
  6. Select the radio button next to the Date Field Parsing script.
  7. Click OK.
  8. Click Save.

Creating the destination fields

Before you run the solution, ensure that destination fields exist for storing the date and time values. You can use existing fields or create new fields for storing these values. The solution overwrites any values stored in existing fields.

The destination fields must be Fixed-Length Text or Long Text fields. Designate two fields if you want to store both date and time values. Designate a single field if you want to store only the date or time values.

Complete these steps to create one or more fields to store the parsed data:

  1. Click the Administration > Fields tabs.
  2. Click New Field.
  3. Click Document in the Object Type drop-down list.
  4. Enter a name for the field in the Name field. You choose any name for the field name.
  5. Click Fixed-Length Text or Long Text in the Field Type drop-down list.
  6. Select any other options that you want for the field.
  7. Click Save and Back.
  8. To create an additional destination field, repeat steps 2 - 6.

After installing the script in a workspace and creating the destination fields, you can run the solution.

Running the solution

After setting up the workspace, complete the following steps to configure and run the solution:

  1. In the workspace, click the Administration > Scripts tabs.
  2. Click the name of the Date Field Parsing script. The Date Field Parsing script page appears.

    The Date Field Parsing script input page.

  3. Complete the following fields:
    • Saved Search - Click the name of the saved search. This search returns the group of documents with data that you want to parse and store.
    • Date Source - Click the name of the field that contains the data to parse. The field must be a Date field associated with the Document object.
    • Date Destination (output) - Optionally click the name of the Fixed-Length Text or Long Text field used to store date values. The script parses these values from the Date Source field. Leave this field blank if you don't want to parse and store date values.
    • Date Format - Optionally click the format used to store date values. The script parses these values when you select a Date Destination (output) field. Leave this field blank if you don't want to parse and store date values.

      The following table uses the date January 25, 2015 to illustrate the format options.

      FormatExample
      DD/MM/YYYY25/01/2015
      DD/MM/YY25/01/15
      MM/DD/YYYY01/25/2015
      MM/DD/YY01/25/15
      YYYYMMDD20150125
    • Time Destination (output) - Optionally click the name of the Fixed-Length Text or Long Text field used to store time values. The script parses these values from the Date Source field. Leave this field blank if you don't want to parse and store time values.
    • Time Format - Optionally click the format used to store time values. The script parses these values when select a Time Destination (output) field. I Leave this field blank if you don't want to parse and store time values.

      The following table uses the time 7:18 PM to illustrate the format options.

      FormatExample
      hh:mmAM (or PM) 07:18PM
      hh:mm:ssAM (or PM)07:18:43 PM
      hh:mm(24h)19:18
      hh:mm:ss(24h)19:18:43
  4. Click Run.

The script parses data from the specified Date field. It makes the following updates for each document returned by the specified saved search:

  • If you selected a Date Destination (output) field, the script adds the date value in the Date Source field to the field that you selected. It also uses the format that you selected.
  • If you selected a Time Destination (output) field, the script adds the date value in the Date Source field to the field that you selected. It also uses the format that you selected.

After script runs successfully, it displays the Script Complete message. This message indicates that the destination fields now contain the appropriate data for each document.

The Date Field Parsing script page with sample data.

Viewing the solution results

You can view the results of the script by navigating to a view, layout, or other items that contains the destination fields that you selected. You select these fields when configuring the solution script.

The document list with the Destination Date and Destination Time columns, and sample data.