Ragazzi come vedrete dallo script seguente riesco a visualizzare a video una tabella contente i dati estratti da un file di testo.
Dato che un file di testo può contenere diverse informazioni come nel mio caso io vorrei abbinare il singolo dato ad un dato campo della select al singolo dato presente nel file csv pertanto opterei per un array bidimensionale.
Detto questo nella pagina che processa i dati sono riuscito a creare l'array che racchiude in un array i valori della select ma non riesco a fare in modo di racchiudere nel corrispondente array le singole porzioni di testo del file.
Qualcuno mi può dare suggerimenti?
codice:PAGINA CHE VISUALIZZA CONTENUTO FILE TXT <% nomefile = TRIM(Request.Form("nomefile")) contatore=1 strPath = Server.Mappath("/public/filevari/"& nomefile &"") Set objFileSy = Server.CreateObject("Scripting.FileSystemObject") Set objApriFile = objFileSy.OpenTextFile(strPath, 1) ' salto una linea 'objApriFile.SkipLine do while not objApriFile.AtEndOfStream myRow = objApriFile.Readline 'creo un array per contare le righe Redim Preserve mioarray(contatore) mioarray(contatore) = myRow contatore = contatore + 1 loop Session("arrTest") = mioarray Response.Write "<form method=POST action=salvacsvdb.asp>" cont = 0 Response.Write "<table border=1>" Response.Write "<TR>" do until cont = 20 cont = cont + 1 vmyRow = mioarray(cont) IF Instr(vmyRow ,";") > 0 then vmyRow = Split(vmyRow , ";") for j = 0 to Ubound(vmyRow) IF cont = 1 and j <= Ubound(vmyRow) then Response.Write "<td>" Response.Write "<select name=select" & j &" size=1>" Response.Write "<option value=0>Ignora</option>" Response.Write "<option value=1>nome</option>" Response.Write "<option value=2>cognome</option>" Response.Write "<option value=3>azienda</option>" Response.Write "<option value=4>città</option>" Response.Write "<option value=5>provincia</option>" Response.Write "<option value=6>cap</option>" Response.Write "<option value=7>regione</option>" Response.Write "<option value=8>paese</option>" Response.Write "<option value=9>indirizzo</option>" Response.Write "<option value=10>fax</option>" Response.Write "<option value=11>Email</option>" Response.Write "<option value=12>Cellulare</option>" Response.Write "<option value=13>telefono</option>" Response.Write "</select></TD>" end if IF j=Ubound(vmyRow) and cont=1 then Response.Write "</tr><tr>" end if next for i = 0 to Ubound(vmyRow) Response.Write "<td>" & vmyRow(i) &"</td>" next end if Response.Write "</tr>" loop Response.Write "<table>" Response.Write "<input type=submit value=Invia name=B1></form>" objApriFile.Close Set objApriFile = Nothing Set objFileSy = Nothing %> PAGINA CHE ABBINA LA SELECT AL FILE CSV <% conteggio = Request.Form.Count reDim arrayForm(0,conteggio) intIndice = 0 'immagazzino nell'array il valore del request.form For intLoop = 1 to Request.Form.Count campo2 = Request.Form.Item(intLoop) arrayForm(0, intIndice) = campo2 intIndice = intIndice + 1 next redim Preserve arrayForm(0, intIndice-2) For intIndice = 0 To UBound(arrayForm , 2) descrizione = arrayForm (0, intIndice) response.write descrizione &" " next arrTest = Session("arrTest") tot = Ubound(arrTest) * conteggio reDim arrayForm(1,tot) intIndice1 = 0 for j = 0 to Ubound(arrTest) vmyRow = arrTest(j) IF Instr(vmyRow,";") > 0 then vmyRow = Split(vmyRow , ";") for i = 0 to Ubound(vmyRow) campo3 = vmyRow(i) 'Response.Write vmyRow(i) &" - " arrayForm(1,intIndice1 ) = campo3 Response.write "" & arrayForm(1,intIndice1 ) &" -" intIndice1 = intIndice1 + 1 next Response.Write " " end if next %>

Rispondi quotando