voglio assegnare i valori
test_3,5
test_1,3
test_0,2
test_2,4
presenti nel dictionary, a delle variabili.
Nel form io ho un campo di input Test che recupero con request.form
e n campi test che creo con javascript e che scorro con quest codice
<%
For Each i In Request.form
var=i & "_" & Request.Form(i)
'response.write "VAR=" & (var) & "
"
Str = Mid(var, 1, 5)
if str="test_" then 'or str="quan_" or str="data_" then
lth=len(var) 'lunghezza della stringa composta da nome campo "test", separatore "_", indice "1", separatore "_" e valore "3"
tot=instrrev(var,"_")'posizione del 2 carattere separatore
lenvalue=(lth-tot) 'la lunghezza in caratteri del valore
pos=(tot-len(str)-1) 'numero di caratteri di cui è composto l'indice
retTest_= retTest_ & fncPrelTest_(cnt, str, var, lenvalue, pos)
response.write(retTest_)
end if
Next
%>
La funzione sottostante
Function fncPrelTest_(cnt, str, var, lenvalue, pos)
Dim idx, vlu, dato, sep
Dim a, d, i, s
if pos > 0 then
idx = Mid(var, 6, pos)
vlu = right(var, lenvalue)
dato = "STR=" & str & idx & "_" & vlu
Set d = CreateObject("Scripting.Dictionary")
d.Add idx, vlu
a = d.Items ' Get the items.
b = d.keys
For i = 0 To d.Count -1
s = s & str & b(i) & "," & a(i) & "
"
Next
fncPrelTest_ = s
end if
End Function
mi carica il dictionary con i seguenti valori
io devo recuperare i valori
test_3,5
test_1,3
test_0,2
test_2,4
che io devo valorizzare come ho detto in variabili nel seguente modo
test0=2
test1=3
test2=4
test3=5
Ti prego dimme che mi sono spiegato altrimenti non so più come dirla.

Rispondi quotando