Pricing Blog

How to you check for undefined?

  • uunicode-1415000900602167366

    unicodes

    4 days ago

    For that cases where you have an input, you can check not equal to null, to empty string, but for undefined? You can convert to string and say not equal to undefined, but something like not equal to null does exist?
  • lucasg-1415015430300373002

    Lucas G

    4 days ago

    Depends on the check you need to do. Assigning a default value is usually the better way to do it
  • If it’s just a Boolean check then you don’t even need to compare to anything since undefined is a falsy value
  • uunicode-1415017075944198246

    unicodes

    4 days ago

    I was looking for a solution where you receive some data from the database, and if it’s empty, null, or undefined, it doesn’t display anything. Right now, I’m handling this by using a default value or converting to a string and checking if it’s different from undefined. But I thought it was worth asking in case there’s some method I don’t know about, or maybe something smart, like when I recently discovered you can concatenate two arrays and remove duplicates. :))
  • lucasg-1415022003382915182

    Lucas G

    4 days ago

    I don’t allow empty strings so I’d just be able to use the item itself as the condition for show/hide
  • Since null and undefined are falsy values
  • lucasg-1415022466723483698

    Lucas G

    4 days ago

    But other than that, you have to default to something as you cannot check for undefined with native formulas (you can use a one line custom formula though)
  • uunicode-1415022497027330139

    unicodes

    4 days ago

    I used size > gr. than 0, this one works for everything. But maybe consumes too much energy just for exclude all of them? :))
  • lucasg-1415022584281694299

    Lucas G

    4 days ago

    Undefined will not be a thing in the future though (in NC)
  • uunicode-1415022768201928755

    unicodes

    4 days ago

    It would be useful having it, hope they will consider adding it.
  • lucasg-1415032997262135457

    Lucas G

    4 days ago

    No, I mean there will not be any undefined values
  • uunicode-1415034474529292350

    unicodes

    4 days ago

    Ahhh, ok
  • lucasg-1415034571568975944

    Lucas G

    4 days ago

    And, to clarify for anyone else that may read this, what I mean by using the item itself directly is just doing this:
    1415034571321381005-image.png
  • If that value is null or undefined then it'll be a falsy value and work to show/hide or whatever else you'd need to do the bool check for
  • Unlike in JavaScript, empty strings and 0 are not falsy values though so keep that in mind
  • uunicode-1415035218208886925

    unicodes

    4 days ago

    but you can add "AND" and add equal to empty string.
  • lucasg-1415035397221777573

    Lucas G

    4 days ago

    yes
  • well "not equal" to but yeah
  • uunicode-1415035608572629124

    unicodes

    4 days ago

    1415035608426090596-Screenshot_2025-09-09_at_21.06.14.png
    👍1
  • lucasg-1415036138640638053

    Lucas G

    4 days ago

    What cases do you allow empty strings to be stored in db?
  • uunicode-1415037452791578737

    unicodes

    4 days ago

    I'm not allowing this.
  • lucasg-1415040002890530987

    Lucas G

    4 days ago

    Ah you had said that this is for data being received from database
  • uunicode-1415040350573297745

    unicodes

    4 days ago

    I'm not sure, but if there is no row in the table it could return undefined? Maybe?
  • lucasg-1415064810969628734

    Lucas G

    4 days ago

    Undefined and empty strings are not the same thing though