Java Example
// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
// Search for document instances in the "EfficiencyProposals" class.
SearchSQL sqlObject = new SearchSQL();
sqlObject.setSelectList("T1.DocumentTitle");
sqlObject.setFromClauseInitialValue("EfficiencyProposals", "T1", false);
sqlObject.setFromClauseAdditionalJoin(JoinOperator.INNER, "ClbRecommendation","T2",
"T1.VersionSeries", JoinComparison.EQUAL,"T2.ClbRecommendedVersionSeries", false);
sqlObject.setDistinct();
// Create a SearchScope instance. (Assumes you have the object store object.)
SearchScope search = new SearchScope(os);
// Execute the fetchRows method using the specified parameters.
Boolean continuable = new Boolean(true);
RepositoryRowSet myRows = search.fetchRows(sqlObject, null, null, continuable);
// Iterate the collection of rows and print the titles of all recommended documents.
Iterator iter = myRows.iterator();
while (iter.hasNext())
{
RepositoryRow row = (RepositoryRow) iter.next();
System.out.print("\nDocumentTitle: " + row.getProperties().get("DocumentTitle").getStringValue() );
}
C# Example
// Create a SearchSQL instance and specify the SQL statement (using the helper methods).
// Search for document instances in the "EfficiencyProposals" class.
SearchSQL sqlObject = new SearchSQL();
sqlObject.SetSelectList("T1.DocumentTitle");
sqlObject.SetFromClauseInitialValue("EfficiencyProposals", "T1", false);
sqlObject.SetFromClauseAdditionalJoin(JoinOperator.INNER, "ClbRecommendation","T2",
"T1.VersionSeries", JoinComparison.EQUAL,"T2.ClbRecommendedVersionSeries", false);
sqlObject.sqlObject.SetDistinct();
// Create a SearchScope instance. (Assumes you have the object store object.)
SearchScope search = new SearchScope(os);
// Execute the fetchRows method using the specified parameters.
bool continuable = true;
IRepositoryRowSet myRows = search.FetchRows(sqlObject, null, null, continuable);
// Iterate the collection of rows and print the titles of all recommended documents.
foreach (IRepositoryRow row in myRows)
{
System.Console.Write("\nDocumentTitle: " + row.Properties.GetProperty("DocumentTitle").GetStringValue());
}