cancel
Showing results for 
Search instead for 
Did you mean: 

Document Query for Blank Keywords

Paul_Hoecherl
Confirmed Champ
Confirmed Champ

Like the title says, I am looking for an example of querying for documents where a specific keyword is empty or blank (empty string).

 

 What I’m seeing is that the API is returning all documents, not just the ones with blank values for the keyword. 

 

 How can I specify that I really want to find the documents with blank keyword values in a GetDocument request?

 

It seems like a simple thing, but so far I haven't been able to find any guidance in the SDK programmers guide or the Sample Browser, but I may just not know what to look for.

 

2 REPLIES 2

Tim_Richard2
Champ on-the-rise
Champ on-the-rise

Paul,

OnBase doesn't store keywords without a value, except in the case of a keyword group.  Single-instance and multi-instance keyword groups can store null values.  For regular keywords, there isn't an API nor user interface that allows for the retrieval of documents that have a missing (blank) keyword value.  To do this, I've always used a SQL query where the document and keyword tables are outer joined, and I look for all docids in the document table that have don't have a corresponding one in the keyword table.  

 

This query can also be placed in a custom query configured for custom SQL.  I believe you could run that query via API, though I've never done so.

Daniel_Quill
Elite Collaborator
Elite Collaborator

It is not so simple but... There is a trick that can be used and that is to use the DocumentQuery DisplayColumn.  Adding DisplayColumns allows you to added a keyword to the query as a column in the same way you would use a CustomQuery.  The results that are returned will have a NULL value if there is no value assigned to the keyword. 

 

The downside is that when the results are returned you will need to iterate through the DocumentList and find those NULL values as there is no way to filter them out without iterating.

 

This does require the use of the ExecuteQueryResults() to return the DocumentList and the DisplayColumns.