Separating Prompt With List list build vs execution steps

I use the Prompt With List feature a fair bit, and sometimes the work to build the list is pretty involved—lots of steps to determine which fields to show, for instance, based on variable conditions. So by the time I get to the actual Prompt With List action, there are already many steps above that in my macro. Then I have to add a Case statement to handle each of the choices in the list. The end result is a long complex macro that's hard to work with.

I had a thought on how I could break things into manageable chunks. In hindsight, it seems really obvious and simple, so maybe this is common knowledge. In case it's not, here's what I'm doing...

In the prompt, I use the ability to set a different response value versus what's displayed, as discussed in this thread on modifying variables on the fly in Prompt With List actions.

So instead of listing A house cat in the Prompt With List (from text) box, I list cat__A house cat. If I select "A house cat" from the list, the value returned is cat. I give each entry a unique value, and then, instead of a big Case statement after the prompt, I have just one subroutine call. It looks like this:

That subroutine is where the Case statement lives, and it looks like this:

Within each 'is cat' or 'is large-dog' section, I typically put a Group action, and then put all that responses' actions in the group. Then I have one-click disclosure for whichever processing macro I need to work on.

As I said, stupidly simple, but posting in case it may be useful to others who use complex Prompt With List actions.



Hi @griffman. Thanks for taking the time to share information like this that you learn during the development of your macros.

1 Like