cancel
Showing results for 
Search instead for 
Did you mean: 

Get Documents with Blank Keywords

Carlos_Guerra
Champ in-the-making
Champ in-the-making

Hi, How do I get with DocumentQuery the Documents which contains a specific Blank keywords? I mean get all the documents where the Keyword "XXXX"  has no value.

 

Regards

4 REPLIES 4

Stephanie_Bauer
Champ in-the-making
Champ in-the-making

I also am interested in hearing the answer to this.

Anthony_Farkas
Confirmed Champ
Confirmed Champ

Adam has a good solution to this problem that i have used previously.

It is about half way down this post and involves a custom query.

Original Post:

https://www.hyland.com/community/technical_communities/onbase_installation_expertise/f/11069/p/7534/...

Adam Shane:

"

I realize that there have been a number of replies, but I thought that I would weigh in a bit and offer some clarification.  In the past our recommendation is to create a SQL Custom Query to narrow down the NULL values for the particular keyword.  That being said, there are some nuances with creating the SQL.

For instance, lets say that you were looking for a value of a dual table keyword, the SQL would like like the following:

-- XXX is the Document Type Group num
-- YYY is the dual table keyword num
SELECT * 
FROM hsi.itemdata
LEFT OUTER JOIN hsi.keyxitemYYY k0 ON hsi.itemdata.itemnum = k0.itemnum
WHERE k0.itemnum IS NULL
AND hsi.itemdata.itemtypenum IN (XXX) 
AND hsi.itemdata.status + 0 = 0

In order to turn this query into a SQL Custom Query in config it would need to look like the following (in this example the keyword num is 1 and document type is 101):

For a single table keyword, the SQL would look like the following:

-- XXX is the Document Type Group num
-- YYY is the single table keyword num
SELECT * 
FROM hsi.itemdata
LEFT OUTER JOIN hsi.keyitemYYY k0 ON hsi.itemdata.itemnum = k0.itemnum
WHERE k0.itemnum IS NULL
AND hsi.itemdata.itemtypenum IN (XXX) 
AND hsi.itemdata.status + 0 = 0

In order to turn this query into a SQL Custom Query in config it would need to look like the following (in this example the keyword num is 120 and document type is 101):

 Finally, I posted some information about caveats that you can run into when creating SQL Custom Queries here.

"

Timothy_Cosgrif
Star Collaborator
Star Collaborator

There currently is no way in the API to do this using KeywordType.CreateBlankKeyword() with a DocumentQuery.

You can, however, execute the above custom query using DocumentQuery in the Unity API.

Christopher_Lew
Champ on-the-rise
Champ on-the-rise

I apologize for raising this issue from the dead, but is there not a simpler way with the new versions of OnBase?