Try our conversational search powered by Generative AI!

Property Exists vs Property Not Set


I need a way to tell whether a page does not have a particular property defined versus having the property defined but no value set.  How can I do this?

pseudo code for what I want to accomplish:

if(CurrentPage contains a property called "theProperty")
    if(CurrentPage["theProperty"] != null)
        do something...

I only want to apply the logic in the second "if" statement if the page has a property called "theProperty" defined.


Nov 19, 2012 18:50

If a property is not set it will not be saved in the database. But I guess you could load the actual pagetype definitions to check if your property exists. 


Check out the PageType class. 


Nov 19, 2012 19:22

There is a function in the property class:


Nov 19, 2012 20:41

Cr*p I've totally missed that one possibility.

Nov 19, 2012 20:48

That might do it.  Testing now.

Nov 19, 2012 21:03

Done and done.


Nov 19, 2012 21:11

Your'e welcome :)


Nov 19, 2012 21:20
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.