Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating lists from an array and inserting into a database

Status
Not open for further replies.

questhaven

Programmer
Mar 28, 2001
81
US
Hi there - I am trying to figure out how to do something. Below I have included some code I have been working on which takes a list of images and their associated tpNum and deletes them from table individually and logs the deletion.

oldTPNum = ""
'loop through the array which holds the values that were NOT ticked
for i = 0 to ubound(arrInactive)
if arrInactive(i) <> &quot;&quot; then
InActiveimageType = right(arrInactive(i), 3) ' List of imagetypes
InActivenewtpNumber = left(arrInactive(i), 2) ' List of tpnum's associated with imagetypes
if InActiveimageType <> &quot;&quot; then
sql = &quot;exec sql_Record_ShareGetInfo &quot; & InActiveimageType & &quot;,&quot; & st.patient_id & &quot;,&quot; & InActivenewtpNumber
set rs = conn.execute(sql)
if not rs.eof then
imageType = rs(&quot;imageType&quot;)
tpNum = rs(&quot;tpNumber&quot;)
sql = &quot;exec sql_Record_ShareLookupDEL &quot; & shared_userID & &quot;,&quot; & st.patient_id & &quot;,&quot; & timepointID & &quot;,&quot; & image_id & &quot;,&quot; & request.form(&quot;cmbPermission&quot;)
set rs2 = conn.execute(sql)
comment = &quot;image deleted&quot;
call updateLog(image_id, 4, userID, tpNum, comment)
deletedImages = deletedImages & &quot;,&quot; & rtrim(imageType)

end if
end if
end if


What I am trying to do it create a list of the imagetypes that are associated with a specific tpNum and insert that list into the log as one record, after I insert them individually. Here is an example of the data I am dealing with:

TPNum = 0 - deleted Images are I10,I20, I30
TPNum = 1 - deleted images are I20, I30, I40
TpNum = 2 - deleted images are I10, I20, I30

(as you can see there can images that are named the same for each tpNum.

I was trying to do this, but it is not working. does anyone have any idea of what I am doing wrong?

if tpNum <> oldTpNum then
comment = &quot;You removed the &quot;&quot;share&quot;&quot; of &quot; & patientName & &quot;'s images &quot; & deletedImages & &quot; from timepointID &quot; & TpNum & &quot; with &quot; & shared_username
call updateLog(image_id, 9, shared_userID, tpNum, comment)
oldTPNum = tpNum
end if
end if


Thanks in advance for nay help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top