On 10/22/2015 3:04 PM, darren@xxxxxxxxx wrote:
I'm curious on the Python thing. I've not really dug into it, and I'm
wondering if its worth it. What limited examples I saw, were of generating
an Excel file from basically a file dump not much different than generating
a .csv. The example used some command line script to accomplish this.

I scratched this together in about 3 minutes. It should be enough to
see the general idea of one way to read DB2 for i data.

import db2
from xlsxwriter.workbook import Workbook

wb = Workbook('myfile.xlsx')
ws = wb.add_worksheet()
normal = wb.add_format({'bold': False})
bold = wb.add_format({'bold': True})

connection = db2.connect()
cursor = connection.cursor()

for i, row_contents in enumerate(cursor.execute('select * from
qgpl.qauoopt')):
if i == 4:
attribute = bold
else:
attribute = normal
ws.write_row(i, 0, row_contents, attribute)

wb.close()


I assume more advanced functions are available in Python, otherwise it
wouldn't be necessary, so is the entire report logic being done in Python.
We're doing things like colored column headers, conditional formatting,
formulas, break logic with subtotals, and most recently tables. Do you do
all of that along with the report logic in Python instead of RPG?

Yes, instead of RPG reaching out into Java to twitch the cell
attributes, Python does it all.


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].