This seems like a basic question, but is there a w...
# ask-community
d
This seems like a basic question, but is there a way to end/return a Flow early based on a condition with the Case control flow class? For example, I have a task that queries a DB and returns the results. The next task creates a file with those results. I'd like to add a condition that does something like this:
Copy code
with case(results, None):
    return # End the Flow
The examples with the Case Control Flow class always show an alternative task to run:
Copy code
with case(cond, "a"):
        run_if_cond_is_a()

    with case(cond, "b"):
        run_if_cond_is_b()
But I don't always have another task, sometimes I just need the flow to end. I could check the inverse of 'results' to see if there is data instead of for None, and I could then run the subsequent tasks, but then I would need another task to check that condition. That's fine if that's how it needs to be done, but I just wanted to check if there was a simpler solution that I'm missing.
k
Hi @DK, maybe you can have a task that raises the
ENDRUN
signal?
d
@Kevin Kho that worked! thanks
👍 1