The code in sqlhtml.py for SQLTABLE has changed along the way from 2.18.5 to 2.21.1, especially in the way it handles columns.
This used to work:
in 2.21.1, I get an error
{{=SQLTABLE(rows, truncate=35, headers = {'QuarterMaster.IssueYr':'Year', 'QuarterMaster.StateNm':'State', 'QuarterMaster.Other':'Other', 'QuarterMaster.Mint':'Mint', 'QuarterMaster.NumAdded':'Count'},
columns=['QuarterMaster.IssueYr', 'QuarterMaster.StateNm', 'QuarterMaster.Other', 'QuarterMaster.Mint', 'QuarterMaster.NumAdded'], _class="table-striped myeheaders")}}
in 2.21.1, I get an error
Traceback (most recent call last):
File "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\applications\QuarterMaster\views\default/sortedQ.html", line 77, in <module>
File "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\gluon\sqlhtml.py", line 3544, in __init__
"Column %s not found (SQLTABLE)" % colname)
KeyError: 'Column IssueYr not found (SQLTABLE)'
I've tried "QuarterMaster.IssueYr", "db.QuarterMaster.IssueYr", "IssueYr", and "rows.IssueYr".
Same error.
If I eliminate the columns argument, no error, but my data doesn't show. I've verified in the controller that the data gets into rows, and looks like
<Row {'PostDate': datetime.date(2021, 12, 20), 'IssueYr': 1965L, 'StateNm': None, 'Other': None, 'Mint': 'x', 'id': 3647L, 'NumAdded': 1L}>
What do I need to make this work again?
Dave S
/dps