I'm looking for a Querybuilder query for resources that have a field with a null value.
This solution seems to indicate there's a way to do this with SQL2, but is there a way to do this with a Predicate style search?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Preston,
According to JCR documentation NULL value defines situation when given property is not present.
In SQL2 getting nodes without specific property can be achieved like below using IS NULL:
SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE([/content/we-retail/language-masters/en/men]) and s.[jcr:content/pageTitle] IS NULL
The equivalent for querybuilder could be like that:
path=/content/we-retail/language-masters/en/men
type=cq:Page
property=jcr:content/pageTitle
property.operation=not
Please also check list of all supported predicates:
Nope.. it doesnt work. It bring the one with value too. AFAIK I feel you should do iterate for the property exists query and check if the value is empty as suggested here.
Hi @Preston,
According to JCR documentation NULL value defines situation when given property is not present.
In SQL2 getting nodes without specific property can be achieved like below using IS NULL:
SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE([/content/we-retail/language-masters/en/men]) and s.[jcr:content/pageTitle] IS NULL
The equivalent for querybuilder could be like that:
path=/content/we-retail/language-masters/en/men
type=cq:Page
property=jcr:content/pageTitle
property.operation=not
Please also check list of all supported predicates:
@Preston Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
I believe so. I also needed to check for if a field was possibly an empty string (so empty or null) and that doesn’t seem to be possible in Predicate syntax. Only SQL2. So I think I got my answer to the null check and hit the wall otherwise.