Dim SQL As SQL = DBM.GetSQL
Dim SQL_str As String = "SELECT * FROM caseattachments WHERE CaseACaseID = " & ActDetid &" AND CaseAType > 1"
Dim attachs As List = DBM.SQLSelect(SQL,SQL_str, Null)
Log(" attach case id: "&attachs.Size)
Dim attLocation As String = "../uploads/" &"comp_"&Maincomp_id&"/" ' files are stored in company named folders...
For i=0 To attachs.Size - 1
Dim attach As Map = attachs.Get(i)
Dim CaseAID As String = attach.Get("caseavalue")
Dim filename As String = attach.Get("shortname")
Attachments.Put(filename, CaseAID)
Dim chip As ABMChip
attCounter = attCounter + 1
Dim casetype As Int = attach.Get("caseatype")
If casetype = 0 Then
chip.Initialize(page, ""&attCounter, "{AL}" & attLocation & CaseAID & "{AT}{C:#000000}" &filename & "{/C}{/AL}" , True, "chip")
Else
chip.Initialize(page, ""&attCounter, "{AL}" & CaseAID & "{AT}{C:#000000}" &filename & "{/C}{/AL}" , True, "chip")
End If
chip.Tag = filename
inp.Content.Cell(5,1).AddArrayComponent(chip, "Chiplnkcase")
Next
DBM.CloseSQL(SQL)