ServerConnection serverConnection = new ServerConnection() daten = serverConnection.doSQLQuery([[select sn_id, sn_text from tb_snippet join nt_live on sn_id=nt_snippetid where live_retired = 0 and (author_ok(live_author) or sql_statement_ok(sn_text) == 'definitely');]]) for each d in daten do title = "Result of #"..d.sn_id; if not serverConnection.hasNTTitle(title) then try result = serverConnection.doSQLQuery(d.sn_text).toJSON() catch e result = "Error: "..e end serverConnection.createNTSnippet(title, result) end end