Hi Community, i want to replace the dictionary alternate value with list

I have below dictionary and list
dictionary : [Vishal Kalra, 43,120,44,120,45,120,46,120,47,120,48,120]
list : 43,April 2022,44,May 2022,45,June 2022,46,July 2022,47,August 2022,48,September 2022

I want to replace the dictionary value 43 with the list value April 2022.

I want the final output as : [Vishal Kalra, April 2022,120,May 2022,120,June 2022,120,July 2022,120,August 2022,120,September 2022,120].

Please help on this.

thanks.

Hi @Sarika13 ,

Could you maybe let us know what is the Dictionary type that is used ? If already done in a workflow? Could you maybe provide us the values shown in Debug Panel ?

There are slight confusions of the representation chosen for Dictionary and List.

Dict(of String,String) - [Vishal Kalra, 43,120,44,120,45,120,46,120,47,120,48,120]
list(Of String) - April 2022,May 2022,June 2022,July 2022,August 2022,September 2022

i want Dict as - [Vishal Kalra, April 2022,120,May 2022,120,June 2022,120,…]

@Sarika13 ,

It seems like a similar query is asked in another post. Could you check the below post :

@supermanPunch sure

Hi @Sarika13

Can you try these steps-

  1. Initialize a dictionary variable with the given key-value pairs.
  2. Initialize a list variable with the given values.
  3. Use a For Each activity to iterate over the items in the list.
  4. Within the For Each loop, use an If activity to check if the current item is a number.
  5. If the current item is 43, use the Assign activity to store the number in a variable.
  6. If the current item is not 43 , then use the Assign activity to replace the corresponding value in the dictionary with the current item.
  7. After the For Each loop is completed, use the Write Line activity to display the updated dictionary.

Thanks!

@Sarika13

Please check this…i guess its the same requirement.You can see each step lined out

Hope this helps

Cheers