How to create string variable which will store dynamic key value pair?

Hi Community,

I want to use string variable for storing dynamic key value pair value in it. After that I’ll use this string variable in the dictionary. But I don’t know exactly that how to create that string varibale which stores dynamic key value pair.

Appreciate for your help.

1 Like


Dynamic value to a string variable is simple enough that you can assign it with ASSIGN activity where you want in ur workflow so that it becomes dynamic to accept any key value from a dictionary

Only thing we need to ensure is that the string variable has to be a global variable
Which means the variable created in variable panel should have a scope of full workflow

Cheers @siddhi.rani


Basically have a string variable and assign the key value pair with any spearation you need and in next step you can use assign as below

Dict(str.Split({","},Stringsplitoptions.None)(0)) = str.Split({","},Stringsplitoptions.None)(1)

Assuming the key and value are separated by comma


Hi @Palaniyappan ,

I’ve used ASSIGN activity as you can see in the attach image. My requirement is to store the (counter,currentItem.ToString) in ‘FullList’ string variable. So, please tell me the correct way to do this.


May I know the inout and output format with some example value


The output of ‘counter’ is integer type in which I’m storing column no of excel and output of ‘currentItem’ is of int type which contains data of that particular column.

I want to store both data in one variable so that I can use that variable in Dictionary as ‘value’ because I’ve another variable for ‘key’.

@Palaniyappan .


How about to use special character such as tab as separator as the following?

fulllist = counter.ToString +chr(9)+currentItem.ToString

We can easily get each value like CInt(fulllist.Split(Chr(9)).First) or fulllist.Split(Chr(9)).Last


Does Dictionary<string,Tuple<Int32,string>> type work for you?


1 Like

Hi @siddhi.rani ,

Maybe the below is what you require :

dictTuple = new Dictionary(Of String,Tuple(Of String,String))
dictTuple("Key") = Tuple.Create("name","Address")

In places of the hardcoded values you can use the values from the variables, but the types should be converted to String for this particular else we can change the tuple types to the required.

Visuals :

You guys are suggesting to store both value in “Tuple” then use this in Dictionary as ‘value’ !!

  1. If I’m using ‘Tuple’ for storing 2 values in one variable, so can I store dynamic values inside it because the data may increase in future ?

  2. I’m just facing difficulty in storing the two values in one variable.

A few things are unclear, especially why a tuple is to translate into a string, when later a key-value pair is needed and it is added to a dictionary.

Before risking to fall into a XY-Problem we would suggest also to clear:

  • what is the initial use case to achieve
  • also check if other reprentations will better serve (JSON, new KeyValuePair(Of String, Int32)(“MyKey”,123)…

My initial requirement to achieve is to store two dynamic values in one variable so that I can use that variable in Dictionary as a Value not Key.