I am using a “set multiple variables” module to evaluate different event scenarios. In the image below, each key in the bundle is the identifier of a scenario. So, in this instance, event S7 has occurred because it is “true.” Only one key/scenario can be “true” at a time and the rest will always be “false.”
What is the best way to obtain which scenario/key is true? For instance, here the output I need is simply “S7”
I have tried creating an array to evaluate, but I must be doing something wrong.
Welcome to the Make community!
Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
A.
Save the bundle contents in your text editor as a bundle.txt
file, and upload it here into this discussion thread.
Uploading it here will look like this:
bundle.txt (12.3 KB)
B.
If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:
-
Either add three backticks ```
before and after the code, like this:
```
input/output bundle content goes here
```
-
Or use the format code button in the editor:
Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.
Following these steps will allow others to assist you here. Thanks!
2 Likes
Since you are already evaluating something in your 88.Set multiple variables, you can set the output to the required output (e.g. S7) instead of TRUE. Don’t know what function you are using, but you can add an if()
function if needed.
Next, you can set a filter after this module to only continue with the bundles that are NOT FALSE.
2 Likes
The problem with that approach is there will be way too many nested if() formulas to evaluate 10+ (and growing) scenarios to create just one output.
If you are looking for a different approach, we need more details to understand which data is coming in and what you would like to receive as output. See the post of @samliew with a detailed description of the information that would be helpful.
1 Like