I am trying to get some inserts going based on a number of formfield paramaeters that look like this.
UsrId = 2
Date = 10/19/2001
Time = 8
Shift = 1
WeekNum =
QcNum = 35, 36, 37
SampleFreq = 4, 2, 2
NumMeas = 5, 2, 3
TestGroup = 1, 1, 1
MachineID = 8, 8, 8
Measurement1 = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3
in this case there are 30 measurements to enter
what I have done is made arrays of all the pertaining fields
The number of measurements correspond to the elements in the samplefreq and the nummeas fields.
ie. qcNum 35, samplefreq(0) * nummeas(0) = 20
So I need to insert the measurement: 1 20 times
there are 3 qc nums so I have to get the next number of inserts to do qcnum 36, samplefreq(1) * nummeas(1) = 4
insert measurement: 2 4 times
etc etc.
hope you get the picture.
I can get the first insert to go but Im stuck on how to walk down each array and be able to multiply the 2 values together to get my number of inserts to do.
code:
' -- array of the number of machinneids
Mach = Split(Request.Form("MachineId", ","
'-- array of frequencies
Freqs = Split(Request.Form("SampleFreq", ","
nMeas1 = Split(Request.Form("Measurement1", ","
Samplesize = Split(Request.Form("NumMeas", ","
nStop = Samplesize(0) * Freqs(0)
Response.write "nstop = " & nstop & "<P></P>"
z = 0
Do until z = nStop
Response.write z & "SQL = Insert INTO dbo.[Tests] ("
response.write "UsrId,Date,Time,Shift,Week,Measurement1"
Response.write "
Values (" & Request("UsrId" & "," & Request("Date" & "," & Request("Time" & "," & Request("Shift" & "," & nWeek & "," & nMeas1(z) & "
"
z = z + 1
LOOP
I'm hoping everyone understands this and if you could share some pseudocode or point me in the "write" direction I would be grateful.
Thanks.
Dave
UsrId = 2
Date = 10/19/2001
Time = 8
Shift = 1
WeekNum =
QcNum = 35, 36, 37
SampleFreq = 4, 2, 2
NumMeas = 5, 2, 3
TestGroup = 1, 1, 1
MachineID = 8, 8, 8
Measurement1 = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3
in this case there are 30 measurements to enter
what I have done is made arrays of all the pertaining fields
The number of measurements correspond to the elements in the samplefreq and the nummeas fields.
ie. qcNum 35, samplefreq(0) * nummeas(0) = 20
So I need to insert the measurement: 1 20 times
there are 3 qc nums so I have to get the next number of inserts to do qcnum 36, samplefreq(1) * nummeas(1) = 4
insert measurement: 2 4 times
etc etc.
hope you get the picture.
I can get the first insert to go but Im stuck on how to walk down each array and be able to multiply the 2 values together to get my number of inserts to do.
code:
' -- array of the number of machinneids
Mach = Split(Request.Form("MachineId", ","
'-- array of frequencies
Freqs = Split(Request.Form("SampleFreq", ","
nMeas1 = Split(Request.Form("Measurement1", ","
Samplesize = Split(Request.Form("NumMeas", ","
nStop = Samplesize(0) * Freqs(0)
Response.write "nstop = " & nstop & "<P></P>"
z = 0
Do until z = nStop
Response.write z & "SQL = Insert INTO dbo.[Tests] ("
response.write "UsrId,Date,Time,Shift,Week,Measurement1"
Response.write "
Values (" & Request("UsrId" & "," & Request("Date" & "," & Request("Time" & "," & Request("Shift" & "," & nWeek & "," & nMeas1(z) & "
"
z = z + 1
LOOP
I'm hoping everyone understands this and if you could share some pseudocode or point me in the "write" direction I would be grateful.
Thanks.
Dave