Get Fields for Key Item in List [Example]

MACRO:   Get Fields for Key Item in List [Example]

~~~ VER: 1.0    2018-05-22 ~~~


Get Fields for Key Item in List [Example].kmmacros (12 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

This macro was built in response to this request:
Cross-reference Macro

Example Output





  • Lookup Data Associated with Key Field in List


  1. KM 8.0.2+
  • But it can be written in KM 7.3.1+
  • It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
  1. macOS 10.11.6 (El Capitan)
  • KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:

NOTICE: This macro/script is just an Example

  • It has had very limited testing.
  • You need to test further before using in a production environment.
  • It does not have extensive error checking/handling.
  • It may not be complete. It is provided as an example to show you one approach to solving a problem.

How To Use

  1. Trigger this macro.
    • It will then prompt you for the key item
    • Then output the results of the lookup


  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
  1. Assign a Trigger to this maro..
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro.
    (all shown in the magenta color)
    • Set Your Product List
    • Choose a Product
      • The Product choices must exactly match the first item in the Product List.

TAGS: @RegEx @List @Lookup


  • Any Action in magenta color is designed to be changed by end-user


  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions


  • While I have given this limited testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.


1 Like

As usual, a very complete explanation and example. I will study and learn from this. Thank you!

1 Like

@JMichaelTX, This one works like a charm.

My only question is how to link to an external tabbed-delimited file, but think I can figure that out based on other solutions already provided.

I may have questions once I return to work on Tuesday. Thanks for all your help!

Edit: Ok, I couldn't wait. I already converted your example and linked to a tab-delimited external file.

1 Like

That's great! For the benefit of all readers, you probably did something like this:


where you changed the RegEx to support a tab delimited list:

That's just about what I did.

I did not add the "+" after "\t". Does it just allow for more than one tab character between data strings?

What does the "Mode Modifier" feature do?


What site(s) do you recommend for learning RegEx? I've been using and

Exactly. Just allows multiple tabs for enhanced viewing.

Use whatever works best for you.

I've been using for some time now to develop, test, and store regex snippets, and have a nice library built there. The explanation for a regex is very good, and I often point others to that to explain mine. I like for learning.

and the (?im)? Not sure what that does.

These are the RegEx option codes, probably not needed in this particular case:

i -- makes all comparisons case insensitive
m -- multi-line flag, so that the start of string code `^` and end of string code `$` apply to the start/end of lines as well.

ICU Flag Options

1 Like