Replace function: keys vs. values

Hi there,

since two days now I try to solve something, that probably isn’t hard, but I’m just too gaga ^^

I try to build a subprocess that replaces placeholders with dynamic values gathered by other modules. Concretely I do this by replacing parts of an input in a loop until everything is replaced. The formula for setting the variable is: {{replace(197.headers; 194.old; 194.new)}}

With 194.new being a value such as “{{154.result.extrahiert.text}}”, what is a reference to a value coming from an earlier module.

My weird loop process weirdly works pretty well, but does a fatal error I can’t stop: the NAME of the variable gets processed (“{{154.result.extrahiert.text}}”) instead of it’s value (in this case some test text). So the result doesn’t include the replaced placeholder anymore, but therefore the “link” to the value instead of the value itself.

Can you help me to fix this? Thanks!

1 Like

Hi @Colin_Nitzpon

You challenge is not clear enough. Could you please explain through a loom video to better assist you?

Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation

Hi @Msquare_Automation,

sorry for not being clear. I’m not sure whether a loom would make it easier (because the flow contains many side modules), so I try with pictures and step by step.

Goal: I try to build a virtual assistant, that can create events in my Office 365 calendar based on my text message.

Process:

  1. One part of the process extracts the needed information from the message (location, start, end, subject). Module 154 outputs them:

  2. Module 54 outputs the API-call “template”, including placeholders, marked with [[double brackets]]:

  3. The next part of the process shall bring those together. So far I got here: I created an Array of Collections, which describes all placeholder exchanges:


    “old” marks the placeholder to be replaced, “new” marks the “link” to the result, which by now module 154 will have created (see 1. above).

  4. The next part iterates through the “replacements array” and replace correspondingly. For this, I use variables and the replace-function. The process is set in this way to be independent of the amount of replacements:

  5. Indeed, I get the placeholders replaced, but with the {{LINK}} to the correct values (see screenshot in original post), not with the values themselves (which module 154 offers, see 1. above).

How can I fix this? I could either swap the {{LINK}} with the value all together at the end, or in the replace-Process. But how?

Thanks! :slight_smile:

1 Like