Conditions before adding to a list

I have certain variables whose values to be added to a list only if certain conditions satisfies. However the List snippet doesn’t provide any way to do this. Does anyone know a workaround?

From your description it sounds like you just need to put the list action inside an IF statement (rather than an IF statement inside the list action).
Would that work?

Here’s an example that uses an initial, common list, and adds other items to the list (from another list or from a set of text that gets split into separate items) depending upon the day of the week. “If” actions are used for driving the decision of what to do based on the day information it is passed. The example includes examples of negative testing (if NOT this) and nested conditions (if this AND this) as well as just typical positive testing…

Hopefully it’ll give you something practical to work from and experiment with.

2 Likes

@sylumer thanks! This really helps. I would love to use Add to variable action more now :slight_smile: Is there similar work around for Menu too?

Menus and Lists can be similar functionally, but there are fundamental differences. Menus are very much pre-built and give you a nice simple structure for single decision processing. Lists on the other hand can be built dynamically, take more effort to construct the logic around and allow for more sophisticated compound checks without the need to duplicate actions; though this latter one, combinations of menus and lists can strike a good balance.

Here’s another example shortcut to show equivalent functionality approached in different ways using a menu and a list.

Really the best way to understand the difference is to try and build something specific and see which one allows you to build it. Stick to menus where you can to keep it simple, but when it is not sufficient, then look to see if you can use lists instead, or even as well.

Hope that helps.

2 Likes

Cool! will check it out :+1:

This is a great example! You can also create dictionaries in a similar way - I wrote a post that might be useful to @Anirudha_Sant.

2 Likes

Thanks, will check it out :slight_smile: