Hi everyone,
I’m running into an issue with a scenario where I’m trying to control the execution flow using a variable (i
). The goal is to stop uploading files to S3 after the first result meeting a specific condition has been processed. However, the variable i
is not incrementing as expected, and every result is being pushed to S3.
Here’s the relevant flow:
- Set Variable (Initialization): I initialize the variable
i
to0
at the start of the scenario, using the “execution” scope. - Iterator and Router: An Iterator loops through an array of video results, and a Router checks if the duration of each video is greater than or equal to 10 seconds.
- Filter Condition: Inside the Router, I add a filter that checks if
i = 0
to ensure only the first matching video is uploaded to S3. - S3 Upload: If the condition passes, the video is uploaded to S3.
- Increment
i
: After the upload, another Set Variable module is supposed to incrementi
by 1 using this formula:
{{parseNumber(44.i) + 1}}
(Module 44
is where the variable i
is set initially.)
Despite the increment step executing (verified via logs), the value of i
is reset to 0
for each step in the iteration, and the condition i = 0
continues to pass for all iterations. The final “Set Variable” module appears to correctly increment i
as execution logs indicate the output value of i
is always after that step.
Context:
- The variable
i
uses the “execution” scope to persist across iterations. - I suspect there might be an issue with how the variable value is being updated or retrieved in subsequent steps.
- The scenario is configured to run in sequential mode, so execution order should not be an issue.
Questions:
- Why does the variable
i
not persist between steps in theiterate
module when it is initialized outside of that scope? - Is this a bug?
- Is there a better way to ensure only the first video meeting the duration condition is uploaded to S3?
Any guidance or alternative architecture suggestions would be greatly appreciated!
Thanks in advance for your help!