3

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
beardeddev
  • 565
  • 1
  • 5
  • 15
  • 1
    You may want to consider using the Tridion-dedicated Stack Exchange site on http://tridion.stackexchange.com for your SDL Tridion questions in the future. – Bart Koopman Apr 16 '13 at 20:56

1 Answers1

2

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!

Quirijn
  • 3,549
  • 15
  • 30