Showing results for 
Search instead for 
Did you mean: 

EEM applet: context retrieve with variables pattern?

Sergey Mikhaylov



For example, save variables: var1, var2, var3 by variables pattern: var* to single context key: vars.


event manager applet ctx_save

event none

 action 1.0 set var1 1

 action 2.0 set var2 2

 action 3.0 set var3 3

 action 4.0 context save key vars variable "var*"


But, how retrieve?

event manager applet ctx_retrieve

event none


 ! action 1.0 context retrieve key vars variable "var*"


 ! retrieve data, but how access to values?

 action 1.0 context retrieve key vars


How to retrieve variables and access to its values using the same pattern?

2 Replies 2

VIP Community Legend VIP Community Legend
VIP Community Legend

I do believe that is possible, in a programming point of view, what is the var stored? what value does it retrieve from 1 or 2 or 3?


here is some guidelines :


you can call variable when the action required.#



***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Seb Rupik
VIP Advisor VIP Advisor
VIP Advisor

Hi there,

This is not a function I have used before, but having read up on it the pattern is:

context save key <key_name> variable <variable_name>

context retrieve key <key_name> variable <target_variable_name>

So an example would be:

action 1.0 set var1 1
action 2.0 set var2 2
action 3.0 set var3 3
action 4.0 context save key k_var1 variable "var1"
action 4.1 context save key k_var2 variable "var2"
action 4.2 context save key k_var3 variable "var3"
action 5.0 retrieve key k_var1 variable "old_var1"
action 5.1 retrieve key k_var2 variable "old_var2"
action 5.2 retrieve key k_var3 variable "old_var3"
action 6.0 syslog msg "Old variables, $old_var1, $old_var2, $old_var3"



Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers