CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Nov 2008
    Location
    Calgary, Alberta, Canada
    Posts
    3

    Question Conditionally Replicating Group Header

    Hi,

    I am new to Crystal Reports, but I have been coding with VBA in ArcGIS for a few years now.

    I am populating parameters in a group header in an existing Crystal Report with variables from within my code (the variables are taken from features in a ArcMap project, but that is not important). I can pass the parameters in with no problem. My problem is that the existing crystal report has one instance of the group header that I am populating parameters in. Depending on the number of variables created in the code, I need to 'replicate' the group header (and all of the parameters inside it) one or more times and then populate these parameters.

    So the final product that I am hoping for is a report with a conditonal number of group headers that are identical except for the values of the parameters inside them.

    Is there a way to copy the empty group header (and the parameters inside it) and paste it directly below its initial instance?

    Thanks in advance,
    Scott

    Here is a sample of my code. I removed irrelevant parts and put in some rough pseudoCode explaining what I hope to do.

    Code:
        Dim Num_Crossings as Long
        
        Dim CrApp As CRAXDRT.Application
        Set CrApp = New CRAXDRT.Application
    
        'Initialize crystal report
        Dim crReport As CRAXDRT.Report
        Set crReport = CrApp.OpenReport(".\Pipeline Crossing Summary.rpt", 1)
        crReport.DiscardSavedData
        
        'Determine the number of pipeline crossings
        'This is done using ArcGIS tools and the code is not relevant to my question
    	
        'Create arrays for passing into parameters
        Dim Comp_Name(Num_Crossings) as String
        Dim Area_Office(Num_Crossings) as String
    	
        'Populate the arrays
        'This is done using ArcGIS tools and the code is not relevant to my question
        
        Dim crGroup as Crystal Report Group          '<-pseudo code
        Set crGroup = crReport.Group(index)          '<-pseudo code
    
        crGroup.copy() 						'<-pseudo code
    
        For i = 0 to Num_Crossings 			'<-pseudo code
        	crGroup.Paste() 				        '<-pseudo code
        	crReport.ParameterFields.GetItemByName("Company").SetCurrentValue _
                 Comp_Name(i)  '<-probably need a new parameter each time
        	crReport.ParameterFields.GetItemByName("Office").SetCurrentValue _
                 Area_Office(i)    '<-probably need a new parameter each time
        Next i
    Last edited by scott.fraser; November 22nd, 2008 at 03:10 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured