This tag, if used, populates a drop-down list of saved searches in the inputs section. The selected search is then converted into the FROM clause of its respective saved search.



<search id = string
     name = string> 


Name Description Data Type Required
id determines how the field is referenced in the SQL action section of the script. string yes
name determines how the field appears to the user when the Relativity script runs. string yes


The search input allows you to enter a drop-down list of saved searches. Each search input must be assigned a search ID and name.

In Relativity, all saved searches get turned in SQL statements and those SQL statement are run to retrieve document results. When you select a saved search in the input, the replace value in the scripts turns into the FROM clause in the generated SQL associated with the search.

code example of saved search as an SQL statement


The following script illustrates how you can use a saved search in a Relativity script:

                <name>Sample Relativity Script with Saved Search</name>
                <description>This Relativity Script demonstrates how to retrieve values from a selected Saved Search.</description>
                <category>Case Functionality</category>
                                <search id="savedSearch" name="Saved Search:" />
                                <field id="identifierField" name="Identifier Field:" required="true">
                                <field id="updateField" name="Field to Update:" required="true">
                                <constant id="updateValue" name="Updated Value:" type="text" required="true" />
                                <constant id="artifactIdStart" name="Starting Artifact ID:" type="number" required="true" />
                                <constant id="artifactIdEnd" name="Ending Artifact ID:" type="number" required="true" />
                <action returns="table" timeout="1200"><![CDATA[
                --Check for temp table existance
                IF NOT OBJECT_ID('EDDSDBO.RelativityTempTable') IS NULL 
                                                DROP TABLE EDDSDBO.RelativityTempTable
                --Create temp table
                CREATE TABLE EDDSDBO.RelativityTempTable
                                DocumentArtifactID INT,
                                #identifierField# varchar(200)

                --Insert all Document Artifact ID's from selected Saved Search
                INSERT INTO 
                #savedSearch# AND [Document].ArtifactID BETWEEN #artifactIdStart# AND #artifactIdEnd#

                --Update temp table with Control Number
                UPDATE RT
                SET RT.#identifierField# = DD.#identifierField#
                FROM EDDSDBO.RelativityTempTable RT
                INNER JOIN EDDSDBO.Document DD ON RT.DocumentArtifactID = DD.ArtifactID
                --Update the Fixed Length Field in the temp table for Control Numbers between certain values
                UPDATE D
                SET D.#updateField# = '#updateValue#'
                FROM EDDSDBO.Document D
                INNER JOIN EDDSDBO.RelativityTempTable RTT ON D.ArtifactID = RTT.DocumentArtifactID

                SELECT 'Fields Updated...'
                --Drop temp table
                IF NOT OBJECT_ID('EDDSDBO.RelativityTempTable') IS NULL
                                                DROP TABLE EDDSDBO.RelativityTempTable


When run, a drop-down menu contains a list of all saved searches in the system.

input field for a sample script

  • Select a saved search, an identifier field, a text field to be updated, and specify a string value that the field will be updated to and range of document Artifact IDs.
  • The script checks if the EDDSDBO.RelativityTempTable already exists, and if it does, drops it.
  • Creates the temp table with Artifact ID and CHAR identifier fields.
  • Inserts the Artifact IDs from the saved search and NULL into the temp table based on a range of provided document Artifact IDs.
  • Updates the character field in the temp table with the selected identifier field based on a join with the EDDSDBO.Document table.
  • Updates the selected character field in the EDDSDBO.Document table to the specified string value based on a joint with the temp table.
  • Drops the temp table and displays a confirmation message to the end user.