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?
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
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
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.
I just did a pull request creating a formula to create, list and remove Cron jobs.
Wow, that’s so cool, João! Super glad to have you in our community!
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, @Joao_Silva! The team is finishing the approval process and you’ll receive news veeery shortly!
Thanks a lot for contributing! We hope to see many other good ideas such as this flowing in!
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:
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!
(Closing since the matter was solved and the discussion ended!)