Reusable Global Variable

I would like to set a variable "Clinic" to User Prompt with a list of "Clinic A|Clinic B|Clinic C".

In another Macro, I would like to have a user prompt to set the Clinic Variable to refer to the Clinic list from the first macro and choose from the list. Thus, instead of recreating the list of clinics of each macro, I would like new macros to refer to the Clinic variable that is somehow set globally (with a user prompt to choose).

What is the best way to go about it?

Are we just talking three clinics or a variable number , and if so what is the max?

All KM Variables are global by default, unless the variable name starts with either "Local" or "Instance".

So, all you need to do is set two global variables:

  1. DND__Clinic_List -- list of clinics to choose from
  2. DND__Clinic -- the chosen clinic

I use "DND__" as a prefix to denote KM Variables you "Do Not Delete". The double underscore results in only the text after the underscores to appear in KM Prompt Actions.

So, in each macro, you have this:

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Using Global Variables for Lists [Example]

-~~~ VER: 1.0    2020-05-26 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Using Global Variables for Lists [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


@JMichaelTX

Thank you very much for the macro. It works but I am confused about this step. Your are setting the variable "DND__Clinic" to |%Variable%DND__Clinic%|%Local__Clinic_List%

"DND__Clinic" is set to "DND__Clinic" ? I don't follow the logic. Please explain.

Also, how would I reference "DND__Clinic" in other User Prompts? Just intert "%Variable%DND__Clinic%" ?

Yes. Exactly.

1 Like

That uses the current value of DND__Clinic as the default choice of of the popup list Local__Clinic_List. For details, see Prompt for User Input action -- Popup Field.

If you don't want a default for the popup, then just remove it.