Possibility of generating variables in backend methods from a string

In UI Builder, I am able to create variables in Page Data from a string.

Using the code below, I end up with separate property/value pairs in Page Data from a string of UTMs.

I am trying to do something similar on the backend.

For example, I have a string of UTMs and I want to create a number of property/value pairs. I would like to avoid using the ‘property of’ block at each following step. I would like to use the variable name directly. As I do in UI Buikder. Is this possible?

eg. Istead of using:
image

I want to use utmName.

Hi @Andreas_Marinopoulos

If I understand your question clearly the answer is yes, you can.
just create a variable utmValue and put/set the result of the “get property of” block and then use the variable

Regards, Vlad

Yes, I am aware of that. The question is whether I can generate this via code, instead of using the ‘Create variable’ option in the menu. In UI Builder, in Page Data, I can add variables via code.

Sorry, but I’m not sure I understand what you mean by " I can generate this via code"

do you want to create a variable in the CustomCode and then use it in the codeless?

could you please provide screenshots of what are you looking for?

Yes, using your screenshot below, lets assume that I need to create 1000 variables, result1, result2, …, result1000.

Is it safe to assume that I need to click on the ‘Create variable’ grey button 1000 times?

In UI Builder, using logic with a loop such as the below, I can create the 1000 variables in Page Data automatically. I know I can do the same in Codeless if I create 1 variable that contains an object or list. The question is whether I can do this at the variable level, and I assume this is not possible.

if you need 1000 variables and/or you create them in a loop it means they are not variables, they more look like dynamic properties in a HashMap.

const var1 = 123
const var2 = 456

vs

const hashMap = {}

hashMap['prop1'] = 123
hashMap['prop2'] = 456

ok thank you