Browse Source

Conclusão da interface

diagnosticos
Sesostris Vieira 14 years ago
parent
commit
e4c41ec8f6
  1. 21
      sigi/birtReport/birtReport.py

21
sigi/birtReport/birtReport.py

@ -65,6 +65,23 @@ class BirtReport():
if xmlProp.getAttribute('name') == 'queryText': if xmlProp.getAttribute('name') == 'queryText':
formField['queryText'] = xmlProp.childNodes[0].data formField['queryText'] = xmlProp.childNodes[0].data
labelFieldName = formField['labelExpr'].replace('dataSetRow["', '').replace('"]', '')
valueFieldName = formField['valueExpr'].replace('dataSetRow["', '').replace('"]', '')
for struct in dataSet.getElementsByTagName('structure'):
if struct.getAttribute('name') == 'cachedMetaData':
for list in struct.getElementsByTagName('list-property'):
if list.getAttribute('name') == 'resultSet':
for subStructure in list.getElementsByTagName('structure'):
dataSetField = {}
for fieldProp in subStructure.getElementsByTagName('property'):
dataSetField[fieldProp.getAttribute('name').encode('ascii')] = fieldProp.childNodes[0].data
if dataSetField['name'] == labelFieldName:
labelFieldIndex = int(dataSetField['position']) - 1
if dataSetField['name'] == valueFieldName:
valueFieldIndex = int(dataSetField['position']) - 1
try: try:
from django.db import connection from django.db import connection
cursor = connection.cursor() cursor = connection.cursor()
@ -72,7 +89,7 @@ class BirtReport():
resultSet = cursor.fetchall() resultSet = cursor.fetchall()
formField['selectionList'] = () formField['selectionList'] = ()
for record in resultSet: for record in resultSet:
formField['selectionList'] = formField['selectionList'] + ({'value': record[0],'label': record[1]},) formField['selectionList'] = formField['selectionList'] + ({'value': record[valueFieldIndex],'label': record[labelFieldIndex]},)
# formField['selectionList'] = resultSet # formField['selectionList'] = resultSet
except: except:
@ -100,7 +117,7 @@ class BirtReport():
#r = birtReport('/home/sesostris/workspace/sigi/BIRT_Reports/teste_parametros.rptdesign') #r = BirtReport('/home/sesostris/workspace/sigi/BIRT_Reports/teste_parametros.rptdesign')
#p = r.getReportParams() #p = r.getReportParams()
#print p['prm_estado'] #print p['prm_estado']

Loading…
Cancel
Save