ConnectorLib .NET 24.2

# Retrieve a Record

The following example shows how to retrieve (or "select") a record by reference:

           Record selected = docs.SelectOne(
    		docs.Column("Reference") == @"C:\data\file1.txt",
    		new string[] { "Reference", "LastModified"});

The first argument specifies the query to perform and selects records where the Reference column is equal to "`C:\data\file1.txt`". The query is expressed in terms of a filter - of all the records, only those that match the filter are selected. The second argument specifies the columns to retrieve.

You can extract the values from the `Record` object using the square brackets operator or one of the `GetAs` methods for common types:

           string reference = selected["Reference"];
           DateTime lastModified = selected.GetAsDateTime("LastModified");

The `SelectOne` method returns the first record to match the filter, or `null` if no records match. To retrieve more than the first match you can use the `Select` method instead.

## Retrieve Multiple Records

To retrieve multiple records, use the `Select` function:

           docs.Select(
    		record => task.Log.WriteLine(LogLevel.Normal,
    			"Found record: " + record["Reference"]),
    		docs.Column("Reference") == @"C:\data\file1.txt",
    		new string[] { "Reference", "LastModified" });

The second and third arguments are identical to those of the `SelectOne` method. They specify a filter and the columns to return. The first argument specifies a function that is called for each record found, which in this case writes the reference to the log.

Copyright 2024 Open Text
Version 24.2 | Last updated March 2024

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL ConnectorLib .NET 24.2

Topic Title: Retrieve a Record