This tutorial is not available for Accredo Mercury.
This tutorial shows you how to create a GL Financial Report that will iterate through branches, running the report for each branch.
F9). The wizard will create a report for you. You could run this report several times, once for each branch. Instead, we will modify the report to iterate through all branches, automatically producing a report for each branch and a consolidated total report.
F4).F4).F2). scForm = Nothing line, add the following code. This will find the first branch in the range, and determine whether the results will be consolidated:Dim tblCOBRANCH as Object
tblCOBRANCH = OpenTable("COBRANCH")
tblCOBRANCH.IndexName = "Branch"
If Branch <> "" Then
tblCOBranch.SetRange(Branch)
tblCOBranch.First
Consolidated = False
Else
tblCOBranch.First
Branch = tblCOBranch.BranchCode
Consolidated = True
End If
BranchName = tblCOBRANCH.BranchName
If Branch <> "" Then
Data = CreateObject("Accredo.COBranchData")
Data.FindExact(Branch)
BranchName = Data.BranchName
End If
Data = Nothing
F9) the changes to the code.F2). tblCOBRANCH.Next
If Not tblCOBRANCH.EOF then ' If there is another Branch in the range of branches selected, continue
RestartIterators ' Restart the report from the first iterator
bandRestart.ForceNewPage = True 'Restart on a new page
bandRestart.ForceNewWorksheet = True 'Restart on a new worksheet
Branch = tblCOBRANCH.BranchCode
BranchName = tblCOBRANCH.BranchName
Dim Iter as Object
For I = 0 To Iterators.Count - 1 'Loop through each of the Iterators
Iter = Iterators[I]
' Only modify iterators that select some accounts
If Iter.BranchRange <> "" or Iter.DepartmentRange <> "" or Iter.Segment1Range <> "" or Iter.Segment2Range <> "" or Iter.Selection <> "" Then
Iter.ExcludeNull = Not(IncludeNilBalances)
Iter.BranchRange = Branch
End If
Next 'Repeat for the next Iterator
Iter = Nothing
If UntransferredBatches Then 'If there are untransferred batches, don't enable the bandUnTransferred
bandUnTransferred.Enabled = False
End If
If UnpostedBatches Then 'If there are unposted batches, don't enable the bandUnTransferred
bandUnposted.Enabled = False
End If
ElseIf Consolidated = True then 'If this is the last in the range, and the report is consolidated, continue
RestartIterators ' Restart the report from the first iterator
bandRestart.ForceNewPage = True 'Restart on a new page
bandRestart.ForceNewWorksheet = True 'Restart on a new worksheet
Branch = "" 'Set branch to blank, as the branches are consolidated
BranchName = "Consolidated for All Branches"
Dim Iter as Object
For I = 0 To Iterators.Count - 1 'Loop through each of the Iterators
Iter = Iterators[I]
' Only modify iterators that select some accounts
If Iter.BranchRange <> "" or Iter.DepartmentRange <> "" or Iter.Segment1Range <> "" or Iter.Segment2Range <> "" or Iter.Selection <> "" Then
Iter.ExcludeNull = Not(IncludeNilBalances)
Iter.BranchRange = Branch
End If
Next 'Repeat for the next Iterator
Iter = Nothing
If UntransferredBatches Then 'If there are untransferred batches, don't enable the bandUnTransferred
bandUnTransferred.Enabled = False
End If
If UnpostedBatches Then 'If there are unposted batches, don't enable the bandUnTransferred
bandUnposted.Enabled = False
End If
Consolidated = False
End If
F9) the changes to the code.Ctrl+R). If you select a Branch, the report will run for the selected branch. If you leave the Branch selection clear, the report will run for each branch, and for the consolidated branches.See also the GL Tutorial: Saturn Report to Iterate Departments.