This code creates a new table to contain the activities prepared for a new
level or grade. The activities are assigned to students as the year
progresses and they can then be reused in later years for other students.
The 200000 is used to organize tables, 100000 series is used for student
activity tables. I spent quite some time trying to get the script to work
using single quotes.
#Create new level table upon row insert
#Get table name
gridtbl=hk_thisform.get_pyvisible("gridlevel")
newtblname=gridtbl.datasource().column_by_name("level").asinteger() + 200000
#Must use double quotes, used for identifiers, although the table does not
exist yet, I expected to have to use single quotes
sqlstr = "CREATE TABLE \"" + str(newtblname) + "\" AS SELECT * FROM
\"tblLevelTemplate\" WHERE 1=2;"
#sqlstr = "CREATE TABLE \"" + str(newtblname) + "\" ( \"code\" char(5) );"
hk_this.show_warningmessage(sqlstr)
db=hk_thisform.database()
qrynewtbl=db.new_actionquery()
qrynewtbl.set_sql(sqlstr, True)
qryresult=qrynewtbl.execute()
hk_this.show_warningmessage(qrynewtbl.sql())
if qryresult == 1:
hk_this.show_warningmessage("Level table " + str(newtblname) + "
created.")
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Hk-classes-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hk-classes-discuss