Update my variable multiple times in a scenario

Hi, and Happy New Year!

I have a variable (“NOTIFICATION BODY”) that I create at the beginning of my scenario with a “Set Variable” module.
Then on multiple occasions, I need to update this variable by adding text to it (like concatenating text).

The goal is for each main section of my scenario to log what’s been done.
Then at the end, I want to use this text as the body of an iOS Push Notification, so I can double check what my scenario did.

So it’s a bit like:

  • step 1: Set variable NOTIFICATION BODY = “Hello.”
  • step 2: Set variable NOTIFICATION BODY = NOTIFICATION BODY + “How are you?
  • step 3: Set variable NOTIFICATION BODY = NOTIFICATION BODY + “My name is Brian
  • step 4: Set variable NOTIFICATION BODY = NOTIFICATION BODY + “The sky is blue today.
    etc etc

At the end, I’m hoping that my variable contains all the texts:

Hello. How are? My name is Brian. The sky is blue today.

But it seems to only contain the initial value and the last update: “Hello. The sky is blue today.

What am I missing ?
Thanks for the help.

Attached is a screenshot of my scenario to try and explain the flow.

Right now there is no way to access variables from another route.

You can submit this suggestion to the Idea exchange, under Platform ideas. Don’t forget to search for it first, just in case someone already suggested it!

You’ll have to do a workaround, temporarily storing the variable you want in storage, like a data store or Google Sheet.

Then, in the final route, you could fetch all of the saved items to concatenate, and then clear/delete the store for the next scenario run.

Alternatively, you could try to arrange your modules so that they run linearly, without the use of routers.

2 Likes

So I found the solution/workaround.

I just needed to insert a “Get variable” module before the “Set variable” module (and refer to this added module instead of referring to the initial “Set variable” module. (this for each of my sections.

4 Likes

Thanks for the reply @samliew

1 Like

Hey there @BV :blob_wave:

Great to see you cooperating with our amazing @samliew to solve this problem!

Also thank you very much for coming back here with the clever workaround. This way we keep our community neat and organized for all of us.

Keep up the amazing job! :sunny:

1 Like