Search & Replace in Variable (Dynamically Created)

I guess the title says it all.
I want to Search and Replace in Blockxx

I'm sure it's right in front of me, can't see it.

It works for "Set Variable" but not Search Variable

Yep, you're correct: While Tokens work in the Set Variable action, the do not work in the Search and Replace action.
So, we have to add a couple of Actions PRIOR to the Search to make it work:

Does this answer your question?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here's the complete example macro:

updated 2017-10-29 16:34 CT

  • Revised macro to hopefully make it easier to understand.
  • Macro now has two Blocks, with a User Prompt to choose the Block to be processed
  • Added workflow process in Comment at top

MACRO:   Use Dynamic Variable Name in Search Action

-~~~ VER: 2.1    2017-10-29 ~~~

DOWNLOAD:

Use Dynamic Variable Name in Search Action.kmmacros (8.3 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


1 Like

Aa always thank you for your time and expertise!
The example helped greatly.
I saw your response last night and wasn’t at a computer but mulled it over in my head and did not get it. Then this morning having my coffee, I was determined to understand it… WOOF - it took me a bit, but I think I have my head around it, - it’s not that earth shattering but it does take a second to sink in… =) especially this German’s hard head =).

  • So that Step 2. above will set the variable “Local__BlockN” to the value of the variable that “Local__BlockN” is currently set to. Do I have that right?
    For me completely counterintuitive, but completely awesome! very slick.
    Again, thank you and have a Blessed Day.

Yes. That Action, Filter Variable with Value of Named Variable, will set the value of Variable "Local__BlockN" to the value of Variable "Local__Block1".

That is because in the prior action, we set "Local_BlockN" to the variable name "Local__Block1".

Make sense?

This is tricky stuff, which we call "dynamic variables", or "indirect variables", and can be tough to get one's head around. So feel free to ask any questions.

1 Like