简体   繁体   中英

Tridion Query for component that have no exact metadata field

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM