How to return a value only if it is set?

Options

The value `ongoingTimeCategorizationUpdated` is only present when a couple of conditions are true. This leads to an issue when it's not set.

Is there a way to handle that use case gracefully? I'd like to avoid an extra action, if possible.

Answers

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Add the extra function step - create variable ongoingTimeCategorizationUpdated and set it to null. This is practically free from a computation point of view. The subsequent create variable call will just update it in place.

  • Ambroise
    Ambroise Member
    Options

    Okay, that's what I had in mind but I wanted to know if there weren't a simpler way to do this, because it's fine for a single variable, but if the endpoint grows, it can lead to a lot of noise - I was hoping to tell the Return step to only return it if present, something like that.