vbscript - How to show keys in a Motobit Multi.Dictionary by the given item value? -
i'm new programming i'm sorry if question seems dumb. want ask if there way return keys multi.dictionary
when have value?
this code:
dim mydict set mydict= server.createobject("multi.dictionary") mydict.uniquekeys = false 'fill dictionary data mydict("param1") = "value1" mydict.add "param2", "value2" mydict.add "param2", "value2.2" 'get dictionary keys keys = mydict.keys items = mydict.items z = 0 ubound(items) response.write(keys(z) & " " & items(z) & "<br>") next
and returns
subscript out of range: '2'
which normal because loop 3 times while have 2 keys.
so possible have result this:
param1: "value1" param2: "value2" param2: "value2.2"
can loop through keys of mydict
checking items multiple or not.
dim mydict set mydict= server.createobject("multi.dictionary") mydict.uniquekeys = false mydict("param1") = "value1" mydict.add "param2", "value2" mydict.add "param2", "value2.2" dim key, subitem each key in mydict.keys if isarray(mydict(key)) ' item array each subitem in mydict(key) response.write key & ": " & subitem & "<br>" next else response.write key & ": " & mydict(key) & "<br>" end if next
Comments
Post a Comment