Hi everyone, I am trying to use a conditional flow...
# ask-community
r
Hi everyone, I am trying to use a conditional flow with a mapped results.Here is an example of what I would like to do :
Copy code
conditions = is_true.map(input_data)
as = do_a.map(input_data)
bs = do_b.map(input_data)
ifelse(conditions, as, bs)
It does not work out because the ifelse function expect the condition to be a boolean, not a list of boolean. Is there a way to do it differently?
c
is your goal to do many if/else conditions (one for each mapped result) or a single if/else condition? If it’s the former, you might try:
Copy code
results = ifelse.map(conditions, as, bs)
👍 1
r
As far as I know, this does not work out. "ifelse" is a function, not a task. Or do you mean I could try to decorate the ifelse function with a "task" decorator?