#1237: Report Designer - Variables - Attaching to bands
--------------------------+-------------------------------------------------
Reporter: lalong | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: 0.9.2
Component: reporting | Version: 0.9.1
Resolution: | Keywords: reportdesigner, pagefooter, variables
--------------------------+-------------------------------------------------
Comment (by lalong):
{{{
1. Changed to segregate group variables into its own dictionary, named
"GroupVars", within the group, so we can easily locate the group
variables.
2. Added "resetSubgroupVars" to reset a group's lower level group vars.
Currently invoked by adding a string object to the group header and
setting the expr=self.resetSubgroupVars(grplvl), where grplvl is an
optional parameter (default=0) which is the group header's group level
Note: In the "real version", resetSubgroupVars should be automatically
called upon entering a new group header.
def resetSubgroupVars(self, groupid=0):
'''Use this function to reset all subgroup variables
Currently, I invoke this function by adding a field to a group
header band
and set expr=self.resetSubgroupVars(grplevel) where grplevel is
the group level of the band'''
for grp in self.ReportForm['Groups'][groupid+1:] :
if 'GroupVars' in grp.keys():
for grpvar in grp['GroupVars']:
grp['GroupVars'][grpvar]=0
return('')
def setGroupVar(self, groupid=0, var='Var', val=0):
if 'GroupVars' not in self.ReportForm['Groups'][groupid].keys():
self.ReportForm['Groups'][groupid]['GroupVars']={}
self.ReportForm['Groups'][groupid]['GroupVars'][var] = val
def incGroupVar(self, groupid=0, var='Var', val=1, inc_when=True):
if 'GroupVars' not in self.ReportForm['Groups'][groupid].keys():
self.ReportForm['Groups'][groupid]['GroupVars']={}
if not var in
self.ReportForm['Groups'][groupid]['GroupVars'].keys():
self.setGroupVar(groupid, var)
if inc_when:
self.ReportForm['Groups'][groupid]['GroupVars'][var] += val
def getGroupVar(self, groupid=0, var='Var'):
try:
return(self.ReportForm['Groups'][groupid]['GroupVars'][var])
except:
return 0
}}}
--
Ticket URL: <http://trac.dabodev.com/ticket/1237#comment:3>
Dabo Trac <http://trac.dabodev.com>
Trac Page for Dabo
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]