• #51458
    Forcetalks

    what is the difference between empty and null ?

    Is there any difference between null and empty?

    #51487
    Salesforce | Adam Adam #301
    Forcetalks

    Another one to test us on 🙂

    From the outside the difference can appear very slight.  But to code that is running, it could mean very different outcomes!

    In coding (once again I am assuming it is in the context of APEX), something could be NULL because it doesn’t exist or hasn’t been instanciated (ie it hasn’t been created/setup).

    Where as empty has two possible outcomes/possibilities.  It could mean that it is a string/text (as an empty) that is nothing.  For example ”.  There is nothing in between the ‘ and the ‘.  But the code has allocated memory to the variable, even if there isn’t any actual text stored.  Additionally, it could also mean NULL (see above).

    The Salesforce documentation also makes note of ‘blank’ which essentially has three possible outcomes: that whitespace is stored in the field, that ” is stored in the field, or NULL.  So when using forumals in Salesforce, I always try to use ISBLANK(), as it is the most ‘inclusive’ of the three functions.

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?