IBM FileNet P8, Version 5.2.1            

Querying for Recommended Documents

The following Java™ and C# examples query for recommended documents of a specified class type. The code prints the document titles from the result set.

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());
}


Last updated: October 2015
socialCollab_recommendations_snip2.htm

© Copyright IBM Corporation 2015.