Accessing query results

After querying the 1010data Insights Platform, your application receives a set of results, which are accessible through the ResultSet object.

In this example, the ResultSet object is set to the result of exampleQuery.run(). This application prints the rows in the ResultSet.

import com.tentendata.javasdk1010v2.*;

public class DocumentationExample {
    
    public static void printRows(Row r) {
        System.out.println(r);
    }
    
    public static void main(String[] args) {
        String gateway = "https://www2.1010data.com/cgi-bin/gw.k";
        String user = "[USER_NAME]";
        String pwd = "[USER_PASSWORD]"; 
        String ops = "<sel value=\"(between(i_;1;10))\"/>";       
        Session testSession = new Session(gateway, user, pwd, 
                                          LoginType.POSSESS);
        Query exampleQuery = new Query(testSession, path, ops);
        ResultSet results = exampleQuery.run();
        for (long i = 0; i < results.numRows(); i++) {
            printRows(results.row(i));
        }
    }
} 
Note: [USER_NAME] and [USER_PASSWORD] are placeholders for valid Insights Platform user name and password.