cancel
Showing results for 
Search instead for 
Did you mean: 

Changing dict type values in IVR

Former Member
0 Kudos

Hi. I'm wondering is there a simple method to change only the one value of a dict type variable without touching any other values? In the enclosed example (Untitled.png) assign state seems to delete other than listed values. In other words: how can I change or append data to the {IVRINFO} without sweeping it's current content? Thanks for any advices.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187604
Contributor
0 Kudos

Hi Krzysztof,

you could try using one of the below approaches.

1. Setting all the dictionary values each time, but using str(dict['key']) to store the current value of a key you don't want to change:

In the example, only TestDict["NumberInfo"] would be modified.

2. Using the dictionary update method, via a temp variable (var or assign):

The example updates TestDict2["Key2"] to "oof" and leaves other dictionary content intact.
For example, before TestDict2 = {'Key1': 'foo', 'Key2': 'bar'}, after {'Key1': 'foo', 'Key2': 'oof'}.

By using the first approach, you will know the exact dictionary contents after the assign state. With the latter one, on the other hand, you don't need to know/check the dictionary contents before updating and will not accidentally overwrite other values.

Hope you get your IVR working.

Regards,

-Lasse


Former Member
0 Kudos

Thanx for reply Lasse. Here is my solution:

This is kind of an union of two dictionaries!

Cheers!

Answers (0)