retrieve list of objects using if-then-else

0
Hi, How can use an "if" statement in a retrieve activity? I have a local boolean variable and upon its result I need to retrieve a list of objects using a set of constraints (more if true, and less if false). I know I can use an exclusive split and then retrieve the list according to boolean result, but this ends up in creating two distinct flows, and after that check the microflow gets quite big, and I don't want to replicate the lot for each one of the list objects created. I suppose that I could extract the larger microflow bit into a new microflow and just pass the list as a param. I might do that, just thought that using an if statement in the retrieve would be the very easy thing to do. What I was looking to do was something like this (in retrieve activity)... if myVar = true then retrieve list where myDate >= PreviousObjectDate and myDate <= CurrentObjectDate else retrieve list where myDate <= CurrentObjectDate regards, LR.
asked
1 answers
2

You can do something like this in your retrieve:

[
  ($myVar = false or $myDate >= PreviousObjectDate)
  and $myDate <= CurrentObjectDate
]

But in most cases it's a lot clearer what the microflow is doing if you do two "normal" retrieves instead (just do this in a sub-microflow and return the list, so your main microflow only uses 1 list). In a lot of cases this could also be better for the query performance.

answered