Is it possible to create a multiselect field dynamically?

Hi,
I’m creating a formula and I would like to list some things in a multiselect type, where the user will choose one.
The point is that these options will be loaded from a file.
Is it possible to read this file and make each line become a option in this multiselect?

2 Likes

Hey, Joao! Thanks for the question!

Right now, I believe the closest thing to what you want is the use of the dynamic input parameter type as per Config File - Ritchie (ritchiecli.io)

(Note there’s a small error in the example, in that $..users should actually be within quotes, as in "$..users".)

To use the dynamic input parameter type, however, you will need to point to a file served by a web server (you won’t be able to point directly to the filesystem). Support for dynamic will be removed in future versions and, unless I’m mistaken, will be replaced by something more flexible that should provide exactly what you want. (Tagging our dev magician @GuillaumeFalourd to confirm this.)

I guess another possible workaround in the meantime would be to create another Formula/automation that runs before this one you are working on, reading the file and manipulating the other Formula’s config.json to populate the options used by the input parameter of type multiselect.

As @dcominottim said, the dynamic inputs will be deprecated in future version.

Our idea is to implement an output feature that will allow users to implement formulas and keep output values to use them as inputs in other formulas. That way, you’ll be able to easily create workflows gathering many formulas together (it’s already possible with input flags, but not as flexible without output).

Another point @Joao_Silva: Depending on the way you will execute your formula, you can also perform a multiselect question through your implementation, using prompt (note that this won’t work if you plan to run formulas automatically with input flags). Here is an example in Python using inquirer. That way, you can return a dynamic list of options depending on your context.

1 Like

Thanks @dcominottim and @GuillaumeFalourd for the answers. =)

2 Likes

Hi
I just did a pull request creating a formula to create, list and remove Cron jobs.

2 Likes

Wow, that’s so cool, João! Super glad to have you in our community! :smiley:

1 Like

Hi guys, it’s been a week since my PR is awaiting approval.
Do I need to do anything else to be approved?

Hey, @Joao_Silva! Can you please reply with the link to the PR?

Hey @dcominottim @GuillaumeFalourd do you have any feedback?

Hey, @Joao_Silva! The team is finishing the approval process and you’ll receive news veeery shortly! :smiley:

Thanks a lot for contributing! We hope to see many other good ideas such as this flowing in!

1 Like

By the way, in case you feel like it, we’d love to have you participate in our Ritchie Journey, @Joao_Silva! We have some cool prizes for people who join and perform the activities up until 30/06 – it’s super easy and fun! Check it out:

1 Like

P.S.: It’s very cool that you’re basically on level 3 already with your nice Formula, eligible to compete for level 4 and get the biggest prizes, @Joao_Silva – the only thing lacking is the formal subscription to the Journey via the Google Form and the LinkedIn or Twitter posts from level 2 and 3. It’ll be super nice to have you get our cool rewards if you’re up for it! :wink:

1 Like

(Closing since the matter was solved and the discussion ended!)