How to add a new dictionary Key and Value into an existing dictionary value

Hi,

First time posting. Been trying to solve this problem and since run out of ideas.

Beginner coder so my question may reflect some serious newbie face palming.

I’m trying to add a dictionary key and value (more than one) into an existing dictionary value. The idea is to build a list of dictionary keys into an existing dictionary value.

In the example below you can see the pre-build dictionary I created. Then I manually built a dictionary (loose “make a dictionary” block at the bottom right which I “set value for key path” into the existing dictionary “Test_List_Dic”.

What I want to do is create a list of new key and value pairs which I can add into existing dictionary values as an automation. Essentially I want the user to type in “RCBC” add, “RCP” add, “PVC” add and have the app build a list of keys (RCBC, RCP, PVC) with empty values and place them in the value set in the “set value for key” path.

I’m thinking I might be trying something not possible however, I’m hoping there is a way.

Really appreciate people spending their time my issue.

Cheers in advance!


HI,

Just a follow up.

The solution was to use the “list of pairs to dictionary” block. See image below.

Hope this helps others with a similar problem.

Cheers!

Use This block
image

Thanks for the info.

I figured it out “list to dictionary” shortly after posting. Now the challenge is renaming keys without loosing all the embedded values after the key tree.

Cheers

2 Likes

if you got your solution then you can mark solution so that new koders can learn :wink:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.