Accessing the results of a query

After querying the 1010data Insights Platform, your application receives a set of results, which can be accessed via the Table object.

The Session method, RunQuery, runs the query. The Table object is the result of the query.

In this example, the resultTable is set to the result of testSession.RunQuery(exampleQuery). The application prints the title of each column and the first 10 rows of the table.

using System;
using TenTenSDK;

public class DocumentationExample {
    public static void PrintTable(Session testSession, String path) {
        Query exampleQuery = new Query(path,
                                       "<sel value=""(between(i_;1;10))""/>");
        Table resultTable = testSession.RunQuery(exampleQuery);
        Console.WriteLine(String.Join("\t", 
                          resultTable.Columns.Select(c => c.Info.Title)));
        foreach(Row r in resultTable.Rows) {
            Console.WriteLine(String.Join("\t", 
                                          r.Select(d => d.ToString())));
        }
    }

    public static void Main() {
        Uri gateway = new Uri("https://www2.1010data.com/cgi-bin/gw.k");
        String user = "[USER_NAME]";
        String pwd = "[USER_PASSWORD]";
        String path = "[TABLE_PATH]";
        Session testSession = new Session(gateway, user, pwd,
                                          LoginType.POSSESS);
        PrintTable(testSession, path);
    }
}
Note: [USER_NAME], [USER_PASSWORD], and [TABLE_PATH] are placeholders for valid Insights Platform user name, password, and table path.