Naming Variables


#1

Hi,

How do you use value of other variables when creating new variables (not for the value but for the name of the new variable) ??

I had


#3

Unless you want to dive deep, using a Dictionary(Of String, Object) would be much easier.
You can check ReFramework’s InitAllSettings.xaml for how one could be built.
What’s your use case?

For the original question, only thing that comes to mind would be to create runtime variables by using nameof calls. But AFAIK, they would by definition be limited in scope, require a custom activity (probably) and nameof is not available in current Studio version (requires VB.Net 14).


#4

Hi thank you for the answer.

I want to create dictionary dynamically, depending of a values in excel. I wanted to use a foreach row loop to create my dictionary, initialize it and also add key pairs into it and then go to next row, check condition if true do exactly the same … but to do so I need to create dictionary with different names … I don’t know upfront how ;any dictionary is will have to create that’s why I need to do it dynamically if possible


#5

Hmm… If I understand you correctly, you need a structure like this?

myDynamicVariables(runtimeName)(runtimeId)

If yes, you could use a Dictionary(Of string, Dictionary(Of string, object)) and get values out like this:

myDynamicVariables("customerData")("customerName")
myDynamicVariables("employeeData")("employeeId")

Building that might be a little tricky (make sure all nested dictionaries are initialized), but once done it would be pretty easy to use.

(gotta run now, will check here in the afternoon if it’s still open)


#6

Thank you!,
I need indeed a structure like that, I still have some errors but I will fix them :slight_smile:


#7

Hi, I’m still having some problems, because I need to create dictionaries dynamically so I can put them in de bigger dictionary (MyDynamicVariables) …


#8

Sorry again for my answer, but I solved my problems, thank you!