I have an ITERATOR action in my workflow. Following the ITERATOR action, I have a FILTER to filter only on "Seattle". If the city is Seattle, I have 5 steps I want to perform for each iteration. So my workflow looks like this:
ITERATOR -> FILTER -> Action 1 -> Action 2 -> Action 3 -> Action 4 -> Action 5.
My data looks like this:
[
{
"city": "Los Angeles",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Seattle",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Seattle",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Boston",
"population": 300,
"males": 150,
"females": 150
}
]
I only want to process only the 1st "Seattle" array element. Here's my question: after I receive the first iteration of "Seattle", I want to ignore the rest of the array elements.
I think I can do this with a counter and a filter, but I'm not sure.
If I change my workflow to this:
ITERATOR -> FILTER (If city = Seattle) -> COUNTER (initial value = 0, increment by 1, final value = 1, Reset = No) -> Filter (If final value = 1) -> Action 1 -> Action 2 -> Action 3 -> Action 4 -> Action 5.
It is my believe that this workflow will process all array elements via ITERATOR, but will only pass the 1st FILTER if the city is Seattle. And will only pass the 2nd filter if the COUNTER final value is 1 (one), and then of course the 5 actions I want to happen will only happen 1 time, because Seattle was only found 1 time while the counter was 1. I assume that the 2nd time ITERATOR finds "Seattle", it will pass the 1st FILTER. COUNTER will then increment the final value by 1 (1 + 1) and it will now have a value of 2. The 2nd FILTER will not pass because the final value is no longer 1.
Is this correct?
ITERATOR -> FILTER -> Action 1 -> Action 2 -> Action 3 -> Action 4 -> Action 5.
My data looks like this:
[
{
"city": "Los Angeles",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Seattle",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Seattle",
"population": 300,
"males": 150,
"females": 150
},
{
"city": "Boston",
"population": 300,
"males": 150,
"females": 150
}
]
I only want to process only the 1st "Seattle" array element. Here's my question: after I receive the first iteration of "Seattle", I want to ignore the rest of the array elements.
I think I can do this with a counter and a filter, but I'm not sure.
If I change my workflow to this:
ITERATOR -> FILTER (If city = Seattle) -> COUNTER (initial value = 0, increment by 1, final value = 1, Reset = No) -> Filter (If final value = 1) -> Action 1 -> Action 2 -> Action 3 -> Action 4 -> Action 5.
It is my believe that this workflow will process all array elements via ITERATOR, but will only pass the 1st FILTER if the city is Seattle. And will only pass the 2nd filter if the COUNTER final value is 1 (one), and then of course the 5 actions I want to happen will only happen 1 time, because Seattle was only found 1 time while the counter was 1. I assume that the 2nd time ITERATOR finds "Seattle", it will pass the 1st FILTER. COUNTER will then increment the final value by 1 (1 + 1) and it will now have a value of 2. The 2nd FILTER will not pass because the final value is no longer 1.
Is this correct?