IRtConnection.GetList Method (String, String [])

The GetList method (String, String[]) returns a collection of ListItems for a specified list name. The ListItems include all columns in the list as individual properties of the ListItem class.

For example, if the list sent from the host system contains five columns, then the ListItem objects in the returned collection contains properties named “Column1”, “Column2”, “Column3”, “Column4”, and “Column5”. These can then be processed by the client application individually. You can also supply an array of names to label the columns in the ListItem collection, if you prefer specific names rather than the default names, such as “Column1”, “Column2”, and “Column3”.

Note: This method should only be used with traditional lists that were created by using SendListDynamic or SendListStatic.

Namespace – ABSuite.AccessLayer.Connector.Core

Assembly – Unisys.ABSuite.AccessLayer.Connector.Core (in Unisys.ABSuite.AccessLayer.Connector.Core.dll)

Syntax

IEnumerable<ListItem> GetList(
   string listName,
   string[] names = null
) 

Arguments

Return Value

If this method succeeds, it returns a collection of list items that can be iterated, bound to a ViewModel, or sent directly to a list-based control, such as a list box.

Using the IRtConnection Interface for the GetList Method (String,String[])

The following code is an example of using the interface for the GetList (String,String[]) method:

// Load the SREP ispec that returns the SREP.SALESREP list
// Substitute the column names to use ID and Name instead of the 
// default Column0, Column1, etc…
   LoadIspec("SREP");
   IEnumerable<ListItem> myList = ABSConnection.DataHandler.GetList("SREP.SALESREP", 
   new string[] { "ID", "Name" });
   // Retrieve the first item in the list and extract the details 
   // using the ID and Name keys
   ListItem item = myList.First<ListItem>();
   string id = item["ID"];
   string name = item["Name"];