cancel
Showing results for 
Search instead for 
Did you mean: 

searching for documents based on document type

Abeer_AbuZant
Champ in-the-making
Champ in-the-making
Hello
I would like to ask if there is a way to retrieve documents based on document type ?
What I found is searching for a document using a given ID
one more question, I read about executing query , it should take a max no. of documents , what if i didn't know how many doc the query will give me and i want it to give me all documents?
Thank you.
1 ACCEPTED ANSWER

Harish_Kamal_Me
Confirmed Champ
Confirmed Champ

Here is a way to do it using the API

DocumentQuery docQuery = onbaseApp.getCore().CreateDocumentQuery();

docQuery.AddDocumentType(onbaseApp.getCore().getDocumentTypes().Find("SearchDocType"));

For specifying a MAX Count, there are 2 ways.

DocumentList docList = docQuery.Execute(docQuery.ExecuteCount())

or 

DocumentList docList = docQuery.Execute(Integer.MAX_VALUE)

 

Thanks,

Harish

View answer in original post

7 REPLIES 7

Harish_Kamal_Me
Confirmed Champ
Confirmed Champ

Here is a way to do it using the API

DocumentQuery docQuery = onbaseApp.getCore().CreateDocumentQuery();

docQuery.AddDocumentType(onbaseApp.getCore().getDocumentTypes().Find("SearchDocType"));

For specifying a MAX Count, there are 2 ways.

DocumentList docList = docQuery.Execute(docQuery.ExecuteCount())

or 

DocumentList docList = docQuery.Execute(Integer.MAX_VALUE)

 

Thanks,

Harish

Harish's suggestion would be mine as well: use a DocumentQuery. As Harish noted you can use the DocumentQuery.ExecuteCount() method to obtain a count of the possible results. If you're using OnBase 13 or later you can also use DocumentQuery.ExecuteQueryResults() instead of Execute. The benefit is that ExecuteQueryResults processes the query in chunks of 150 documents at a time. Meaning that if you're querying a very large collection the Query won't choke on trying to process them all at once.

Patrick_Sweeney
Star Contributor
Star Contributor

Querying the database directly would be an unsupported solution and may violate the Database Agreement made with Hyland. Using a DocumentQuery is the advised solution.

Edit:  A colleague pointed out to me that this is not necessarily the case, and that sometimes querying the database is supported and acceptable.  The rule of thumb appears to be that querying the database may breach the Database Agreement if it is being done to circumvent a license like Query license.  The Database Technical Community forum will have more detailed information about when a database query is supported versus when it is not.  In this instance using a DocumentQuery still seems to be the easier solution.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.