retrieve the key using a value in KeyValueMap

I have a KeyValueMap in my Policy. I want to call that KeyValueMap and pass a string (value) and retrieve its Key. For example, 

 

<Entry>
<Key>
<Parameter>Foo</Parameter>
</Key>
<Value>one</Value>
<Value>two</Value>
<Value>three</Value>
</Entry>
<Entry>
<Key>
<Parameter>Bar</Parameter>
</Key>
<Value>five</Value>
<Value>six/Value>
<Value>seven</Value>
</Entry>

I want to use the value 'one' to get its key 'Foo'

 

0 1 65
1 REPLY 1

The key value map allows you to store values against a key and retrieve values based on key, not value.

If you really want to do this, you could instead create an entry with each of your values as the key instead for example

<InitialEntries>
   
<Entry>
     
<Key>
         
<Parameter>one</Parameter>
     
</Key>
     
<Value>Foo</Value>
   
</Entry>
   
<Entry>
     
<Key>
         
<Parameter>two</Parameter>
     
</Key>
     
<Value>Foo</Value>
   
</Entry>
</InitialEntries>

Keep in mind, only your key needs to be unique.

Otherwise, you could create your own single data structure eg a json object that has your list of keys and values

{ "Foo": ["one","two","three"], "Bar": ["five","six","seven"]}

store your json in the kvm, retrieve the entire json object and then have some javascript to go through each array and find the corresponding value