Question

I have a components that based on schema that have a non mandatory metadata field ExtendedType. I can query for a component that have this field with a certain value:

new CustomMetaValueCriteria(new CustomMetaKeyCriteria("ExtendedType"), "Highlight", Criteria.Equal)))

I need to query for a components that have no this field filled in. How can I query for a that.

In SQL I can write next:

select * from t where t.ExtendedType IS NULL

How can i do this using Trdion Query? In common i need to implement query like:

select * from t where t.ExtendedType = "Highlight" OR t.ExtendedType IS NULL
Was it helpful?

Solution

You might be able to achieve this with the NotInCriteria, as follows:

new NotInCriteria
(
    new CustomMetaValueCriteria
    (
        new CustomMetaKeyCriteria("ExtendedType"), "%", Criteria.Like
    )
)

I haven't tested this, it's just a thought. Even if it works, be sure to check if it performs as well!

PS: next time, please use the tridion.stackexchange.com forum for Tridion-related questions!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top