Open topic with navigation

# 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.

© 2018 Micro Focus or one of its affiliates | Send documentation feedback to Micro Focus Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm