DaveS
11 November 2020 21:34
1
What is the easiest way to select a list of records and present them in 3 ordered columns? Doing left to right then down is easy… but I need to do in down, then left to right…
A E I
B F J
C G K
D H L
SELECT name FROM myTABLE ORDER BY name
DaveS
11 November 2020 23:10
2
SOLVED [Swift]
private func output_columns(_ rs : SQLiteRecordSet) {
var cnt : Int = rs.recordCount
var col : [Int] = [0,0,0]
col[0] = (cnt/3)
col[1] = col[0]
col[2] = col[0]
cnt = cnt-col[0]-col[1]-col[2]
if cnt>0 { col[0]+=1; cnt-=1 }
if cnt>2 { col[1]+=1}
cnt=col[0]+col[1]+col[2]
HTMLFile?.write("<tr>")
for i in(0...2) {
HTMLFile?.write("<td><table cellspacing=0 cellpadding=0 border=0 width=100%>")
if col[i]>0 {
for _ in(0...col[i]-1) {
let s = rs.Field("NAME").stringValue()
HTMLFile?.write("<tr><td class=col1>\(s)</td></tr>")
rs.MoveNext()
}
}
if col[i]<col[0] {HTMLFile?.write("<tr><td class=col\(i)> </td></tr>") }
HTMLFile?.write("</table></td>")
}
HTMLFile?.write("</tr>")
}