Getting information from matching records

The Fetch method

The Module class Fetch method is used to get information from the matching records once the search of a module has been run. The server maintains the set of matching records in a list and the Fetch method can be used to retrieve any information from any contiguous block of records in the list.

Specifying columns

This section specifies the values that can be included or used as the columns arguments to the Module class Fetch method.

A simple example

In this example we build a simple .Net based console application to search the Parties module by last name and display the full set of results.

using System;

using IMu;

namespace a_simple_example

{

   class Program

   {

      static void Main(string[] args)

      {

         string host = "oxford.man.kesoftware.com";//"imu.mel.kesoftware.com";

         int port = 40136;

         Session session = new Session(host, port);

            // start-example

         Module parties = new Module("eparties", session);

         Terms terms = new Terms();

         terms.Add("NamLast", "Smith");

         long hits = parties.FindTerms(terms);

         String[] columns =

         {

            "NamFirst",

            "NamLast"

         };

         ModuleFetchResult result = parties.Fetch("start", 0, 2, columns);

            // end-example

         int count = result.Count;

         IMu.Map[] rows = result.Rows;

         Console.WriteLine("Count: {0}", count);

         Console.WriteLine("Hits: {0}", hits);

         Console.WriteLine("Rows:");

         foreach (IMu.Map row in rows)

         {

            int rowNum = row.GetInt("rownum");

            long irn = row.GetLong("irn");

            String firstName = row.GetString("NamFirst");

            String lastName = row.GetString("NamLast");

            Console.WriteLine(" {0}. {1}, {2} ({3})",

               rowNum, lastName, firstName, irn);

         } 

         Console.WriteLine("Press any key to finish...");

         Console.ReadKey();

      }

   }

}

In this example the name parameter entered via the HTML search page is submitted to the .Net script. The script searches for parties records that have the entered value as a last name and display the parties first and last names in an HTML table.